| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/service_manager/public/cpp/service_context.h" | 5 #include "services/service_manager/public/cpp/service_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
| 77 // ServiceContext, mojom::Service implementation: | 77 // ServiceContext, mojom::Service implementation: |
| 78 | 78 |
| 79 void ServiceContext::OnStart(const ServiceInfo& info, | 79 void ServiceContext::OnStart(const ServiceInfo& info, |
| 80 const OnStartCallback& callback) { | 80 const OnStartCallback& callback) { |
| 81 local_info_ = info; | 81 local_info_ = info; |
| 82 callback.Run(std::move(pending_connector_request_), | 82 callback.Run(std::move(pending_connector_request_), |
| 83 mojo::GetProxy(&service_control_, binding_.associated_group())); | 83 mojo::GetProxy(&service_control_, binding_.associated_group())); |
| 84 service_->OnStart(this); | 84 |
| 85 service_->set_context(this); |
| 86 service_->OnStart(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void ServiceContext::OnConnect( | 89 void ServiceContext::OnConnect( |
| 88 const ServiceInfo& source_info, | 90 const ServiceInfo& source_info, |
| 89 mojom::InterfaceProviderRequest interfaces, | 91 mojom::InterfaceProviderRequest interfaces, |
| 90 const OnConnectCallback& callback) { | 92 const OnConnectCallback& callback) { |
| 91 InterfaceProviderSpec source_spec, target_spec; | 93 InterfaceProviderSpec source_spec, target_spec; |
| 92 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, | 94 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
| 93 local_info_.interface_provider_specs, &target_spec); | 95 local_info_.interface_provider_specs, &target_spec); |
| 94 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, | 96 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 144 } |
| 143 | 145 |
| 144 void ServiceContext::DestroyConnectionInterfaceRegistry( | 146 void ServiceContext::DestroyConnectionInterfaceRegistry( |
| 145 InterfaceRegistry* registry) { | 147 InterfaceRegistry* registry) { |
| 146 auto it = connection_interface_registries_.find(registry); | 148 auto it = connection_interface_registries_.find(registry); |
| 147 CHECK(it != connection_interface_registries_.end()); | 149 CHECK(it != connection_interface_registries_.end()); |
| 148 connection_interface_registries_.erase(it); | 150 connection_interface_registries_.erase(it); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } // namespace service_manager | 153 } // namespace service_manager |
| OLD | NEW |