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

Side by Side Diff: mojo/service_manager/service_manager.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 6
7 #include "mojo/service_manager/service_manager.h" 7 #include "mojo/service_manager/service_manager.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void ServiceManager::ConnectToApplication(const GURL& url, 110 void ServiceManager::ConnectToApplication(const GURL& url,
111 const GURL& requestor_url, 111 const GURL& requestor_url,
112 ServiceProviderPtr service_provider) { 112 ServiceProviderPtr service_provider) {
113 URLToShellImplMap::const_iterator shell_it = url_to_shell_impl_.find(url); 113 URLToShellImplMap::const_iterator shell_it = url_to_shell_impl_.find(url);
114 ShellImpl* shell_impl; 114 ShellImpl* shell_impl;
115 if (shell_it != url_to_shell_impl_.end()) { 115 if (shell_it != url_to_shell_impl_.end()) {
116 shell_impl = shell_it->second; 116 shell_impl = shell_it->second;
117 } else { 117 } else {
118 MessagePipe pipe; 118 MessagePipe pipe;
119 GetLoaderForURL(url)->LoadService(this, url, pipe.handle0.Pass()); 119 GetLoaderForURL(url)->LoadService(this, url, pipe.handle0.Pass());
120 shell_impl = BindToPipe(new ShellImpl(this, url), pipe.handle1.Pass()); 120 shell_impl = WeakBindToPipe(new ShellImpl(this, url), pipe.handle1.Pass());
121 url_to_shell_impl_[url] = shell_impl; 121 url_to_shell_impl_[url] = shell_impl;
122 } 122 }
123 if (interceptor_) { 123 if (interceptor_) {
124 shell_impl->ConnectToClient( 124 shell_impl->ConnectToClient(
125 requestor_url, 125 requestor_url,
126 interceptor_->OnConnectToClient(url, service_provider.Pass())); 126 interceptor_->OnConnectToClient(url, service_provider.Pass()));
127 } else { 127 } else {
128 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); 128 shell_impl->ConnectToClient(requestor_url, service_provider.Pass());
129 } 129 }
130 } 130 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 StubServiceProvider* stub_sp = new StubServiceProvider; 179 StubServiceProvider* stub_sp = new StubServiceProvider;
180 ServiceProviderPtr spp; 180 ServiceProviderPtr spp;
181 BindToProxy(stub_sp, &spp); 181 BindToProxy(stub_sp, &spp);
182 ConnectToApplication(application_url, GURL(), spp.Pass()); 182 ConnectToApplication(application_url, GURL(), spp.Pass());
183 MessagePipe pipe; 183 MessagePipe pipe;
184 stub_sp->GetRemoteServiceProvider()->ConnectToService( 184 stub_sp->GetRemoteServiceProvider()->ConnectToService(
185 interface_name, pipe.handle1.Pass()); 185 interface_name, pipe.handle1.Pass());
186 return pipe.handle0.Pass(); 186 return pipe.handle0.Pass();
187 } 187 }
188 } // namespace mojo 188 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/validation_unittest.cc ('k') | mojo/service_manager/service_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698