| Index: content/common/mojo/service_registry_impl.h
|
| diff --git a/content/common/mojo/service_registry_impl.h b/content/common/mojo/service_registry_impl.h
|
| index 5e4fd73fd917b8c4874f5965df9ca52bb5f1e4a4..a51c67cfeed072ded9f685a3a1cca461666ecd67 100644
|
| --- a/content/common/mojo/service_registry_impl.h
|
| +++ b/content/common/mojo/service_registry_impl.h
|
| @@ -24,6 +24,8 @@ class CONTENT_EXPORT ServiceRegistryImpl
|
| : public ServiceRegistry,
|
| public NON_EXPORTED_BASE(mojo::ServiceProvider) {
|
| public:
|
| + using ServiceFactory = base::Callback<void(mojo::ScopedMessagePipeHandle)>;
|
| +
|
| ServiceRegistryImpl();
|
| ~ServiceRegistryImpl() override;
|
|
|
| @@ -36,10 +38,15 @@ class CONTENT_EXPORT ServiceRegistryImpl
|
| // ServiceProvider.
|
| void BindRemoteServiceProvider(mojo::ServiceProviderPtr service_provider);
|
|
|
| + // Registers a local service factory to intercept ConnectToRemoteService
|
| + // requests instead of actually connecting to the remote registry. Used only
|
| + // for testing.
|
| + void AddServiceOverrideForTesting(const std::string& service_name,
|
| + const ServiceFactory& service_factory);
|
| +
|
| // ServiceRegistry overrides.
|
| void AddService(const std::string& service_name,
|
| - const base::Callback<void(mojo::ScopedMessagePipeHandle)>
|
| - service_factory) override;
|
| + const ServiceFactory service_factory) override;
|
| void RemoveService(const std::string& service_name) override;
|
| void ConnectToRemoteService(const base::StringPiece& service_name,
|
| mojo::ScopedMessagePipeHandle handle) override;
|
| @@ -58,11 +65,12 @@ class CONTENT_EXPORT ServiceRegistryImpl
|
| mojo::Binding<mojo::ServiceProvider> binding_;
|
| mojo::ServiceProviderPtr remote_provider_;
|
|
|
| - std::map<std::string, base::Callback<void(mojo::ScopedMessagePipeHandle)> >
|
| - service_factories_;
|
| + std::map<std::string, ServiceFactory> service_factories_;
|
| std::queue<std::pair<std::string, mojo::MessagePipeHandle> >
|
| pending_connects_;
|
|
|
| + std::map<std::string, ServiceFactory> service_overrides_;
|
| +
|
| base::WeakPtrFactory<ServiceRegistry> weak_factory_;
|
| };
|
|
|
|
|