[cleanups] Clean up `GrpcLibraryInitializer` (#31894)

* Clean up `GrpcLibraryInitializer`

* Update

* Automated change: Fix sanity tests
pull/31848/head
Cheng-Yu Chung 2 years ago committed by GitHub
parent f3419430df
commit 1b05576aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      BUILD
  2. 16
      CMakeLists.txt
  3. 16
      build_autogenerated.yaml
  4. 2
      gRPC-C++.podspec
  5. 4
      grpc.gyp
  6. 10
      include/grpcpp/impl/grpc_library.h
  7. 6
      include/grpcpp/security/credentials.h
  8. 3
      include/grpcpp/security/server_credentials.h
  9. 2
      include/grpcpp/security/tls_certificate_verifier.h
  10. 2
      src/cpp/client/channel_cc.cc
  11. 2
      src/cpp/client/client_context.cc
  12. 33
      src/cpp/client/credentials_cc.cc
  13. 9
      src/cpp/client/secure_credentials.cc
  14. 6
      src/cpp/common/alarm.cc
  15. 3
      src/cpp/common/completion_queue_cc.cc
  16. 6
      src/cpp/common/tls_certificate_verifier.cc
  17. 2
      src/cpp/server/server_cc.cc
  18. 6
      src/cpp/server/server_context.cc
  19. 29
      src/cpp/server/server_credentials.cc
  20. 2
      src/cpp/util/byte_buffer_cc.cc
  21. 2
      test/cpp/cocoapods/test/server_context_test_spouse_test.mm
  22. 4
      test/cpp/codegen/proto_utils_test.cc
  23. 3
      test/cpp/microbenchmarks/helpers.cc
  24. 2
      test/cpp/test/client_context_test_peer_test.cc
  25. 2
      test/cpp/test/server_context_test_spouse_test.cc
  26. 2
      test/cpp/util/byte_buffer_test.cc
  27. 2
      test/cpp/util/slice_test.cc
  28. 2
      tools/doxygen/Doxyfile.c++.internal

@ -239,7 +239,6 @@ GRPCXX_SRCS = [
"src/cpp/client/create_channel.cc",
"src/cpp/client/create_channel_internal.cc",
"src/cpp/client/create_channel_posix.cc",
"src/cpp/client/credentials_cc.cc",
"src/cpp/common/alarm.cc",
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/channel_filter.cc",
@ -259,7 +258,6 @@ GRPCXX_SRCS = [
"src/cpp/server/server_callback.cc",
"src/cpp/server/server_cc.cc",
"src/cpp/server/server_context.cc",
"src/cpp/server/server_credentials.cc",
"src/cpp/server/server_posix.cc",
"src/cpp/thread_manager/thread_manager.cc",
"src/cpp/util/byte_buffer_cc.cc",

16
CMakeLists.txt generated

@ -3259,7 +3259,6 @@ add_library(grpc++
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/client/xds_credentials.cc
@ -3292,7 +3291,6 @@ add_library(grpc++
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/server/xds_server_credentials.cc
src/cpp/thread_manager/thread_manager.cc
@ -3960,7 +3958,6 @@ add_library(grpc++_unsecure
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/common/alarm.cc
src/cpp/common/channel_arguments.cc
@ -3984,7 +3981,6 @@ add_library(grpc++_unsecure
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -7013,7 +7009,6 @@ add_executable(binder_transport_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -7045,7 +7040,6 @@ add_executable(binder_transport_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -9853,7 +9847,6 @@ add_executable(endpoint_binder_pool_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -9885,7 +9878,6 @@ add_executable(endpoint_binder_pool_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -10503,7 +10495,6 @@ add_executable(fake_binder_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -10535,7 +10526,6 @@ add_executable(fake_binder_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -21153,7 +21143,6 @@ add_executable(transport_stream_receiver_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -21185,7 +21174,6 @@ add_executable(transport_stream_receiver_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -21827,7 +21815,6 @@ add_executable(wire_reader_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -21859,7 +21846,6 @@ add_executable(wire_reader_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc
@ -21929,7 +21915,6 @@ add_executable(wire_writer_test
src/cpp/client/create_channel.cc
src/cpp/client/create_channel_internal.cc
src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc
src/cpp/client/insecure_credentials.cc
src/cpp/client/secure_credentials.cc
src/cpp/common/alarm.cc
@ -21961,7 +21946,6 @@ add_executable(wire_writer_test
src/cpp/server/server_callback.cc
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_credentials.cc
src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc

@ -2966,7 +2966,6 @@ libs:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/client/xds_credentials.cc
@ -2999,7 +2998,6 @@ libs:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/server/xds_server_credentials.cc
- src/cpp/thread_manager/thread_manager.cc
@ -3343,7 +3341,6 @@ libs:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/common/alarm.cc
- src/cpp/common/channel_arguments.cc
@ -3367,7 +3364,6 @@ libs:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -5017,7 +5013,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -5049,7 +5044,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -6332,7 +6326,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -6364,7 +6357,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -6725,7 +6717,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -6757,7 +6748,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -11881,7 +11871,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -11913,7 +11902,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -12256,7 +12244,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -12288,7 +12275,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc
@ -12362,7 +12348,6 @@ targets:
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/client/secure_credentials.cc
- src/cpp/common/alarm.cc
@ -12394,7 +12379,6 @@ targets:
- src/cpp/server/server_callback.cc
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc

2
gRPC-C++.podspec generated

@ -1041,7 +1041,6 @@ Pod::Spec.new do |s|
'src/cpp/client/create_channel_internal.cc',
'src/cpp/client/create_channel_internal.h',
'src/cpp/client/create_channel_posix.cc',
'src/cpp/client/credentials_cc.cc',
'src/cpp/client/insecure_credentials.cc',
'src/cpp/client/secure_credentials.cc',
'src/cpp/client/secure_credentials.h',
@ -1081,7 +1080,6 @@ Pod::Spec.new do |s|
'src/cpp/server/server_callback.cc',
'src/cpp/server/server_cc.cc',
'src/cpp/server/server_context.cc',
'src/cpp/server/server_credentials.cc',
'src/cpp/server/server_posix.cc',
'src/cpp/server/thread_pool_interface.h',
'src/cpp/server/xds_server_credentials.cc',

4
grpc.gyp generated

@ -1558,7 +1558,6 @@
'src/cpp/client/create_channel.cc',
'src/cpp/client/create_channel_internal.cc',
'src/cpp/client/create_channel_posix.cc',
'src/cpp/client/credentials_cc.cc',
'src/cpp/client/insecure_credentials.cc',
'src/cpp/client/secure_credentials.cc',
'src/cpp/client/xds_credentials.cc',
@ -1591,7 +1590,6 @@
'src/cpp/server/server_callback.cc',
'src/cpp/server/server_cc.cc',
'src/cpp/server/server_context.cc',
'src/cpp/server/server_credentials.cc',
'src/cpp/server/server_posix.cc',
'src/cpp/server/xds_server_credentials.cc',
'src/cpp/thread_manager/thread_manager.cc',
@ -1701,7 +1699,6 @@
'src/cpp/client/create_channel.cc',
'src/cpp/client/create_channel_internal.cc',
'src/cpp/client/create_channel_posix.cc',
'src/cpp/client/credentials_cc.cc',
'src/cpp/client/insecure_credentials.cc',
'src/cpp/common/alarm.cc',
'src/cpp/common/channel_arguments.cc',
@ -1725,7 +1722,6 @@
'src/cpp/server/server_callback.cc',
'src/cpp/server/server_cc.cc',
'src/cpp/server/server_context.cc',
'src/cpp/server/server_credentials.cc',
'src/cpp/server/server_posix.cc',
'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/util/byte_buffer_cc.cc',

@ -47,16 +47,6 @@ class GrpcLibrary {
bool grpc_init_called_;
};
/// Instantiating this class ensures the proper initialization of gRPC.
class GrpcLibraryInitializer final {
public:
GrpcLibraryInitializer() {}
/// A no-op method to force the linker to reference this class, which will
/// take care of initializing and shutting down the gRPC runtime.
int summon() { return 0; }
};
} // namespace internal
} // namespace grpc

@ -68,9 +68,6 @@ std::shared_ptr<ChannelCredentials> XdsCredentials(
/// \see https://grpc.io/docs/guides/auth.html
class ChannelCredentials : private grpc::internal::GrpcLibrary {
public:
ChannelCredentials();
~ChannelCredentials() override;
protected:
friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
@ -125,9 +122,6 @@ class ChannelCredentials : private grpc::internal::GrpcLibrary {
/// \see https://grpc.io/docs/guides/auth.html
class CallCredentials : private grpc::internal::GrpcLibrary {
public:
CallCredentials();
~CallCredentials() override;
/// Apply this instance's credentials to \a call.
virtual bool ApplyToCall(grpc_call* call) = 0;
virtual grpc::string DebugString() {

@ -68,9 +68,6 @@ std::shared_ptr<ServerCredentials> XdsServerCredentials(
/// Wrapper around \a grpc_server_credentials, a way to authenticate a server.
class ServerCredentials : private grpc::internal::GrpcLibrary {
public:
ServerCredentials();
~ServerCredentials() override;
/// This method is not thread-safe and has to be called before the server is
/// started. The last call to this function wins.
virtual void SetAuthMetadataProcessor(

@ -141,8 +141,6 @@ class ExternalCertificateVerifier {
// Subclass.
template <typename Subclass, typename... Args>
static std::shared_ptr<CertificateVerifier> Create(Args&&... args) {
grpc::internal::GrpcLibraryInitializer g_gli_initializer;
g_gli_initializer.summon();
auto* external_verifier = new Subclass(std::forward<Args>(args)...);
return std::make_shared<CertificateVerifier>(
grpc_tls_certificate_verifier_external_create(

@ -46,7 +46,6 @@
namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel(
const std::string& host, grpc_channel* channel,
std::vector<
@ -54,7 +53,6 @@ Channel::Channel(
interceptor_creators)
: host_(host), c_channel_(channel) {
interceptor_creators_ = std::move(interceptor_creators);
g_gli_initializer.summon();
}
Channel::~Channel() {

@ -53,7 +53,6 @@ class DefaultGlobalClientCallbacks final
void Destructor(ClientContext* /*context*/) override {}
};
static internal::GrpcLibraryInitializer g_gli_initializer;
static DefaultGlobalClientCallbacks* g_default_client_callbacks =
new DefaultGlobalClientCallbacks();
static ClientContext::GlobalCallbacks* g_client_callbacks =
@ -70,7 +69,6 @@ ClientContext::ClientContext()
propagate_from_call_(nullptr),
compression_algorithm_(GRPC_COMPRESS_NONE),
initial_metadata_corked_(false) {
g_gli_initializer.summon();
g_client_callbacks->DefaultConstructor(this);
}

@ -1,33 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
ChannelCredentials::~ChannelCredentials() {}
CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
CallCredentials::~CallCredentials() {}
} // namespace grpc

@ -55,12 +55,9 @@
namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
SecureChannelCredentials::SecureChannelCredentials(
grpc_channel_credentials* c_creds)
: c_creds_(c_creds) {
g_gli_initializer.summon();
}
: c_creds_(c_creds) {}
std::shared_ptr<Channel> SecureChannelCredentials::CreateChannelImpl(
const std::string& target, const ChannelArguments& args) {
@ -85,9 +82,7 @@ SecureChannelCredentials::CreateChannelWithInterceptors(
}
SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds)
: c_creds_(c_creds) {
g_gli_initializer.summon();
}
: c_creds_(c_creds) {}
bool SecureCallCredentials::ApplyToCall(grpc_call* call) {
return grpc_call_set_credentials(call, c_creds_) == GRPC_CALL_OK;

@ -133,11 +133,7 @@ class AlarmImpl : public grpc::internal::CompletionQueueTag {
};
} // namespace internal
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Alarm::Alarm() : alarm_(new internal::AlarmImpl()) {
g_gli_initializer.summon();
}
Alarm::Alarm() : alarm_(new internal::AlarmImpl()) {}
void Alarm::SetInternal(grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag) {

@ -36,8 +36,6 @@
namespace grpc {
namespace {
internal::GrpcLibraryInitializer g_gli_initializer;
gpr_once g_once_init_callback_alternative = GPR_ONCE_INIT;
grpc_core::Mutex* g_callback_alternative_mu;
@ -134,7 +132,6 @@ CompletionQueue::CompletionQueue(grpc_completion_queue* take)
}
void CompletionQueue::Shutdown() {
g_gli_initializer.summon();
#ifndef NDEBUG
if (!ServerListEmpty()) {
gpr_log(GPR_ERROR,

@ -37,8 +37,6 @@
namespace grpc {
namespace experimental {
static internal::GrpcLibraryInitializer g_gli_initializer;
TlsCustomVerificationCheckRequest::TlsCustomVerificationCheckRequest(
grpc_tls_custom_verification_check_request* request)
: c_request_(request) {
@ -106,9 +104,7 @@ std::vector<grpc::string_ref> TlsCustomVerificationCheckRequest::ip_names()
}
CertificateVerifier::CertificateVerifier(grpc_tls_certificate_verifier* v)
: verifier_(v) {
g_gli_initializer.summon();
}
: verifier_(v) {}
CertificateVerifier::~CertificateVerifier() {
grpc_tls_certificate_verifier_release(verifier_);

@ -868,7 +868,6 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
std::shared_ptr<Server::GlobalCallbacks> global_callbacks_;
};
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Server::Server(
grpc::ChannelArguments* args,
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
@ -891,7 +890,6 @@ Server::Server(
server_(nullptr),
server_initializer_(new ServerInitializer(this)),
health_check_service_disabled_(false) {
g_gli_initializer.summon();
gpr_once_init(&grpc::g_once_init_callbacks, grpc::InitGlobalCallbacks);
global_callbacks_ = grpc::g_callbacks;
global_callbacks_->UpdateArguments(args);

@ -61,8 +61,6 @@
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
// CompletionOp
class ServerContextBase::CompletionOp final
@ -259,9 +257,7 @@ bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
// ServerContextBase body
ServerContextBase::ServerContextBase()
: deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)) {
g_gli_initializer.summon();
}
: deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)) {}
ServerContextBase::ServerContextBase(gpr_timespec deadline,
grpc_metadata_array* arr)

@ -1,29 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/server_credentials.h>
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
ServerCredentials::ServerCredentials() { g_gli_initializer.summon(); }
ServerCredentials::~ServerCredentials() {}
} // namespace grpc

@ -30,8 +30,6 @@
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
Status ByteBuffer::TrySingleSlice(Slice* slice) const {
if (!buffer_) {
return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized");

@ -31,8 +31,6 @@
#include <grpcpp/impl/grpc_library.h>
static grpc::internal::GrpcLibraryInitializer g_initializer;
const char key1[] = "metadata-key1";
const char key2[] = "metadata-key2";
const char val1[] = "metadata-val1";

@ -55,8 +55,6 @@ class ProtoUtilsTest : public ::testing::Test {
protected:
static void SetUpTestSuite() {
// Ensure the ProtoBufferWriter internals are initialized.
grpc::internal::GrpcLibraryInitializer init;
init.summon();
grpc::internal::GrpcLibrary lib;
grpc_init();
}
@ -152,8 +150,6 @@ void BufferWriterTest(int block_size, int total_size, int backup_size) {
class WriterTest : public ::testing::Test {
protected:
static void SetUpTestSuite() {
grpc::internal::GrpcLibraryInitializer init;
init.summon();
grpc::internal::GrpcLibrary lib;
// Ensure the ProtoBufferWriter internals are initialized.
grpc_init();

@ -20,14 +20,11 @@
#include <string.h>
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
static LibraryInitializer* g_libraryInitializer;
LibraryInitializer::LibraryInitializer() {
GPR_ASSERT(g_libraryInitializer == nullptr);
g_libraryInitializer = this;
g_gli_initializer.summon();
}
LibraryInitializer::~LibraryInitializer() { g_libraryInitializer = nullptr; }

@ -27,8 +27,6 @@
namespace grpc {
namespace testing {
static internal::GrpcLibraryInitializer g_initializer;
const char key1[] = "metadata-key1";
const char key2[] = "metadata-key2";
const char val1[] = "metadata-val1";

@ -27,8 +27,6 @@
namespace grpc {
namespace testing {
static internal::GrpcLibraryInitializer g_initializer;
const char key1[] = "metadata-key1";
const char key2[] = "metadata-key2";
const char val1[] = "metadata-val1";

@ -31,8 +31,6 @@
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
namespace {
const char* kContent1 = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

@ -27,8 +27,6 @@
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
namespace {
const char* kContent = "hello xxxxxxxxxxxxxxxxxxxx world";

@ -2631,7 +2631,6 @@ src/cpp/client/create_channel.cc \
src/cpp/client/create_channel_internal.cc \
src/cpp/client/create_channel_internal.h \
src/cpp/client/create_channel_posix.cc \
src/cpp/client/credentials_cc.cc \
src/cpp/client/insecure_credentials.cc \
src/cpp/client/secure_credentials.cc \
src/cpp/client/secure_credentials.h \
@ -2671,7 +2670,6 @@ src/cpp/server/server_builder.cc \
src/cpp/server/server_callback.cc \
src/cpp/server/server_cc.cc \
src/cpp/server/server_context.cc \
src/cpp/server/server_credentials.cc \
src/cpp/server/server_posix.cc \
src/cpp/server/thread_pool_interface.h \
src/cpp/server/xds_server_credentials.cc \

Loading…
Cancel
Save