aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD2
-rw-r--r--Makefile2
-rw-r--r--build.yaml1
-rw-r--r--include/grpc++/impl/grpc_library.h6
-rw-r--r--src/cpp/client/channel.cc3
-rw-r--r--src/cpp/client/credentials.cc7
-rw-r--r--src/cpp/client/secure_credentials.cc3
-rw-r--r--src/cpp/common/alarm.cc3
-rw-r--r--src/cpp/common/completion_queue.cc3
-rw-r--r--src/cpp/common/grpc_library_initializer.cc41
-rw-r--r--src/cpp/server/server.cc3
-rw-r--r--tools/doxygen/Doxyfile.c++.internal1
-rw-r--r--tools/run_tests/sources_and_headers.json2
-rw-r--r--vsprojects/vcxproj/grpc++/grpc++.vcxproj2
-rw-r--r--vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters3
-rw-r--r--vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj2
-rw-r--r--vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters3
17 files changed, 16 insertions, 71 deletions
diff --git a/BUILD b/BUILD
index 1ac645d8af..459aebd820 100644
--- a/BUILD
+++ b/BUILD
@@ -785,7 +785,6 @@ cc_library(
"src/cpp/common/call.cc",
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
- "src/cpp/common/grpc_library_initializer.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/async_generic_service.cc",
@@ -911,7 +910,6 @@ cc_library(
"src/cpp/common/call.cc",
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
- "src/cpp/common/grpc_library_initializer.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/async_generic_service.cc",
diff --git a/Makefile b/Makefile
index a0ae4051e7..7e9a4f2ed4 100644
--- a/Makefile
+++ b/Makefile
@@ -3015,7 +3015,6 @@ LIBGRPC++_SRC = \
src/cpp/common/call.cc \
src/cpp/common/channel_arguments.cc \
src/cpp/common/completion_queue.cc \
- src/cpp/common/grpc_library_initializer.cc \
src/cpp/common/rpc_method.cc \
src/cpp/proto/proto_utils.cc \
src/cpp/server/async_generic_service.cc \
@@ -3317,7 +3316,6 @@ LIBGRPC++_UNSECURE_SRC = \
src/cpp/common/call.cc \
src/cpp/common/channel_arguments.cc \
src/cpp/common/completion_queue.cc \
- src/cpp/common/grpc_library_initializer.cc \
src/cpp/common/rpc_method.cc \
src/cpp/proto/proto_utils.cc \
src/cpp/server/async_generic_service.cc \
diff --git a/build.yaml b/build.yaml
index 1524cc30b7..aeebb11935 100644
--- a/build.yaml
+++ b/build.yaml
@@ -84,7 +84,6 @@ filegroups:
- src/cpp/common/call.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue.cc
- - src/cpp/common/grpc_library_initializer.cc
- src/cpp/common/rpc_method.cc
- src/cpp/proto/proto_utils.cc
- src/cpp/server/async_generic_service.cc
diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h
index f7ff28ec15..e8a075f5eb 100644
--- a/include/grpc++/impl/grpc_library.h
+++ b/include/grpc++/impl/grpc_library.h
@@ -34,6 +34,8 @@
#ifndef GRPCXX_IMPL_GRPC_LIBRARY_H
#define GRPCXX_IMPL_GRPC_LIBRARY_H
+#include <iostream>
+
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc/grpc.h>
@@ -56,11 +58,9 @@ class GrpcLibraryInitializer GRPC_FINAL {
/// A no-op method to force the linker to reference this class, which will
/// take care of initializing and shutting down the gRPC runtime.
- inline void summon() {}
+ int summon() { return 0; }
};
-extern GrpcLibraryInitializer g_gli_initializer;
-
} // namespace internal
} // namespace grpc
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index 9b87102f17..ae20392d11 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -53,9 +53,10 @@
namespace grpc {
+static internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel(const grpc::string& host, grpc_channel* channel)
: host_(host), c_channel_(channel) {
- internal::g_gli_initializer.summon();
+ g_gli_initializer.summon();
}
Channel::~Channel() { grpc_channel_destroy(c_channel_); }
diff --git a/src/cpp/client/credentials.cc b/src/cpp/client/credentials.cc
index 51b520bf83..6fb620b0ea 100644
--- a/src/cpp/client/credentials.cc
+++ b/src/cpp/client/credentials.cc
@@ -36,13 +36,12 @@
namespace grpc {
-ChannelCredentials::ChannelCredentials() {
- internal::g_gli_initializer.summon();
-}
+static internal::GrpcLibraryInitializer g_gli_initializer;
+ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
ChannelCredentials::~ChannelCredentials() {}
-CallCredentials::CallCredentials() { internal::g_gli_initializer.summon(); }
+CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
CallCredentials::~CallCredentials() {}
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index bfbcc5f915..074dae7ca7 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -41,10 +41,11 @@
namespace grpc {
+static internal::GrpcLibraryInitializer g_gli_initializer;
SecureChannelCredentials::SecureChannelCredentials(
grpc_channel_credentials* c_creds)
: c_creds_(c_creds) {
- internal::g_gli_initializer.summon();
+ g_gli_initializer.summon();
}
std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannel(
diff --git a/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc
index 604e2c2967..807a67df24 100644
--- a/src/cpp/common/alarm.cc
+++ b/src/cpp/common/alarm.cc
@@ -37,9 +37,10 @@
namespace grpc {
+static internal::GrpcLibraryInitializer g_gli_initializer;
Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag)
: alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) {
- internal::g_gli_initializer.summon();
+ g_gli_initializer.summon();
}
Alarm::~Alarm() { grpc_alarm_destroy(alarm_); }
diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc
index 0f7b6f63a3..4f76dfff1d 100644
--- a/src/cpp/common/completion_queue.cc
+++ b/src/cpp/common/completion_queue.cc
@@ -42,8 +42,9 @@
namespace grpc {
+static internal::GrpcLibraryInitializer g_gli_initializer;
CompletionQueue::CompletionQueue() {
- internal::g_gli_initializer.summon();
+ g_gli_initializer.summon();
cq_ = grpc_completion_queue_create(nullptr);
}
diff --git a/src/cpp/common/grpc_library_initializer.cc b/src/cpp/common/grpc_library_initializer.cc
deleted file mode 100644
index 171efc9238..0000000000
--- a/src/cpp/common/grpc_library_initializer.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <grpc++/impl/grpc_library.h>
-
-namespace grpc {
-namespace internal {
-
-GrpcLibraryInitializer g_gli_initializer;
-
-} // namespace internal
-} // namespace grpc
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 1fe0a1eefd..0d31140924 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -278,6 +278,7 @@ static grpc_server* CreateServer(const ChannelArguments& args) {
return grpc_server_create(&channel_args, nullptr);
}
+static internal::GrpcLibraryInitializer g_gli_initializer;
Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
int max_message_size, const ChannelArguments& args)
: max_message_size_(max_message_size),
@@ -289,7 +290,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
server_(CreateServer(args)),
thread_pool_(thread_pool),
thread_pool_owned_(thread_pool_owned) {
- internal::g_gli_initializer.summon();
+ g_gli_initializer.summon();
gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks);
global_callbacks_ = g_callbacks;
grpc_server_register_completion_queue(server_, cq_.cq(), nullptr);
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index 5b18209420..558ec9d394 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -857,7 +857,6 @@ src/cpp/client/insecure_credentials.cc \
src/cpp/common/call.cc \
src/cpp/common/channel_arguments.cc \
src/cpp/common/completion_queue.cc \
-src/cpp/common/grpc_library_initializer.cc \
src/cpp/common/rpc_method.cc \
src/cpp/proto/proto_utils.cc \
src/cpp/server/async_generic_service.cc \
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 3405b73ed2..9113f1ca05 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -4065,7 +4065,6 @@
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/create_auth_context.h",
- "src/cpp/common/grpc_library_initializer.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/common/secure_auth_context.cc",
"src/cpp/common/secure_auth_context.h",
@@ -4315,7 +4314,6 @@
"src/cpp/common/channel_arguments.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/create_auth_context.h",
- "src/cpp/common/grpc_library_initializer.cc",
"src/cpp/common/insecure_create_auth_context.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj
index a146515b75..2eea726447 100644
--- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj
+++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj
@@ -375,8 +375,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\completion_queue.cc">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\cpp\common\grpc_library_initializer.cc">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\proto\proto_utils.cc">
diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters
index 3d13dec57f..d5654d0a52 100644
--- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters
@@ -49,9 +49,6 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\completion_queue.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\cpp\common\grpc_library_initializer.cc">
- <Filter>src\cpp\common</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj
index b4a099395a..013d197dc0 100644
--- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj
@@ -362,8 +362,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\completion_queue.cc">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\cpp\common\grpc_library_initializer.cc">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\proto\proto_utils.cc">
diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters
index 6c54bdc831..039348c7c2 100644
--- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters
@@ -34,9 +34,6 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\completion_queue.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\cpp\common\grpc_library_initializer.cc">
- <Filter>src\cpp\common</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>