OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/resource_coordinator/resource_coordinator_service.h" |
| 6 |
| 7 #include "base/macros.h" |
| 8 #include "services/resource_coordinator/coordination_unit/coordination_unit_prov
ider_impl.h" |
| 9 #include "services/service_manager/public/cpp/service_context.h" |
| 10 |
| 11 namespace resource_coordinator { |
| 12 |
| 13 std::unique_ptr<service_manager::Service> ResourceCoordinatorService::Create() { |
| 14 return base::MakeUnique<ResourceCoordinatorService>(); |
| 15 } |
| 16 |
| 17 ResourceCoordinatorService::ResourceCoordinatorService() |
| 18 : weak_factory_(this) {} |
| 19 |
| 20 ResourceCoordinatorService::~ResourceCoordinatorService() = default; |
| 21 |
| 22 void ResourceCoordinatorService::OnStart() { |
| 23 ref_factory_.reset(new service_manager::ServiceContextRefFactory( |
| 24 base::Bind(&service_manager::ServiceContext::RequestQuit, |
| 25 base::Unretained(context())))); |
| 26 |
| 27 registry_.AddInterface(base::Bind(&CoordinationUnitProviderImpl::Create, |
| 28 base::Unretained(ref_factory_.get()))); |
| 29 } |
| 30 |
| 31 void ResourceCoordinatorService::OnBindInterface( |
| 32 const service_manager::ServiceInfo& source_info, |
| 33 const std::string& interface_name, |
| 34 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 35 registry_.BindInterface(source_info.identity, interface_name, |
| 36 std::move(interface_pipe)); |
| 37 } |
| 38 |
| 39 } // namespace speed |
OLD | NEW |