aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/surface/byte_buffer_reader.cc
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-12-08 14:02:18 -0800
committerGravatar Muxi Yan <mxyan@google.com>2017-12-08 14:02:18 -0800
commit99024d64367b62c98f03dda5c800c7418bcbf123 (patch)
treec1fdbd9705d483107279770f2860342405ae2bbd /src/core/lib/surface/byte_buffer_reader.cc
parent5c5bafff5a7974b54cb16cbf2222580bc0349e77 (diff)
parent94e676e10f8c739289924b8458a246699e3623ce (diff)
Merge remote-tracking branch 'upstream/master' into fix-stream-compression-config-interface
Diffstat (limited to 'src/core/lib/surface/byte_buffer_reader.cc')
-rw-r--r--src/core/lib/surface/byte_buffer_reader.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/lib/surface/byte_buffer_reader.cc b/src/core/lib/surface/byte_buffer_reader.cc
index d6d347987d..f7ea5161c7 100644
--- a/src/core/lib/surface/byte_buffer_reader.cc
+++ b/src/core/lib/surface/byte_buffer_reader.cc
@@ -42,7 +42,7 @@ 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) {
@@ -50,7 +50,7 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
grpc_slice_buffer_init(&decompressed_slices_buffer);
if (is_compressed(reader->buffer_in)) {
if (grpc_msg_decompress(
- &exec_ctx,
+
grpc_compression_algorithm_to_message_compression_algorithm(
reader->buffer_in->data.raw.compression),
&reader->buffer_in->data.raw.slice_buffer,
@@ -66,15 +66,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;
}
@@ -114,14 +113,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;
}