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

Side by Side Diff: services/service_manager/public/cpp/interface_binder.cc

Issue 2860943002: Flatten interface_binder.h and callback_binder.h (Closed)
Patch Set: Created 3 years, 7 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 2017 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/service_manager/public/cpp/lib/callback_binder.h" 5 #include "services/service_manager/public/cpp/interface_binder.h"
6 6
7 namespace service_manager { 7 namespace service_manager {
8 namespace internal {
9 8
10 GenericCallbackBinder::GenericCallbackBinder( 9 GenericCallbackBinder::GenericCallbackBinder(
11 const BindCallback& callback, 10 const BindCallback& callback,
12 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 11 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
13 : callback_(callback), task_runner_(task_runner) {} 12 : callback_(callback), task_runner_(task_runner) {}
14 13
15 GenericCallbackBinder::~GenericCallbackBinder() {} 14 GenericCallbackBinder::~GenericCallbackBinder() {}
16 15
17 void GenericCallbackBinder::BindInterface( 16 void GenericCallbackBinder::BindInterface(
18 const BindSourceInfo& source_info, 17 const BindSourceInfo& source_info,
19 const std::string& interface_name, 18 const std::string& interface_name,
20 mojo::ScopedMessagePipeHandle handle) { 19 mojo::ScopedMessagePipeHandle handle) {
21 if (task_runner_) { 20 if (task_runner_) {
22 task_runner_->PostTask( 21 task_runner_->PostTask(
23 FROM_HERE, base::Bind(&GenericCallbackBinder::RunCallback, callback_, 22 FROM_HERE, base::Bind(&GenericCallbackBinder::RunCallback, callback_,
24 base::Passed(&handle))); 23 base::Passed(&handle)));
25 return; 24 return;
26 } 25 }
27 RunCallback(callback_, std::move(handle)); 26 RunCallback(callback_, std::move(handle));
28 } 27 }
29 28
30 // static 29 // static
31 void GenericCallbackBinder::RunCallback(const BindCallback& callback, 30 void GenericCallbackBinder::RunCallback(const BindCallback& callback,
32 mojo::ScopedMessagePipeHandle handle) { 31 mojo::ScopedMessagePipeHandle handle) {
33 callback.Run(std::move(handle)); 32 callback.Run(std::move(handle));
34 } 33 }
35 34
36 } // namespace internal
37 } // namespace service_manager 35 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/interface_binder.h ('k') | services/service_manager/public/cpp/lib/binder_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698