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/lib/channel/handshaker_registry.cc | |
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/lib/channel/handshaker_registry.cc')
-rw-r--r-- | src/core/lib/channel/handshaker_registry.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/core/lib/channel/handshaker_registry.cc b/src/core/lib/channel/handshaker_registry.cc index c6bc87d704..098eabf084 100644 --- a/src/core/lib/channel/handshaker_registry.cc +++ b/src/core/lib/channel/handshaker_registry.cc @@ -47,18 +47,17 @@ static void grpc_handshaker_factory_list_register( } static void grpc_handshaker_factory_list_add_handshakers( - grpc_exec_ctx* exec_ctx, grpc_handshaker_factory_list* list, - const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) { + grpc_handshaker_factory_list* list, const grpc_channel_args* args, + grpc_handshake_manager* handshake_mgr) { for (size_t i = 0; i < list->num_factories; ++i) { - grpc_handshaker_factory_add_handshakers(exec_ctx, list->list[i], args, - handshake_mgr); + grpc_handshaker_factory_add_handshakers(list->list[i], args, handshake_mgr); } } static void grpc_handshaker_factory_list_destroy( - grpc_exec_ctx* exec_ctx, grpc_handshaker_factory_list* list) { + grpc_handshaker_factory_list* list) { for (size_t i = 0; i < list->num_factories; ++i) { - grpc_handshaker_factory_destroy(exec_ctx, list->list[i]); + grpc_handshaker_factory_destroy(list->list[i]); } gpr_free(list->list); } @@ -74,10 +73,9 @@ void grpc_handshaker_factory_registry_init() { memset(g_handshaker_factory_lists, 0, sizeof(g_handshaker_factory_lists)); } -void grpc_handshaker_factory_registry_shutdown(grpc_exec_ctx* exec_ctx) { +void grpc_handshaker_factory_registry_shutdown() { for (size_t i = 0; i < NUM_HANDSHAKER_TYPES; ++i) { - grpc_handshaker_factory_list_destroy(exec_ctx, - &g_handshaker_factory_lists[i]); + grpc_handshaker_factory_list_destroy(&g_handshaker_factory_lists[i]); } } @@ -88,11 +86,9 @@ void grpc_handshaker_factory_register(bool at_start, &g_handshaker_factory_lists[handshaker_type], at_start, factory); } -void grpc_handshakers_add(grpc_exec_ctx* exec_ctx, - grpc_handshaker_type handshaker_type, +void grpc_handshakers_add(grpc_handshaker_type handshaker_type, const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) { grpc_handshaker_factory_list_add_handshakers( - exec_ctx, &g_handshaker_factory_lists[handshaker_type], args, - handshake_mgr); + &g_handshaker_factory_lists[handshaker_type], args, handshake_mgr); } |