Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGE R_H_ | 5 #ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGE R_H_ |
| 6 #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGE R_H_ | 6 #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGE R_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 | 11 |
| 10 namespace service_manager { | 12 namespace service_manager { |
| 11 class BinderRegistry; | 13 class BinderRegistry; |
| 12 class ServiceContextRefFactory; | 14 class ServiceContextRefFactory; |
| 13 } // service_manager | 15 } // service_manager |
| 14 | 16 |
| 15 namespace resource_coordinator { | 17 namespace resource_coordinator { |
| 16 | 18 |
| 19 class CoordinationUnitImpl; | |
| 20 class CoordinationUnitGraphObserver; | |
| 21 | |
| 17 // The CoordinationUnitManager is a singleton that encapsulates all | 22 // The CoordinationUnitManager is a singleton that encapsulates all |
| 18 // aspects of Coordination Units within the ResourceCoordinatorService. | 23 // aspects of Coordination Units within the ResourceCoordinatorService. |
| 19 // All functionality for dealing with CoordinationUnits should be contained | 24 // All functionality for dealing with CoordinationUnits should be contained |
| 20 // within this class or classes that are owned by it | 25 // within this class or classes that are owned by it |
| 21 class CoordinationUnitManager { | 26 class CoordinationUnitManager { |
| 22 public: | 27 public: |
| 23 CoordinationUnitManager(); | 28 CoordinationUnitManager(); |
| 24 ~CoordinationUnitManager(); | 29 ~CoordinationUnitManager(); |
| 25 | 30 |
| 26 void OnStart(service_manager::BinderRegistry* registry, | 31 void OnStart(service_manager::BinderRegistry* registry, |
| 27 service_manager::ServiceContextRefFactory* service_ref_factory); | 32 service_manager::ServiceContextRefFactory* service_ref_factory); |
| 33 void RegisterObserver(CoordinationUnitGraphObserver* observers); | |
| 34 | |
| 35 void NotifyObserversCoordinationUnitCreated( | |
| 36 CoordinationUnitImpl* coordination_unit); | |
| 37 void NotifyObserversCoordinationUnitWillBeDestroyed( | |
| 38 CoordinationUnitImpl* coordination_unit); | |
| 39 | |
| 40 // Allow tests to clear all observers so that they can isolate specific | |
| 41 // observers without having to worry about side effects from others. | |
| 42 void UnregisterAllObserversForTesting(); | |
| 28 | 43 |
| 29 private: | 44 private: |
| 45 std::vector<CoordinationUnitGraphObserver*> observers_; | |
|
Zhen Wang
2017/06/15 20:07:53
Use smart pointer instead of raw pointers:
https:/
| |
| 46 | |
| 30 static void Create( | 47 static void Create( |
| 31 service_manager::ServiceContextRefFactory* service_ref_factory); | 48 service_manager::ServiceContextRefFactory* service_ref_factory); |
| 32 | 49 |
| 33 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager); | 50 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager); |
| 34 }; | 51 }; |
| 35 | 52 |
| 36 } // namespace resource_coordinator | 53 } // namespace resource_coordinator |
| 37 | 54 |
| 38 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_ | 55 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_ |
| OLD | NEW |