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

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

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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/interface_registry.h" 5 #include "services/shell/public/cpp/interface_registry.h"
6 6
7 #include "services/shell/public/cpp/connection.h" 7 #include "services/shell/public/cpp/connection.h"
8 8
9 namespace shell { 9 namespace shell {
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void InterfaceRegistry::GetInterface(const mojo::String& interface_name, 54 void InterfaceRegistry::GetInterface(const mojo::String& interface_name,
55 mojo::ScopedMessagePipeHandle handle) { 55 mojo::ScopedMessagePipeHandle handle) {
56 auto iter = name_to_binder_.find(interface_name); 56 auto iter = name_to_binder_.find(interface_name);
57 if (iter != name_to_binder_.end()) { 57 if (iter != name_to_binder_.end()) {
58 iter->second->BindInterface(connection_, interface_name, std::move(handle)); 58 iter->second->BindInterface(connection_, interface_name, std::move(handle));
59 } else if (connection_ && !connection_->AllowsInterface(interface_name)) { 59 } else if (connection_ && !connection_->AllowsInterface(interface_name)) {
60 LOG(ERROR) << "Connection CapabilityFilter prevented binding to " 60 LOG(ERROR) << "Connection CapabilityFilter prevented binding to "
61 << "interface: " << interface_name << " connection_name:" 61 << "interface: " << interface_name << " connection_name:"
62 << connection_->GetConnectionName() << " remote_name:" 62 << connection_->GetConnectionName() << " remote_name:"
63 << connection_->GetRemoteIdentity().name(); 63 << connection_->GetRemoteIdentity().name();
64 } else if (!default_binder_.is_null()) {
65 default_binder_.Run(interface_name, std::move(handle));
64 } 66 }
65 } 67 }
66 68
67 bool InterfaceRegistry::SetInterfaceBinderForName( 69 bool InterfaceRegistry::SetInterfaceBinderForName(
68 std::unique_ptr<InterfaceBinder> binder, 70 std::unique_ptr<InterfaceBinder> binder,
69 const std::string& interface_name) { 71 const std::string& interface_name) {
70 if (!connection_ || 72 if (!connection_ ||
71 (connection_ && connection_->AllowsInterface(interface_name))) { 73 (connection_ && connection_->AllowsInterface(interface_name))) {
72 RemoveInterface(interface_name); 74 RemoveInterface(interface_name);
73 name_to_binder_[interface_name] = std::move(binder); 75 name_to_binder_[interface_name] = std::move(binder);
74 return true; 76 return true;
75 } 77 }
76 return false; 78 return false;
77 } 79 }
78 80
79 } // namespace shell 81 } // namespace shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698