diff options
author | Yuchen Zeng <zyc@google.com> | 2016-05-03 12:18:13 -0700 |
---|---|---|
committer | Yuchen Zeng <zyc@google.com> | 2016-05-03 12:18:13 -0700 |
commit | 3b8f3354de5af07ea595713623bcc19cd19d6dfe (patch) | |
tree | 8cda8524a4dae95846d1a6cf08689a216470b7e2 /include | |
parent | c049035bedad8e013a439bf2934d01e616da4227 (diff) |
Add plugins at the time of static initialization
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/impl/server_builder_plugin.h | 10 | ||||
-rw-r--r-- | include/grpc++/server_builder.h | 3 |
2 files changed, 3 insertions, 10 deletions
diff --git a/include/grpc++/impl/server_builder_plugin.h b/include/grpc++/impl/server_builder_plugin.h index 7cf369e346..f792c4b321 100644 --- a/include/grpc++/impl/server_builder_plugin.h +++ b/include/grpc++/impl/server_builder_plugin.h @@ -64,16 +64,6 @@ class ServerBuilderPlugin { } // namespace grpc -#define GRPC_DECLARE_PLUGIN(plugin_name) \ - namespace sBP##plugin_name { \ - extern std::unique_ptr<ServerBuilderPlugin> Create##plugin_name(); \ - } -#define GRPC_INIT_PLUGIN(map, plugin_name) \ - { \ - std::unique_ptr<ServerBuilderPlugin> plugin = \ - sBP##plugin_name::Create##plugin_name(); \ - map[plugin->name()] = std::move(plugin); \ - } #endif // GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index a47b5c71cf..52064b1434 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -113,6 +113,9 @@ class ServerBuilder { /// Return a running server which is ready for processing calls. std::unique_ptr<Server> BuildAndStart(); + static void InternalAddPluginFactory( + std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)()); + private: friend class ::grpc::testing::ServerBuilderPluginTest; |