diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:26:37 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 03:26:37 +0000 |
commit | ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f (patch) | |
tree | eca69245cafdb225f7ee2cf62ce88c7308b1d022 /mojo/shell/view_manager_loader.cc | |
parent | 633c60c341bb4c430c60b54492b74d1bdcff22f4 (diff) | |
download | chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.zip chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.tar.gz chromium_src-ffdb373a3e3fd523e78890fa8ab4ac1e8b49090f.tar.bz2 |
Mojo: Use InterfaceFactory<Interface> for service registration
This adds an InterfaceFactory<Interface> type and allows registering a
service through its provider. Using an InterfaceFactory allows the app
to be in control of the lifetime of the implementation of the interface
and hides all of the implementation details of the interface from the
application library code (i.e. no subclassing impl classes or anything
like that). The default binding behavior is to bind the lifetime of
the impl to the lifetime of the pipe, but the application
can also weakly bind to a service in cases where it needs to manage
the lifetime explicitly.
Review URL: https://codereview.chromium.org/380413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell/view_manager_loader.cc')
-rw-r--r-- | mojo/shell/view_manager_loader.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mojo/shell/view_manager_loader.cc b/mojo/shell/view_manager_loader.cc index e41a874..6b93eac 100644 --- a/mojo/shell/view_manager_loader.cc +++ b/mojo/shell/view_manager_loader.cc @@ -9,6 +9,10 @@ #include "mojo/services/view_manager/view_manager_init_service_impl.h" namespace mojo { + +using view_manager::ViewManagerInitService; +using view_manager::service::ViewManagerInitServiceImpl; + namespace shell { ViewManagerLoader::ViewManagerLoader() { @@ -33,10 +37,16 @@ void ViewManagerLoader::OnServiceError(ServiceManager* manager, } bool ViewManagerLoader::ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) { - connection->AddService<view_manager::service::ViewManagerInitServiceImpl>(); + ApplicationConnection* connection) { + connection->AddService(this); return true; } +void ViewManagerLoader::Create( + ApplicationConnection* connection, + InterfaceRequest<ViewManagerInitService> request) { + BindToRequest(new ViewManagerInitServiceImpl(connection), &request); +} + } // namespace shell } // namespace mojo |