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

Unified Diff: services/service_manager/public/cpp/interface_registry.h

Issue 2457493004: Cleanup InterfaceRegistry + adds Serialize() (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « no previous file | services/service_manager/public/cpp/lib/interface_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/public/cpp/interface_registry.h
diff --git a/services/service_manager/public/cpp/interface_registry.h b/services/service_manager/public/cpp/interface_registry.h
index e63f16834bd4605982edbad2b1b7225189c494e7..e1813ead8cd09e6a43f06cfa85e4310d38f3ea95 100644
--- a/services/service_manager/public/cpp/interface_registry.h
+++ b/services/service_manager/public/cpp/interface_registry.h
@@ -77,7 +77,9 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
};
// Construct an unbound InterfaceRegistry. This object will not bind requests
- // for interfaces until Bind() is called.
+ // for interfaces until Bind() is called. |name| is used for error reporting
+ // and should reflect the name of the InterfaceProviderSpec pair that controls
+ // which interfaces can be bound via this InterfaceRegistry.
explicit InterfaceRegistry(const std::string& name);
~InterfaceRegistry() override;
@@ -95,6 +97,10 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
const Identity& remote_identity,
const InterfaceProviderSpec& remote_interface_provider_spec);
+ // Serializes the contents of the registry (including the local and remote
+ // specs) to a stringstream.
+ void Serialize(std::stringstream* stream);
+
base::WeakPtr<InterfaceRegistry> GetWeakPtr();
// Allows |Interface| to be exposed via this registry. Requests to bind will
@@ -147,7 +153,7 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
void SetConnectionLostClosure(const base::Closure& connection_lost_closure);
private:
- using NameToInterfaceBinderMap =
+ using InterfaceNameToBinderMap =
std::map<std::string, std::unique_ptr<InterfaceBinder>>;
// mojom::InterfaceProvider:
@@ -163,19 +169,37 @@ class InterfaceRegistry : public mojom::InterfaceProvider {
// according to capability policy.
bool CanBindRequestForInterface(const std::string& interface_name) const;
+ // Called whenever |remote_interface_provider_spec_| changes to rebuild the
+ // contents of |exposed_interfaces_| and |expose_all_interfaces_|.
+ void RebuildExposedInterfaces();
+
mojom::InterfaceProviderRequest pending_request_;
mojo::Binding<mojom::InterfaceProvider> binding_;
- Identity identity_;
- InterfaceProviderSpec interface_provider_spec_;
+
std::string name_;
- // Metadata computed when Bind() is called:
- Identity remote_identity_;
- InterfaceSet allowed_interfaces_;
- bool allow_all_interfaces_ = false;
+ // Initialized from static metadata in the host service's manifest.
+ Identity local_identity_;
+ InterfaceProviderSpec local_interface_provider_spec_;
- NameToInterfaceBinderMap name_to_binder_;
+ // Initialized from static metadata in the remote service's manifest.
+ Identity remote_identity_;
+ // Initialized from static metadata in the remote service's manifest. May be
+ // mutated after the fact when a capability is dynamically granted via a call
+ // to GrantCapability().
+ InterfaceProviderSpec remote_interface_provider_spec_;
+
+ // Metadata computed whenever |remote_interface_provider_spec_| changes.
+ InterfaceSet exposed_interfaces_;
+ bool expose_all_interfaces_ = false;
+
+ // Contains every interface binder that has been registered with this
+ // InterfaceRegistry. Not all binders may be reachable depending on the
+ // capabilities requested by the remote. Only interfaces in
+ // exposed_interfaces_ may be bound. When |expose_all_interfaces_| is true,
+ // any interface may be bound.
+ InterfaceNameToBinderMap name_to_binder_;
Binder default_binder_;
bool is_paused_ = false;
« no previous file with comments | « no previous file | services/service_manager/public/cpp/lib/interface_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698