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

Unified Diff: services/shell/public/cpp/lib/callback_binder.h

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 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/interface_registry.h ('k') | services/shell/public/cpp/lib/callback_binder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/lib/callback_binder.h
diff --git a/services/shell/public/cpp/lib/callback_binder.h b/services/shell/public/cpp/lib/callback_binder.h
index 3d451d0b05be061a15a6baeb6b4beeb81cd99ba9..e410978aa4717ec6312fde9bdc40024a0210af3f 100644
--- a/services/shell/public/cpp/lib/callback_binder.h
+++ b/services/shell/public/cpp/lib/callback_binder.h
@@ -31,21 +31,23 @@ class CallbackBinder : public InterfaceBinder {
// InterfaceBinder:
void BindInterface(Connection* connection,
const std::string& interface_name,
- mojo::ScopedMessagePipeHandle client_handle) override {
+ mojo::ScopedMessagePipeHandle handle) override {
+ mojo::InterfaceRequest<Interface> request =
+ mojo::MakeRequest<Interface>(std::move(handle));
if (task_runner_) {
task_runner_->PostTask(
FROM_HERE,
base::Bind(&CallbackBinder::RunCallbackOnTaskRunner, callback_,
- base::Passed(&client_handle)));
+ base::Passed(&request)));
return;
}
- callback_.Run(std::move(client_handle));
+ callback_.Run(std::move(request));
}
static void RunCallbackOnTaskRunner(
const BindCallback& callback,
- mojo::ScopedMessagePipeHandle client_handle) {
- callback.Run(std::move(client_handle));
+ mojo::InterfaceRequest<Interface> client) {
+ callback.Run(std::move(client));
}
const BindCallback callback_;
@@ -53,6 +55,32 @@ class CallbackBinder : public InterfaceBinder {
DISALLOW_COPY_AND_ASSIGN(CallbackBinder);
};
+class GenericCallbackBinder : public InterfaceBinder {
+ public:
+ // Method that binds a request for Interface.
+ using BindCallback = base::Callback<void(mojo::ScopedMessagePipeHandle)>;
+
+ explicit GenericCallbackBinder(
+ const BindCallback& callback,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ ~GenericCallbackBinder() override;
+
+ private:
+ // InterfaceBinder:
+ void BindInterface(
+ Connection* connection,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle handle) override;
+
+ static void RunCallbackOnTaskRunner(
+ const BindCallback& callback,
+ mojo::ScopedMessagePipeHandle client_handle);
+
+ const BindCallback callback_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder);
+};
+
} // namespace internal
} // namespace shell
« no previous file with comments | « services/shell/public/cpp/interface_registry.h ('k') | services/shell/public/cpp/lib/callback_binder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698