diff options
author | Vijay Pai <vpai@google.com> | 2016-06-10 12:25:32 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-06-10 12:25:32 -0700 |
commit | 15855f3e7fbf8407393e70dd3c92ee2b0a871430 (patch) | |
tree | 92ddc4ce919858b492a6b0bce6758e27e4b03ab5 /src/cpp/server | |
parent | eac07c3cc8bad2c704931186aa4e23851d30df56 (diff) |
Switch server builder plugin API to something that will work with gcc4.4
Diffstat (limited to 'src/cpp/server')
-rw-r--r-- | src/cpp/server/server_builder.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index ea5dfbfe8e..ff57c26497 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -57,12 +57,7 @@ ServerBuilder::ServerBuilder() for (auto it = g_plugin_factory_list->begin(); it != g_plugin_factory_list->end(); it++) { auto& factory = *it; - std::unique_ptr<ServerBuilderPlugin> plugin = factory(); - auto name = plugin->name(); - ServerBuilderPlugin* plugin_ptr = plugin.release(); - plugins_[name] = nullptr; - auto pl = plugins_.find(name); - pl->second.reset(plugin_ptr); + plugins_.emplace_back(factory()); } } @@ -123,7 +118,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { } if (!thread_pool) { for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - if ((*plugin).second->has_sync_methods()) { + if ((*plugin)->has_sync_methods()) { thread_pool.reset(CreateDefaultThreadPool()); has_sync_methods = true; break; @@ -172,7 +167,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { } } for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - (*plugin).second->InitServer(initializer); + (*plugin)->InitServer(initializer); } if (generic_service_) { server->RegisterAsyncGenericService(generic_service_); @@ -198,7 +193,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { return nullptr; } for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - (*plugin).second->Finish(initializer); + (*plugin)->Finish(initializer); } return server; } |