| 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_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ | 5 #ifndef CONTENT_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ |
| 6 #define CONTENT_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ | 6 #define CONTENT_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Binds to a remote ServiceProvider. This will expose added services to the | 29 // Binds to a remote ServiceProvider. This will expose added services to the |
| 30 // remote ServiceProvider with the corresponding handle and enable | 30 // remote ServiceProvider with the corresponding handle and enable |
| 31 // ConnectToRemoteService to provide access to services exposed by the remote | 31 // ConnectToRemoteService to provide access to services exposed by the remote |
| 32 // ServiceProvider. | 32 // ServiceProvider. |
| 33 void BindRemoteServiceProvider(mojo::ScopedMessagePipeHandle handle); | 33 void BindRemoteServiceProvider(mojo::ScopedMessagePipeHandle handle); |
| 34 | 34 |
| 35 // ServiceRegistry overrides. | 35 // ServiceRegistry overrides. |
| 36 virtual void AddService( | 36 virtual void AddService( |
| 37 const std::string& service_name, | 37 const std::string& service_name, |
| 38 const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory) | 38 const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory) |
| 39 OVERRIDE; | 39 override; |
| 40 virtual void RemoveService(const std::string& service_name) OVERRIDE; | 40 virtual void RemoveService(const std::string& service_name) override; |
| 41 virtual void ConnectToRemoteService( | 41 virtual void ConnectToRemoteService( |
| 42 const base::StringPiece& service_name, | 42 const base::StringPiece& service_name, |
| 43 mojo::ScopedMessagePipeHandle handle) OVERRIDE; | 43 mojo::ScopedMessagePipeHandle handle) override; |
| 44 | 44 |
| 45 base::WeakPtr<ServiceRegistry> GetWeakPtr(); | 45 base::WeakPtr<ServiceRegistry> GetWeakPtr(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // mojo::InterfaceImpl<mojo::ServiceProvider> overrides. | 48 // mojo::InterfaceImpl<mojo::ServiceProvider> overrides. |
| 49 virtual void ConnectToService( | 49 virtual void ConnectToService( |
| 50 const mojo::String& name, | 50 const mojo::String& name, |
| 51 mojo::ScopedMessagePipeHandle client_handle) OVERRIDE; | 51 mojo::ScopedMessagePipeHandle client_handle) override; |
| 52 virtual void OnConnectionError() OVERRIDE; | 52 virtual void OnConnectionError() override; |
| 53 | 53 |
| 54 std::map<std::string, base::Callback<void(mojo::ScopedMessagePipeHandle)> > | 54 std::map<std::string, base::Callback<void(mojo::ScopedMessagePipeHandle)> > |
| 55 service_factories_; | 55 service_factories_; |
| 56 std::queue<std::pair<std::string, mojo::MessagePipeHandle> > | 56 std::queue<std::pair<std::string, mojo::MessagePipeHandle> > |
| 57 pending_connects_; | 57 pending_connects_; |
| 58 bool bound_; | 58 bool bound_; |
| 59 | 59 |
| 60 base::WeakPtrFactory<ServiceRegistry> weak_factory_; | 60 base::WeakPtrFactory<ServiceRegistry> weak_factory_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace content | 63 } // namespace content |
| 64 | 64 |
| 65 #endif // CONTENT_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ | 65 #endif // CONTENT_COMMON_MOJO_SERVICE_REGISTRY_IMPL_H_ |
| OLD | NEW |