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

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

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/lib/callback_binder.h ('k') | services/shell/public/cpp/lib/connection_impl.h » ('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.cc
diff --git a/services/shell/public/cpp/lib/callback_binder.cc b/services/shell/public/cpp/lib/callback_binder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..19196ebd196bf03e8a5f34e044307c4f5057c283
--- /dev/null
+++ b/services/shell/public/cpp/lib/callback_binder.cc
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/shell/public/cpp/lib/callback_binder.h"
+
+namespace shell {
+namespace internal {
+
+GenericCallbackBinder::GenericCallbackBinder(
+ const BindCallback& callback,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
+ : callback_(callback), task_runner_(task_runner) {}
+
+GenericCallbackBinder::~GenericCallbackBinder() {}
+
+void GenericCallbackBinder::BindInterface(
+ Connection* connection,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle handle) {
+ if (task_runner_) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&GenericCallbackBinder::RunCallbackOnTaskRunner, callback_,
+ base::Passed(&handle)));
+ return;
+ }
+ callback_.Run(std::move(handle));
+}
+
+// static
+void GenericCallbackBinder::RunCallbackOnTaskRunner(
+ const BindCallback& callback,
+ mojo::ScopedMessagePipeHandle client_handle) {
+ callback.Run(std::move(client_handle));
+}
+
+} // namespace internal
+} // namespace shell
« no previous file with comments | « services/shell/public/cpp/lib/callback_binder.h ('k') | services/shell/public/cpp/lib/connection_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698