| OLD | NEW |
| 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/interface_registry.h" | 5 #include "services/service_manager/public/cpp/interface_registry.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/logging.h" | |
| 10 #include "mojo/public/cpp/bindings/message.h" | 9 #include "mojo/public/cpp/bindings/message.h" |
| 11 #include "services/service_manager/public/cpp/connection.h" | 10 #include "services/service_manager/public/cpp/connection.h" |
| 12 | 11 |
| 13 namespace service_manager { | 12 namespace service_manager { |
| 14 namespace { | 13 namespace { |
| 15 | 14 |
| 16 // Returns the set of capabilities required from the target. | 15 // Returns the set of capabilities required from the target. |
| 17 CapabilitySet GetRequestedCapabilities(const InterfaceProviderSpec& source_spec, | 16 CapabilitySet GetRequestedCapabilities(const InterfaceProviderSpec& source_spec, |
| 18 const Identity& target) { | 17 const Identity& target) { |
| 19 CapabilitySet capabilities; | 18 CapabilitySet capabilities; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 194 |
| 196 if (CanBindRequestForInterface(interface_name)) { | 195 if (CanBindRequestForInterface(interface_name)) { |
| 197 auto iter = name_to_binder_.find(interface_name); | 196 auto iter = name_to_binder_.find(interface_name); |
| 198 if (iter != name_to_binder_.end()) { | 197 if (iter != name_to_binder_.end()) { |
| 199 iter->second->BindInterface(remote_identity_, | 198 iter->second->BindInterface(remote_identity_, |
| 200 interface_name, | 199 interface_name, |
| 201 std::move(handle)); | 200 std::move(handle)); |
| 202 } else if (!default_binder_.is_null()) { | 201 } else if (!default_binder_.is_null()) { |
| 203 default_binder_.Run(interface_name, std::move(handle)); | 202 default_binder_.Run(interface_name, std::move(handle)); |
| 204 } else { | 203 } else { |
| 205 // TODO(miu): Disable spammy logging until client --> embedder service | 204 std::stringstream ss; |
| 206 // issue is fixed. https://crbug.com/664595 | 205 ss << "Failed to locate a binder for interface: " << interface_name |
| 207 if (VLOG_IS_ON(1)) { | 206 << " requested by: " << remote_identity_.name() << " exposed by: " |
| 208 std::stringstream ss; | 207 << local_identity_.name() << " via InterfaceProviderSpec \"" << name_ |
| 209 ss << "Failed to locate a binder for interface: " << interface_name | 208 << "\"."; |
| 210 << " requested by: " << remote_identity_.name() << " exposed by: " | 209 Serialize(&ss); |
| 211 << local_identity_.name() << " via InterfaceProviderSpec \"" << name_ | 210 LOG(ERROR) << ss.str(); |
| 212 << "\"."; | |
| 213 Serialize(&ss); | |
| 214 VLOG(1) << ss.str(); | |
| 215 } | |
| 216 } | 211 } |
| 217 } else { | 212 } else { |
| 218 std::stringstream ss; | 213 std::stringstream ss; |
| 219 ss << "InterfaceProviderSpec \"" << name_ << "\" prevented service: " | 214 ss << "InterfaceProviderSpec \"" << name_ << "\" prevented service: " |
| 220 << remote_identity_.name() << " from binding interface: " | 215 << remote_identity_.name() << " from binding interface: " |
| 221 << interface_name << " exposed by: " << local_identity_.name(); | 216 << interface_name << " exposed by: " << local_identity_.name(); |
| 222 Serialize(&ss); | 217 Serialize(&ss); |
| 223 LOG(ERROR) << ss.str(); | 218 LOG(ERROR) << ss.str(); |
| 224 mojo::ReportBadMessage(ss.str()); | 219 mojo::ReportBadMessage(ss.str()); |
| 225 } | 220 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 254 exposed_interfaces_.size() == 1 && exposed_interfaces_.count("*") == 1; | 249 exposed_interfaces_.size() == 1 && exposed_interfaces_.count("*") == 1; |
| 255 } | 250 } |
| 256 | 251 |
| 257 void InterfaceRegistry::OnConnectionError() { | 252 void InterfaceRegistry::OnConnectionError() { |
| 258 std::list<base::Closure> closures = connection_lost_closures_; | 253 std::list<base::Closure> closures = connection_lost_closures_; |
| 259 for (const auto& closure : closures) | 254 for (const auto& closure : closures) |
| 260 closure.Run(); | 255 closure.Run(); |
| 261 } | 256 } |
| 262 | 257 |
| 263 } // namespace service_manager | 258 } // namespace service_manager |
| OLD | NEW |