Index: services/service_manager/public/cpp/lib/interface_registry.cc |
diff --git a/services/service_manager/public/cpp/lib/interface_registry.cc b/services/service_manager/public/cpp/lib/interface_registry.cc |
index a903dc366feeef04e143e3b2b9c4b61b13db45c3..91314a6e5300915f20fcf8c38f7eee5881e03eac 100644 |
--- a/services/service_manager/public/cpp/lib/interface_registry.cc |
+++ b/services/service_manager/public/cpp/lib/interface_registry.cc |
@@ -13,29 +13,7 @@ |
namespace service_manager { |
namespace { |
-void SerializeIdentity(const Identity& identity, std::stringstream* stream) { |
- *stream << identity.name() << "@" << identity.instance() << " run as: " |
- << identity.user_id(); |
-} |
- |
-void SerializeSpec(const InterfaceProviderSpec& spec, |
- std::stringstream* stream) { |
- *stream << " Providing:\n"; |
- for (const auto& entry : spec.provides) { |
- *stream << " capability: " << entry.first << " containing interfaces:\n"; |
- for (const auto& interface_name : entry.second) |
- *stream << " " << interface_name << "\n"; |
- } |
- *stream << "\n Requiring:\n"; |
- for (const auto& entry : spec.requires) { |
- *stream << " From: " << entry.first << ":\n"; |
- for (const auto& capability_name : entry.second) |
- *stream << " " << capability_name << "\n"; |
- } |
-} |
- |
-} // namespace |
- |
+// Returns the set of capabilities required from the target. |
CapabilitySet GetRequestedCapabilities(const InterfaceProviderSpec& source_spec, |
const Identity& target) { |
CapabilitySet capabilities; |
@@ -56,6 +34,8 @@ |
return capabilities; |
} |
+// Generates a single set of interfaces that is the union of all interfaces |
+// exposed by the target for the capabilities requested by the source. |
InterfaceSet GetInterfacesToExpose( |
const InterfaceProviderSpec& source_spec, |
const Identity& target, |
@@ -77,6 +57,29 @@ |
} |
return exposed_interfaces; |
} |
+ |
+void SerializeIdentity(const Identity& identity, std::stringstream* stream) { |
+ *stream << identity.name() << "@" << identity.instance() << " run as: " |
+ << identity.user_id(); |
+} |
+ |
+void SerializeSpec(const InterfaceProviderSpec& spec, |
+ std::stringstream* stream) { |
+ *stream << " Providing:\n"; |
+ for (const auto& entry : spec.provides) { |
+ *stream << " capability: " << entry.first << " containing interfaces:\n"; |
+ for (const auto& interface_name : entry.second) |
+ *stream << " " << interface_name << "\n"; |
+ } |
+ *stream << "\n Requiring:\n"; |
+ for (const auto& entry : spec.requires) { |
+ *stream << " From: " << entry.first << ":\n"; |
+ for (const auto& capability_name : entry.second) |
+ *stream << " " << capability_name << "\n"; |
+ } |
+} |
+ |
+} // namespace |
InterfaceRegistry::InterfaceRegistry(const std::string& name) |
: binding_(this), |