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

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: some InterfaceProvider impls for common cases 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 3cfc74f43f06c5008da70af9870b89ebd2c8ee9d..216fc8cdb73f326ceafea42be4f2c9977a303a78 100644
--- a/mojo/services/network/main.cc
+++ b/mojo/services/network/main.cc
@@ -32,6 +32,10 @@ void OnPathReceived(base::FilePath* path, const mojo::String& path_as_string) {
} // namespace
class Delegate : public mojo::ApplicationDelegate {
+ typedef mojo::ContextInterfaceProvider<mojo::NetworkServiceImpl,
+ mojo::NetworkContext,
+ mojo::NetworkService> 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());
jamesr 2014/07/11 20:07:10 here, instead of implementing InterfaceProvider<>:
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