Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: services/resource_coordinator/coordination_unit/coordination_unit_manager.h

Issue 2942403002: [GRC] Coordination Unit Graph Observer (Closed)
Patch Set: Fix unittest and OnCoordinationUnitWillBeDestroyed Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 namespace service_manager { 13 namespace service_manager {
14 class BinderRegistry; 14 class BinderRegistry;
15 class ServiceContextRefFactory; 15 class ServiceContextRefFactory;
16 } // service_manager 16 } // service_manager
17 17
18 namespace resource_coordinator { 18 namespace resource_coordinator {
19 19
20 class CoordinationUnitImpl; 20 class CoordinationUnitImpl;
21 class CoordinationUnitGraphObserver; 21 class CoordinationUnitGraphObserver;
22 22
23 // The CoordinationUnitManager is a singleton that encapsulates all 23 // The CoordinationUnitManager is a singleton that encapsulates all
24 // aspects of Coordination Units within the ResourceCoordinatorService. 24 // aspects of Coordination Units within the resource_coordinator service.
25 // All functionality for dealing with CoordinationUnits should be contained 25 // All functionality for dealing with CoordinationUnits should be contained
26 // within this class or classes that are owned by it 26 // within this class or classes that are owned by it
27 class CoordinationUnitManager { 27 class CoordinationUnitManager {
28 public: 28 public:
29 CoordinationUnitManager(); 29 CoordinationUnitManager();
30 ~CoordinationUnitManager(); 30 ~CoordinationUnitManager();
31 31
32 void OnStart(service_manager::BinderRegistry* registry, 32 void OnStart(service_manager::BinderRegistry* registry,
33 service_manager::ServiceContextRefFactory* service_ref_factory); 33 service_manager::ServiceContextRefFactory* service_ref_factory);
34 void RegisterObserver( 34 void RegisterObserver(
35 std::unique_ptr<CoordinationUnitGraphObserver> observers); 35 std::unique_ptr<CoordinationUnitGraphObserver> observer);
36 void OnCoordinationUnitCreated(CoordinationUnitImpl* coordination_unit);
37 void OnCoordinationUnitWillBeDestroyed(
38 CoordinationUnitImpl* coordination_unit);
36 39
37 void NotifyObserversCoordinationUnitCreated( 40 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>>& observers() {
oystein (OOO til 10th of July) 2017/06/20 21:39:33 nit: looks this is just for testing? maybe const s
38 CoordinationUnitImpl* coordination_unit); 41 return observers_;
39 void NotifyObserversCoordinationUnitWillBeDestroyed( 42 }
40 CoordinationUnitImpl* coordination_unit);
41 43
42 private: 44 private:
43 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>> observers_; 45 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>> observers_;
44 46
45 static void Create( 47 static void Create(
46 service_manager::ServiceContextRefFactory* service_ref_factory); 48 service_manager::ServiceContextRefFactory* service_ref_factory);
47 49
48 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager); 50 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager);
49 }; 51 };
50 52
51 } // namespace resource_coordinator 53 } // namespace resource_coordinator
52 54
53 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_ 55 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698