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

Side by Side Diff: services/service_manager/public/cpp/lib/binder_registry.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 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/service_manager/public/cpp/binder_registry.h" 5 #include "services/service_manager/public/cpp/binder_registry.h"
6 6
7 #include "services/service_manager/public/cpp/identity.h" 7 #include "services/service_manager/public/cpp/identity.h"
8 8
9 namespace service_manager { 9 namespace service_manager {
10 10
11 BinderRegistry::BinderRegistry() : weak_factory_(this) {} 11 BinderRegistry::BinderRegistry() : weak_factory_(this) {}
12 BinderRegistry::~BinderRegistry() {} 12 BinderRegistry::~BinderRegistry() {}
13 13
14 void BinderRegistry::AddInterface( 14 void BinderRegistry::AddInterface(
15 const std::string& interface_name, 15 const std::string& interface_name,
16 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, 16 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback,
17 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 17 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
18 SetInterfaceBinder( 18 SetInterfaceBinder(interface_name, base::MakeUnique<GenericCallbackBinder>(
19 interface_name, 19 callback, task_runner));
20 base::MakeUnique<internal::GenericCallbackBinder>(callback, task_runner));
21 } 20 }
22 21
23 void BinderRegistry::RemoveInterface(const std::string& interface_name) { 22 void BinderRegistry::RemoveInterface(const std::string& interface_name) {
24 auto it = binders_.find(interface_name); 23 auto it = binders_.find(interface_name);
25 if (it != binders_.end()) 24 if (it != binders_.end())
26 binders_.erase(it); 25 binders_.erase(it);
27 } 26 }
28 27
29 bool BinderRegistry::CanBindInterface(const std::string& interface_name) const { 28 bool BinderRegistry::CanBindInterface(const std::string& interface_name) const {
30 auto it = binders_.find(interface_name); 29 auto it = binders_.find(interface_name);
(...skipping 18 matching lines...) Expand all
49 } 48 }
50 49
51 void BinderRegistry::SetInterfaceBinder( 50 void BinderRegistry::SetInterfaceBinder(
52 const std::string& interface_name, 51 const std::string& interface_name,
53 std::unique_ptr<InterfaceBinder> binder) { 52 std::unique_ptr<InterfaceBinder> binder) {
54 RemoveInterface(interface_name); 53 RemoveInterface(interface_name);
55 binders_[interface_name] = std::move(binder); 54 binders_[interface_name] = std::move(binder);
56 } 55 }
57 56
58 } // namespace service_manager 57 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/interface_binder.cc ('k') | services/service_manager/public/cpp/lib/callback_binder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698