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

Unified Diff: services/service_manager/service_manager.cc

Issue 2617883002: Add a new BindInterface() method to Connector. (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/service_manager.cc
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc
index a32333f5da1dbcd0f3cf03f62e337734da5f2802..f24211461746ee09734ab73200dc23a78eea5abc 100644
--- a/services/service_manager/service_manager.cc
+++ b/services/service_manager/service_manager.cc
@@ -228,7 +228,7 @@ class ServiceManager::Instance
};
// mojom::Connector implementation:
- void Start(
+ void StartService(
const Identity& target,
mojo::ScopedMessagePipeHandle service_handle,
mojom::PIDReceiverRequest pid_receiver_request) override {
@@ -251,6 +251,25 @@ class ServiceManager::Instance
mojom::PIDReceiverRequest(), callback);
}
+ void BindInterface(const service_manager::Identity& target,
+ const std::string& interface_name,
+ mojo::ScopedMessagePipeHandle interface_pipe,
+ const BindInterfaceCallback& callback) override {
+ mojom::InterfaceProviderPtr remote_interfaces;
+ ConnectImpl(
+ target,
+ MakeRequest(&remote_interfaces),
+ mojom::ServicePtr(),
+ mojom::PIDReceiverRequest(),
+ base::Bind(
+ &service_manager::ServiceManager::Instance::BindCallbackWrapper,
+ weak_factory_.GetWeakPtr(),
+ callback));
+ remote_interfaces->GetInterface(interface_name, std::move(interface_pipe));
+ // TODO(beng): Rather than just forwarding thru to InterfaceProvider, do
+ // manifest policy intersection here.
+ }
+
void ConnectImpl(const service_manager::Identity& in_target,
mojom::InterfaceProviderRequest remote_interfaces,
mojom::ServicePtr service,
@@ -452,6 +471,11 @@ class ServiceManager::Instance
void EmptyConnectCallback(mojom::ConnectResult result,
const std::string& user_id) {}
+ void BindCallbackWrapper(const BindInterfaceCallback& wrapped,
+ mojom::ConnectResult result,
+ const std::string& user_id) {
+ wrapped.Run(result, user_id);
+ }
service_manager::ServiceManager* const service_manager_;
@@ -636,7 +660,7 @@ mojom::Resolver* ServiceManager::GetResolver(const Identity& identity) {
return iter->second.get();
mojom::ResolverPtr resolver_ptr;
- ConnectToInterface(this, identity, CreateCatalogIdentity(), &resolver_ptr);
+ BindInterface(this, identity, CreateCatalogIdentity(), &resolver_ptr);
mojom::Resolver* resolver = resolver_ptr.get();
identity_to_resolver_[identity] = std::move(resolver_ptr);
return resolver;
@@ -814,8 +838,7 @@ mojom::ServiceFactory* ServiceManager::GetServiceFactory(
Identity source_identity(service_manager::mojom::kServiceName,
mojom::kInheritUserID);
mojom::ServiceFactoryPtr factory;
- ConnectToInterface(this, source_identity, service_factory_identity,
- &factory);
+ BindInterface(this, source_identity, service_factory_identity, &factory);
mojom::ServiceFactory* factory_interface = factory.get();
factory.set_connection_error_handler(
base::Bind(&service_manager::ServiceManager::OnServiceFactoryLost,
« no previous file with comments | « services/service_manager/public/interfaces/connector.mojom ('k') | services/service_manager/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698