diff options
Diffstat (limited to 'src/core/lib/surface/byte_buffer_reader.cc')
-rw-r--r-- | src/core/lib/surface/byte_buffer_reader.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/core/lib/surface/byte_buffer_reader.cc b/src/core/lib/surface/byte_buffer_reader.cc index 001227a2aa..81a48e95fc 100644 --- a/src/core/lib/surface/byte_buffer_reader.cc +++ b/src/core/lib/surface/byte_buffer_reader.cc @@ -42,15 +42,14 @@ static int is_compressed(grpc_byte_buffer* buffer) { int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_core::ExecCtx exec_ctx; grpc_slice_buffer decompressed_slices_buffer; reader->buffer_in = buffer; switch (reader->buffer_in->type) { case GRPC_BB_RAW: grpc_slice_buffer_init(&decompressed_slices_buffer); if (is_compressed(reader->buffer_in)) { - if (grpc_msg_decompress(&exec_ctx, - reader->buffer_in->data.raw.compression, + if (grpc_msg_decompress(reader->buffer_in->data.raw.compression, &reader->buffer_in->data.raw.slice_buffer, &decompressed_slices_buffer) == 0) { gpr_log(GPR_ERROR, @@ -64,15 +63,14 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_raw_byte_buffer_create(decompressed_slices_buffer.slices, decompressed_slices_buffer.count); } - grpc_slice_buffer_destroy_internal(&exec_ctx, - &decompressed_slices_buffer); + grpc_slice_buffer_destroy_internal(&decompressed_slices_buffer); } else { /* not compressed, use the input buffer as output */ reader->buffer_out = reader->buffer_in; } reader->current.index = 0; break; } - grpc_exec_ctx_finish(&exec_ctx); + return 1; } @@ -112,14 +110,14 @@ grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader* reader) { grpc_slice out_slice = GRPC_SLICE_MALLOC(input_size); uint8_t* const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */ - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_core::ExecCtx exec_ctx; while (grpc_byte_buffer_reader_next(reader, &in_slice) != 0) { const size_t slice_length = GRPC_SLICE_LENGTH(in_slice); memcpy(&(outbuf[bytes_read]), GRPC_SLICE_START_PTR(in_slice), slice_length); bytes_read += slice_length; - grpc_slice_unref_internal(&exec_ctx, in_slice); + grpc_slice_unref_internal(in_slice); GPR_ASSERT(bytes_read <= input_size); } - grpc_exec_ctx_finish(&exec_ctx); + return out_slice; } |