| Index: services/shell/public/cpp/interface_registry.h
|
| diff --git a/services/shell/public/cpp/interface_registry.h b/services/shell/public/cpp/interface_registry.h
|
| index 98f85550fab9959bc538ecc86782f0fe86b82ceb..0c6624e0121fd0b246d450fa166e31c0d5336d33 100644
|
| --- a/services/shell/public/cpp/interface_registry.h
|
| +++ b/services/shell/public/cpp/interface_registry.h
|
| @@ -6,7 +6,10 @@
|
| #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
|
|
|
| #include <memory>
|
| +#include <queue>
|
| +#include <utility>
|
|
|
| +#include "base/callback.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
| #include "services/shell/public/cpp/lib/callback_binder.h"
|
| @@ -40,6 +43,9 @@ class InterfaceBinder;
|
| //
|
| class InterfaceRegistry : public mojom::InterfaceProvider {
|
| public:
|
| + using Binder = base::Callback<void(const mojo::String&,
|
| + mojo::ScopedMessagePipeHandle)>;
|
| +
|
| class TestApi {
|
| public:
|
| explicit TestApi(InterfaceRegistry* registry) : registry_(registry) {}
|
| @@ -64,6 +70,10 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
|
| explicit InterfaceRegistry(Connection* connection);
|
| ~InterfaceRegistry() override;
|
|
|
| + // Sets a default handler for incoming interface requests which are allowed by
|
| + // capability filters but have no registered handler in this registry.
|
| + void set_default_binder(const Binder& binder) { default_binder_ = binder; }
|
| +
|
| void Bind(mojom::InterfaceProviderRequest local_interfaces_request);
|
|
|
| base::WeakPtr<InterfaceRegistry> GetWeakPtr();
|
| @@ -132,6 +142,15 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
|
|
|
| NameToInterfaceBinderMap name_to_binder_;
|
|
|
| + Binder default_binder_;
|
| +
|
| + bool is_paused_ = false;
|
| +
|
| + // Pending interface requests which can accumulate if GetInterface() is called
|
| + // while binding is paused.
|
| + std::queue<std::pair<mojo::String, mojo::ScopedMessagePipeHandle>>
|
| + pending_interface_requests_;
|
| +
|
| base::WeakPtrFactory<InterfaceRegistry> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry);
|
|
|