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

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

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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
deleted file mode 100644
index 87cb043922d151b65719acae22b743e9c90c380f..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/lib/callback_binder.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-#ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
-
-#include <utility>
-
-#include "base/bind.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_binder.h"
-
-namespace shell {
-namespace internal {
-
-template <typename Interface>
-class CallbackBinder : public InterfaceBinder {
- public:
- // Method that binds a request for Interface.
- using BindCallback =
- base::Callback<void(mojo::InterfaceRequest<Interface>)>;
-
- explicit CallbackBinder(
- const BindCallback& callback,
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
- : callback_(callback), task_runner_(task_runner) {}
- ~CallbackBinder() override {}
-
- private:
- // InterfaceBinder:
- void BindInterface(
- const Identity& remote_identity,
- const std::string& interface_name,
- 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(&request)));
- return;
- }
- callback_.Run(std::move(request));
- }
-
- static void RunCallbackOnTaskRunner(
- const BindCallback& callback,
- mojo::InterfaceRequest<Interface> client) {
- callback.Run(std::move(client));
- }
-
- const BindCallback callback_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- DISALLOW_COPY_AND_ASSIGN(CallbackBinder);
-};
-
-class GenericCallbackBinder : public InterfaceBinder {
- public:
- 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(const shell::Identity& remote_identity,
- 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
-
-#endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
« 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