| Index: services/service_manager/service_manager.cc
|
| diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc
|
| index acfcaaf51e02febad62ea28dac2cf44aa890440b..59844a4d150b590c9c2fc4df812364f496894231 100644
|
| --- a/services/service_manager/service_manager.cc
|
| +++ b/services/service_manager/service_manager.cc
|
| @@ -234,6 +234,18 @@ class ServiceManager::Instance
|
| };
|
|
|
| // mojom::Connector implementation:
|
| + void RegisterService(
|
| + const Identity& target,
|
| + mojom::ClientProcessConnectionPtr client_process_connection) override {
|
| + Connect(
|
| + target,
|
| + mojom::InterfaceProviderRequest(),
|
| + std::move(client_process_connection),
|
| + base::Bind(
|
| + &service_manager::ServiceManager::Instance::EmptyConnectCallback,
|
| + weak_factory_.GetWeakPtr()));
|
| + }
|
| +
|
| void Connect(const service_manager::Identity& in_target,
|
| mojom::InterfaceProviderRequest remote_interfaces,
|
| mojom::ClientProcessConnectionPtr client_process_connection,
|
| @@ -432,6 +444,9 @@ class ServiceManager::Instance
|
| OnServiceLost(service_manager_->GetWeakPtr());
|
| }
|
|
|
| + void EmptyConnectCallback(mojom::ConnectResult result,
|
| + const std::string& user_id) {}
|
| +
|
| service_manager::ServiceManager* const service_manager_;
|
|
|
| // An id that identifies this instance. Distinct from pid, as a single process
|
| @@ -884,10 +899,12 @@ void ServiceManager::OnGotResolvedName(std::unique_ptr<ConnectParams> params,
|
| // is already holding a corresponding ServiceRequest.
|
| instance->StartWithService(std::move(service));
|
| } else if (!client_process_connection.is_null()) {
|
| - // Likewise if a ClientProcessConnection was given via Connect(), it
|
| - // provides the Service proxy to use.
|
| + // This branch should be reachable only via a call to RegisterService(). We
|
| + // start the instance but return early before we connect to it. Clients will
|
| + // call Connect() with the target identity subsequently.
|
| instance->StartWithClientProcessConnection(
|
| std::move(client_process_connection));
|
| + return;
|
| } else {
|
| // Otherwise we create a new Service pipe.
|
| mojom::ServiceRequest request(&service);
|
|
|