aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/surface/byte_buffer_reader.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2017-12-13 14:44:29 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2017-12-13 14:44:29 -0800
commit54d699ddda18e8aca7a556ad3c38d1684efc88ec (patch)
treeb0ecaaf07074bdcde6c3315f647cc04417da7b90 /src/core/lib/surface/byte_buffer_reader.cc
parent62d86e9987121c8bd79d4594fb0db019c4faafad (diff)
parent91a851c6e1f6bc7c1dbf84ea12558d535c911252 (diff)
Merge branch 'master' of github.com:grpc/grpc into backoff_cpp
Diffstat (limited to 'src/core/lib/surface/byte_buffer_reader.cc')
-rw-r--r--src/core/lib/surface/byte_buffer_reader.cc16
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;
}