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

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

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 #include "services/shell/public/cpp/lib/callback_binder.h" 5 #include "services/shell/public/cpp/lib/callback_binder.h"
6 6
7 namespace shell { 7 namespace shell {
8 namespace internal { 8 namespace internal {
9 9
10 GenericCallbackBinder::GenericCallbackBinder( 10 GenericCallbackBinder::GenericCallbackBinder(
11 const BindCallback& callback, 11 const BindCallback& callback,
12 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 12 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
13 : callback_(callback), task_runner_(task_runner) {} 13 : callback_(callback), task_runner_(task_runner) {}
14 14
15 GenericCallbackBinder::~GenericCallbackBinder() {} 15 GenericCallbackBinder::~GenericCallbackBinder() {}
16 16
17 void GenericCallbackBinder::BindInterface( 17 void GenericCallbackBinder::BindInterface(
18 Connection* connection, 18 const Identity& remote_identity,
19 const std::string& interface_name, 19 const std::string& interface_name,
20 mojo::ScopedMessagePipeHandle handle) { 20 mojo::ScopedMessagePipeHandle handle) {
21 if (task_runner_) { 21 if (task_runner_) {
22 task_runner_->PostTask( 22 task_runner_->PostTask(
23 FROM_HERE, 23 FROM_HERE,
24 base::Bind(&GenericCallbackBinder::RunCallbackOnTaskRunner, callback_, 24 base::Bind(&GenericCallbackBinder::RunCallbackOnTaskRunner, callback_,
25 base::Passed(&handle))); 25 base::Passed(&handle)));
26 return; 26 return;
27 } 27 }
28 callback_.Run(std::move(handle)); 28 callback_.Run(std::move(handle));
29 } 29 }
30 30
31 // static 31 // static
32 void GenericCallbackBinder::RunCallbackOnTaskRunner( 32 void GenericCallbackBinder::RunCallbackOnTaskRunner(
33 const BindCallback& callback, 33 const BindCallback& callback,
34 mojo::ScopedMessagePipeHandle client_handle) { 34 mojo::ScopedMessagePipeHandle client_handle) {
35 callback.Run(std::move(client_handle)); 35 callback.Run(std::move(client_handle));
36 } 36 }
37 37
38 } // namespace internal 38 } // namespace internal
39 } // namespace shell 39 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/callback_binder.h ('k') | services/shell/public/cpp/lib/interface_factory_binder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698