From c802adfa8aabf674733f66db78725690b6de99b5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Oct 2022 20:50:56 -0700 Subject: [PATCH] [event_engine] Move security executor usage to event engine (#31231) * [event_engine] Move security executor usage to event engine * build-fix * fix-iwyu --- BUILD | 1 + src/cpp/client/secure_credentials.cc | 21 +++++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/BUILD b/BUILD index 22f49c44ff4..ce2eecedad5 100644 --- a/BUILD +++ b/BUILD @@ -7326,6 +7326,7 @@ grpc_cc_library( "channel_init", "channel_stack_type", "config", + "default_event_engine", "env", "error", "gpr", diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index a66c32edd9d..18069e2a64b 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -29,6 +29,7 @@ #include "absl/strings/str_join.h" #include "absl/types/optional.h" +#include #include #include #include @@ -42,10 +43,9 @@ #include #include +#include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/env.h" -#include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/json/json.h" #include "src/core/lib/security/util/json_util.h" @@ -412,14 +412,6 @@ std::shared_ptr MetadataCredentialsFromPlugin( c_plugin, GRPC_PRIVACY_AND_INTEGRITY, nullptr)); } -namespace { -void DeleteWrapper(void* wrapper, grpc_error_handle /*ignored*/) { - MetadataCredentialsPluginWrapper* w = - static_cast(wrapper); - delete w; -} -} // namespace - char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) { GPR_ASSERT(wrapper); MetadataCredentialsPluginWrapper* w = @@ -429,10 +421,11 @@ char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) { void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) { if (wrapper == nullptr) return; - grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; - grpc_core::ExecCtx exec_ctx; - grpc_core::Executor::Run(GRPC_CLOSURE_CREATE(DeleteWrapper, wrapper, nullptr), - absl::OkStatus()); + grpc_event_engine::experimental::GetDefaultEventEngine()->Run([wrapper] { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; + grpc_core::ExecCtx exec_ctx; + delete static_cast(wrapper); + }); } int MetadataCredentialsPluginWrapper::GetMetadata(