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

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: review feedback 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void ServiceManager::ConnectToApplication(const GURL& url, 108 void ServiceManager::ConnectToApplication(const GURL& url,
109 const GURL& requestor_url, 109 const GURL& requestor_url,
110 ServiceProviderPtr service_provider) { 110 ServiceProviderPtr service_provider) {
111 URLToShellImplMap::const_iterator shell_it = url_to_shell_impl_.find(url); 111 URLToShellImplMap::const_iterator shell_it = url_to_shell_impl_.find(url);
112 ShellImpl* shell_impl; 112 ShellImpl* shell_impl;
113 if (shell_it != url_to_shell_impl_.end()) { 113 if (shell_it != url_to_shell_impl_.end()) {
114 shell_impl = shell_it->second; 114 shell_impl = shell_it->second;
115 } else { 115 } else {
116 MessagePipe pipe; 116 MessagePipe pipe;
117 GetLoaderForURL(url)->LoadService(this, url, pipe.handle0.Pass()); 117 GetLoaderForURL(url)->LoadService(this, url, pipe.handle0.Pass());
118 shell_impl = BindToPipe(new ShellImpl(this, url), pipe.handle1.Pass()); 118 shell_impl = WeakBindToPipe(new ShellImpl(this, url), pipe.handle1.Pass());
119 url_to_shell_impl_[url] = shell_impl; 119 url_to_shell_impl_[url] = shell_impl;
120 } 120 }
121 if (interceptor_) { 121 if (interceptor_) {
122 shell_impl->ConnectToClient( 122 shell_impl->ConnectToClient(
123 requestor_url, 123 requestor_url,
124 interceptor_->OnConnectToClient(url, service_provider.Pass())); 124 interceptor_->OnConnectToClient(url, service_provider.Pass()));
125 } else { 125 } else {
126 shell_impl->ConnectToClient(requestor_url, service_provider.Pass()); 126 shell_impl->ConnectToClient(requestor_url, service_provider.Pass());
127 } 127 }
128 } 128 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 StubServiceProvider* stub_sp = new StubServiceProvider; 177 StubServiceProvider* stub_sp = new StubServiceProvider;
178 ServiceProviderPtr spp; 178 ServiceProviderPtr spp;
179 BindToProxy(stub_sp, &spp); 179 BindToProxy(stub_sp, &spp);
180 ConnectToApplication(GURL(application_url), GURL(), spp.Pass()); 180 ConnectToApplication(GURL(application_url), GURL(), spp.Pass());
181 MessagePipe pipe; 181 MessagePipe pipe;
182 stub_sp->GetRemoteServiceProvider()->ConnectToService( 182 stub_sp->GetRemoteServiceProvider()->ConnectToService(
183 interface_name, pipe.handle1.Pass()); 183 interface_name, pipe.handle1.Pass());
184 return pipe.handle0.Pass(); 184 return pipe.handle0.Pass();
185 } 185 }
186 } // namespace mojo 186 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698