Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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_ |
| OLD | NEW |