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

Unified Diff: services/shell/public/cpp/interface_provider.h

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/shell/public/cpp/connector.h ('k') | services/shell/public/cpp/interface_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/interface_provider.h
diff --git a/services/shell/public/cpp/interface_provider.h b/services/shell/public/cpp/interface_provider.h
index fe6930e3f825d8a262ca4b4ed20cb13795958c95..865ab8bd5cdcdbcf3e4b3a85def271adc1d96ae6 100644
--- a/services/shell/public/cpp/interface_provider.h
+++ b/services/shell/public/cpp/interface_provider.h
@@ -18,6 +18,8 @@ namespace shell {
// Connection.
class InterfaceProvider {
public:
+ using ForwardCallback = base::Callback<void(const mojo::String&,
+ mojo::ScopedMessagePipeHandle)>;
class TestApi {
public:
explicit TestApi(InterfaceProvider* provider) : provider_(provider) {}
@@ -41,8 +43,17 @@ class InterfaceProvider {
InterfaceProvider();
~InterfaceProvider();
+ // Binds this InterfaceProvider to an actual mojom::InterfaceProvider pipe.
+ // It is an error to call this on a forwarding InterfaceProvider, i.e. this
+ // call is exclusive to Forward().
void Bind(mojom::InterfaceProviderPtr interface_provider);
+ // Sets this InterfaceProvider to forward all GetInterface() requests to
+ // |callback|. It is an error to call this on a bound InterfaceProvider, i.e.
+ // this call is exclusive to Bind(). In addition, and unlike Bind(), this MUST
+ // be called before any calls to GetInterface() are made.
+ void Forward(const ForwardCallback& callback);
+
// Returns a raw pointer to the remote InterfaceProvider.
mojom::InterfaceProvider* get() { return interface_provider_.get(); }
@@ -83,6 +94,10 @@ class InterfaceProvider {
mojom::InterfaceProviderPtr interface_provider_;
mojom::InterfaceProviderRequest pending_request_;
+ // A callback to receive all GetInterface() requests in lieu of the
+ // InterfaceProvider pipe.
+ ForwardCallback forward_callback_;
+
base::WeakPtrFactory<InterfaceProvider> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(InterfaceProvider);
« no previous file with comments | « services/shell/public/cpp/connector.h ('k') | services/shell/public/cpp/interface_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698