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

Side by Side Diff: services/shell/public/cpp/lib/callback_binder.h

Issue 2182643003: Remove shell::Connection* parameter to InterfaceFactory<T>::Create() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 23
24 explicit CallbackBinder( 24 explicit CallbackBinder(
25 const BindCallback& callback, 25 const BindCallback& callback,
26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
27 : callback_(callback), task_runner_(task_runner) {} 27 : callback_(callback), task_runner_(task_runner) {}
28 ~CallbackBinder() override {} 28 ~CallbackBinder() override {}
29 29
30 private: 30 private:
31 // InterfaceBinder: 31 // InterfaceBinder:
32 void BindInterface( 32 void BindInterface(
33 Connection* connection, 33 const Identity& remote_identity,
34 const std::string& interface_name, 34 const std::string& interface_name,
35 mojo::ScopedMessagePipeHandle handle) override { 35 mojo::ScopedMessagePipeHandle handle) override {
36 mojo::InterfaceRequest<Interface> request = 36 mojo::InterfaceRequest<Interface> request =
37 mojo::MakeRequest<Interface>(std::move(handle)); 37 mojo::MakeRequest<Interface>(std::move(handle));
38 if (task_runner_) { 38 if (task_runner_) {
39 task_runner_->PostTask( 39 task_runner_->PostTask(
40 FROM_HERE, 40 FROM_HERE,
41 base::Bind(&CallbackBinder::RunCallbackOnTaskRunner, callback_, 41 base::Bind(&CallbackBinder::RunCallbackOnTaskRunner, callback_,
42 base::Passed(&request))); 42 base::Passed(&request)));
43 return; 43 return;
(...skipping 16 matching lines...) Expand all
60 public: 60 public:
61 using BindCallback = base::Callback<void(mojo::ScopedMessagePipeHandle)>; 61 using BindCallback = base::Callback<void(mojo::ScopedMessagePipeHandle)>;
62 62
63 explicit GenericCallbackBinder( 63 explicit GenericCallbackBinder(
64 const BindCallback& callback, 64 const BindCallback& callback,
65 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 65 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
66 ~GenericCallbackBinder() override; 66 ~GenericCallbackBinder() override;
67 67
68 private: 68 private:
69 // InterfaceBinder: 69 // InterfaceBinder:
70 void BindInterface(Connection* connection, 70 void BindInterface(const shell::Identity& remote_identity,
71 const std::string& interface_name, 71 const std::string& interface_name,
72 mojo::ScopedMessagePipeHandle handle) override; 72 mojo::ScopedMessagePipeHandle handle) override;
73 73
74 static void RunCallbackOnTaskRunner( 74 static void RunCallbackOnTaskRunner(
75 const BindCallback& callback, 75 const BindCallback& callback,
76 mojo::ScopedMessagePipeHandle client_handle); 76 mojo::ScopedMessagePipeHandle client_handle);
77 77
78 const BindCallback callback_; 78 const BindCallback callback_;
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
80 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder); 80 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder);
81 }; 81 };
82 82
83 } // namespace internal 83 } // namespace internal
84 } // namespace shell 84 } // namespace shell
85 85
86 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_ 86 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
OLDNEW
« 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