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