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

Unified Diff: services/service_manager/public/cpp/lib/interface_registry.cc

Issue 2634493002: Revert of Perform InterfaceProviderSpec intersection in the ServiceManager (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
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),
« no previous file with comments | « services/service_manager/public/cpp/interface_registry.h ('k') | services/service_manager/public/cpp/lib/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698