diff --git a/src/core/ext/xds/xds_certificate_provider.cc b/src/core/ext/xds/xds_certificate_provider.cc index 0ca497939ee..439921c648a 100644 --- a/src/core/ext/xds/xds_certificate_provider.cc +++ b/src/core/ext/xds/xds_certificate_provider.cc @@ -374,43 +374,4 @@ void XdsCertificateProvider::WatchStatusCallback(std::string cert_name, if (it->second->IsSafeToRemove()) certificate_state_map_.erase(it); } -namespace { - -void* XdsCertificateProviderArgCopy(void* p) { - XdsCertificateProvider* xds_certificate_provider = - static_cast(p); - return xds_certificate_provider->Ref().release(); -} - -void XdsCertificateProviderArgDestroy(void* p) { - XdsCertificateProvider* xds_certificate_provider = - static_cast(p); - xds_certificate_provider->Unref(); -} - -int XdsCertificateProviderArgCmp(void* p, void* q) { - return QsortCompare(p, q); -} - -const grpc_arg_pointer_vtable kChannelArgVtable = { - XdsCertificateProviderArgCopy, XdsCertificateProviderArgDestroy, - XdsCertificateProviderArgCmp}; - -} // namespace - -grpc_arg XdsCertificateProvider::MakeChannelArg() const { - return grpc_channel_arg_pointer_create( - const_cast(GRPC_ARG_XDS_CERTIFICATE_PROVIDER), - const_cast(this), &kChannelArgVtable); -} - -RefCountedPtr -XdsCertificateProvider::GetFromChannelArgs(const grpc_channel_args* args) { - XdsCertificateProvider* xds_certificate_provider = - grpc_channel_args_find_pointer( - args, GRPC_ARG_XDS_CERTIFICATE_PROVIDER); - return xds_certificate_provider != nullptr ? xds_certificate_provider->Ref() - : nullptr; -} - } // namespace grpc_core diff --git a/src/core/ext/xds/xds_certificate_provider.h b/src/core/ext/xds/xds_certificate_provider.h index c17a7fa5cb7..44eb2421d89 100644 --- a/src/core/ext/xds/xds_certificate_provider.h +++ b/src/core/ext/xds/xds_certificate_provider.h @@ -40,9 +40,6 @@ #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h" -#define GRPC_ARG_XDS_CERTIFICATE_PROVIDER \ - "grpc.internal.xds_certificate_provider" - namespace grpc_core { class XdsCertificateProvider : public grpc_tls_certificate_provider { @@ -50,15 +47,6 @@ class XdsCertificateProvider : public grpc_tls_certificate_provider { XdsCertificateProvider(); ~XdsCertificateProvider() override; - static absl::string_view ChannelArgName() { - return GRPC_ARG_XDS_CERTIFICATE_PROVIDER; - } - - static int ChannelArgsCompare(const XdsCertificateProvider* a, - const XdsCertificateProvider* b) { - return QsortCompare(a, b); - } - RefCountedPtr distributor() const override { return distributor_; } @@ -86,10 +74,13 @@ class XdsCertificateProvider : public grpc_tls_certificate_provider { void UpdateSubjectAlternativeNameMatchers( const std::string& cluster, std::vector matchers); - grpc_arg MakeChannelArg() const; - - static RefCountedPtr GetFromChannelArgs( - const grpc_channel_args* args); + static absl::string_view ChannelArgName() { + return "grpc.internal.xds_certificate_provider"; + } + static int ChannelArgsCompare(const XdsCertificateProvider* a, + const XdsCertificateProvider* b) { + return a->Compare(b); + } private: class ClusterCertificateState {