diff options
author | 2017-10-13 16:07:13 -0700 | |
---|---|---|
committer | 2017-10-18 17:12:19 -0700 | |
commit | 0ee7574732a06e8cace4e099a678f4bd5dbff679 (patch) | |
tree | e43d5de442fdcc3d39cd5af687f319fa39612d3f /src/core/ext/filters/workarounds | |
parent | 6bf5f833efe2cb9e2ecc14358dd9699cd5d05263 (diff) |
Removing instances of exec_ctx being passed around in functions in
src/core. exec_ctx is now a thread_local pointer of type ExecCtx instead of
grpc_exec_ctx which is initialized whenever ExecCtx is instantiated. ExecCtx
also keeps track of the previous exec_ctx so that nesting of exec_ctx is
allowed. This means that there is only one exec_ctx being used at any
time. Also, grpc_exec_ctx_finish is called in the destructor of the
object, and the previous exec_ctx is restored to avoid breaking current
functionality. The code still explicitly calls grpc_exec_ctx_finish
because removing all such instances causes the code to break.
Diffstat (limited to 'src/core/ext/filters/workarounds')
-rw-r--r-- | src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc index f77ed02421..95e4719e66 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc @@ -50,8 +50,7 @@ static bool get_user_agent_mdelem(const grpc_metadata_batch* batch, } // Callback invoked when we receive an initial metadata. -static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, - void* user_data, grpc_error* error) { +static void recv_initial_metadata_ready(void* user_data, grpc_error* error) { grpc_call_element* elem = (grpc_call_element*)user_data; call_data* calld = (call_data*)elem->call_data; @@ -67,14 +66,13 @@ static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, } // Invoke the next callback. - GRPC_CLOSURE_RUN(exec_ctx, calld->next_recv_initial_metadata_ready, + GRPC_CLOSURE_RUN(calld->next_recv_initial_metadata_ready, GRPC_ERROR_REF(error)); } // Start transport stream op. static void start_transport_stream_op_batch( - grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - grpc_transport_stream_op_batch* op) { + grpc_call_element* elem, grpc_transport_stream_op_batch* op) { call_data* calld = (call_data*)elem->call_data; // Inject callback for receiving initial metadata @@ -96,12 +94,11 @@ static void start_transport_stream_op_batch( } // Chain to the next filter. - grpc_call_next_op(exec_ctx, elem, op); + grpc_call_next_op(elem, op); } // Constructor for call_data. -static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, - grpc_call_element* elem, +static grpc_error* init_call_elem(grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = (call_data*)elem->call_data; calld->next_recv_initial_metadata_ready = NULL; @@ -113,20 +110,18 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, } // Destructor for call_data. -static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, +static void destroy_call_elem(grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) {} // Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, - grpc_channel_element* elem, +static grpc_error* init_channel_elem(grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } // Destructor for channel_data. -static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, - grpc_channel_element* elem) {} +static void destroy_channel_elem(grpc_channel_element* elem) {} // Parse the user agent static bool parse_user_agent(grpc_mdelem md) { @@ -181,7 +176,7 @@ const grpc_channel_filter grpc_workaround_cronet_compression_filter = { "workaround_cronet_compression"}; static bool register_workaround_cronet_compression( - grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) { + grpc_channel_stack_builder* builder, void* arg) { const grpc_channel_args* channel_args = grpc_channel_stack_builder_get_channel_arguments(builder); const grpc_arg* a = grpc_channel_args_find( |