Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: mojo/services/network/main.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: specify ownership in the Bind call Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/network/main.cc
diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc
index a3f397d8a5b2cf226e3676de854a74347f54fc1a..4249f78975df22972ae90249c3fea23889c074c6 100644
--- a/mojo/services/network/main.cc
+++ b/mojo/services/network/main.cc
@@ -10,6 +10,7 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/context_interface_provider.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
#include "mojo/services/network/network_context.h"
@@ -32,6 +33,9 @@ void OnPathReceived(base::FilePath* path, const mojo::String& path_as_string) {
} // namespace
class Delegate : public mojo::ApplicationDelegate {
+ typedef mojo::ContextInterfaceProvider<mojo::NetworkServiceImpl,
+ mojo::NetworkContext> NetworkProvider;
+
public:
Delegate() {}
@@ -46,17 +50,20 @@ class Delegate : public mojo::ApplicationDelegate {
DCHECK(!base_path.value().empty());
base_path = base_path.Append(FILE_PATH_LITERAL("network_service"));
context_.reset(new mojo::NetworkContext(base_path));
+ network_service_provider_.reset(new NetworkProvider(context_.get()));
}
+ // mojo::ApplicationDelegate implementation.
virtual bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) MOJO_OVERRIDE {
DCHECK(context_);
- connection->AddService<mojo::NetworkServiceImpl>(context_.get());
+ connection->AddServiceProvider(network_service_provider_.get());
return true;
}
private:
scoped_ptr<mojo::NetworkContext> context_;
+ scoped_ptr<NetworkProvider> network_service_provider_;
};
extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain(

Powered by Google App Engine
This is Rietveld 408576698