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

Side by Side Diff: content/public/common/service_registry.h

Issue 1137803005: Add a ServiceRegistry::ConnectToRemoteService that takes an InterfaceRequest<>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@utility-process-report-js-memory
Patch Set: Rebase Created 5 years, 7 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
« no previous file with comments | « chrome/browser/task_manager/child_process_resource_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
6 #define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 6 #define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // connections to the service are unaffected. 47 // connections to the service are unaffected.
48 template <typename Interface> 48 template <typename Interface>
49 void RemoveService() { 49 void RemoveService() {
50 RemoveService(Interface::Name_); 50 RemoveService(Interface::Name_);
51 } 51 }
52 virtual void RemoveService(const std::string& service_name) = 0; 52 virtual void RemoveService(const std::string& service_name) = 0;
53 53
54 // Connect to an interface provided by the remote service provider. 54 // Connect to an interface provided by the remote service provider.
55 template <typename Interface> 55 template <typename Interface>
56 void ConnectToRemoteService(mojo::InterfacePtr<Interface>* ptr) { 56 void ConnectToRemoteService(mojo::InterfacePtr<Interface>* ptr) {
57 ConnectToRemoteService(Interface::Name_, 57 ConnectToRemoteService(mojo::GetProxy(ptr).Pass());
Sam McNally 2015/05/21 00:00:05 Remove the .Pass(). mojo::GetProxy() already retur
Anand Mistry (off Chromium) 2015/05/21 00:12:08 Done.
58 mojo::GetProxy(ptr).PassMessagePipe()); 58 }
59 template <typename Interface>
60 void ConnectToRemoteService(mojo::InterfaceRequest<Interface> ptr) {
61 ConnectToRemoteService(Interface::Name_, ptr.PassMessagePipe());
59 } 62 }
60 virtual void ConnectToRemoteService(const base::StringPiece& name, 63 virtual void ConnectToRemoteService(const base::StringPiece& name,
61 mojo::ScopedMessagePipeHandle handle) = 0; 64 mojo::ScopedMessagePipeHandle handle) = 0;
62 65
63 private: 66 private:
64 template <typename Interface> 67 template <typename Interface>
65 static void ForwardToServiceFactory( 68 static void ForwardToServiceFactory(
66 const base::Callback<void(mojo::InterfaceRequest<Interface>)> 69 const base::Callback<void(mojo::InterfaceRequest<Interface>)>
67 service_factory, 70 service_factory,
68 mojo::ScopedMessagePipeHandle handle) { 71 mojo::ScopedMessagePipeHandle handle) {
69 service_factory.Run(mojo::MakeRequest<Interface>(handle.Pass())); 72 service_factory.Run(mojo::MakeRequest<Interface>(handle.Pass()));
70 } 73 }
71 }; 74 };
72 75
73 } // namespace content 76 } // namespace content
74 77
75 #endif // CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 78 #endif // CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/child_process_resource_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698