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

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

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

Powered by Google App Engine
This is Rietveld 408576698