| 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 | 84 service_->OnStart(this); |
| 85 service_->set_context(this); | |
| 86 service_->OnStart(); | |
| 87 } | 85 } |
| 88 | 86 |
| 89 void ServiceContext::OnConnect( | 87 void ServiceContext::OnConnect( |
| 90 const ServiceInfo& source_info, | 88 const ServiceInfo& source_info, |
| 91 mojom::InterfaceProviderRequest interfaces, | 89 mojom::InterfaceProviderRequest interfaces, |
| 92 const OnConnectCallback& callback) { | 90 const OnConnectCallback& callback) { |
| 93 InterfaceProviderSpec source_spec, target_spec; | 91 InterfaceProviderSpec source_spec, target_spec; |
| 94 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, | 92 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
| 95 local_info_.interface_provider_specs, &target_spec); | 93 local_info_.interface_provider_specs, &target_spec); |
| 96 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, | 94 GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 142 } |
| 145 | 143 |
| 146 void ServiceContext::DestroyConnectionInterfaceRegistry( | 144 void ServiceContext::DestroyConnectionInterfaceRegistry( |
| 147 InterfaceRegistry* registry) { | 145 InterfaceRegistry* registry) { |
| 148 auto it = connection_interface_registries_.find(registry); | 146 auto it = connection_interface_registries_.find(registry); |
| 149 CHECK(it != connection_interface_registries_.end()); | 147 CHECK(it != connection_interface_registries_.end()); |
| 150 connection_interface_registries_.erase(it); | 148 connection_interface_registries_.erase(it); |
| 151 } | 149 } |
| 152 | 150 |
| 153 } // namespace service_manager | 151 } // namespace service_manager |
| OLD | NEW |