aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-07-26 14:48:21 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-07-26 14:48:40 -0700
commita2279bd23a0a00bc36618d7d9d26d197143510d0 (patch)
tree6bd6c7a59271599064a5db47615f9529df33ccc6 /src/core/ext
parent3c902ab943368e9664c5be135f1e57a7250e42fc (diff)
config - Move slice buffer creation to stream compression enabling time for performance
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c9
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index 212704a121..0b9c7458db 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -1278,6 +1278,15 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
if (op->send_initial_metadata) {
GPR_ASSERT(s->send_initial_metadata_finished == NULL);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
+
+ /* Identify stream compression */
+ if ((s->stream_compression_send_enabled =
+ (op_payload->send_initial_metadata.send_initial_metadata->idx.named
+ .content_encoding != NULL)) == true) {
+ s->compressed_data_buffer = gpr_malloc(sizeof(grpc_slice_buffer));
+ grpc_slice_buffer_init(s->compressed_data_buffer);
+ }
+
s->send_initial_metadata_finished = add_closure_barrier(on_complete);
s->send_initial_metadata =
op_payload->send_initial_metadata.send_initial_metadata;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c
index e0721889f3..d4800aa701 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c
@@ -1665,6 +1665,8 @@ static void parse_stream_compression_md(grpc_exec_ctx *exec_ctx,
if (!grpc_slice_eq(content_encoding, GRPC_MDSTR_IDENTITY)) {
if (grpc_slice_eq(content_encoding, GRPC_MDSTR_GZIP)) {
s->stream_compression_recv_enabled = true;
+ s->decompressed_data_buffer = gpr_malloc(sizeof(grpc_slice_buffer));
+ grpc_slice_buffer_init(s->decompressed_data_buffer);
}
}
}