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

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

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Address reviewer feedback 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 #include "services/service_manager/public/cpp/binder_registry.h" 12 #include "services/service_manager/public/cpp/binder_registry.h"
13 13
14 namespace ukm {
15 class MojoUkmRecorder;
16 class UkmEntryBuilder;
17 } // namespace ukm
18
14 namespace service_manager { 19 namespace service_manager {
15 class ServiceContextRefFactory; 20 class ServiceContextRefFactory;
16 } // service_manager 21 } // service_manager
17 22
18 namespace resource_coordinator { 23 namespace resource_coordinator {
19 24
20 class CoordinationUnitImpl; 25 class CoordinationUnitImpl;
21 class CoordinationUnitGraphObserver; 26 class CoordinationUnitGraphObserver;
22 27
23 // The CoordinationUnitManager is a singleton that encapsulates all 28 // The CoordinationUnitManager is a singleton that encapsulates all
24 // aspects of Coordination Units within the resource_coordinator service. 29 // aspects of Coordination Units within the resource_coordinator service.
25 // All functionality for dealing with CoordinationUnits should be contained 30 // All functionality for dealing with CoordinationUnits should be contained
26 // within this class or classes that are owned by it 31 // within this class or classes that are owned by it
27 class CoordinationUnitManager { 32 class CoordinationUnitManager {
28 public: 33 public:
29 CoordinationUnitManager(); 34 CoordinationUnitManager();
30 ~CoordinationUnitManager(); 35 ~CoordinationUnitManager();
31 36
37 void set_ukm_recorder(ukm::MojoUkmRecorder* ukm_recorder) {
38 ukm_recorder_ = ukm_recorder;
39 }
40
32 void OnStart(service_manager::BinderRegistry* registry, 41 void OnStart(service_manager::BinderRegistry* registry,
33 service_manager::ServiceContextRefFactory* service_ref_factory); 42 service_manager::ServiceContextRefFactory* service_ref_factory);
34 void RegisterObserver( 43 void RegisterObserver(
35 std::unique_ptr<CoordinationUnitGraphObserver> observer); 44 std::unique_ptr<CoordinationUnitGraphObserver> observer);
36 void OnCoordinationUnitCreated(CoordinationUnitImpl* coordination_unit); 45 void OnCoordinationUnitCreated(CoordinationUnitImpl* coordination_unit);
37 void OnCoordinationUnitWillBeDestroyed( 46 void OnCoordinationUnitWillBeDestroyed(
38 CoordinationUnitImpl* coordination_unit); 47 CoordinationUnitImpl* coordination_unit);
39 48
49 std::unique_ptr<ukm::UkmEntryBuilder> CreateUkmEntryBuilder(
50 const char* event_name);
51
40 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>>& 52 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>>&
41 observers_for_testing() { 53 observers_for_testing() {
42 return observers_; 54 return observers_;
43 } 55 }
44 56
45 private: 57 private:
46 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>> observers_; 58 std::vector<std::unique_ptr<CoordinationUnitGraphObserver>> observers_;
59 ukm::MojoUkmRecorder* ukm_recorder_ = nullptr;
47 60
48 static void Create( 61 static void Create(
49 service_manager::ServiceContextRefFactory* service_ref_factory); 62 service_manager::ServiceContextRefFactory* service_ref_factory);
50 63
51 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager); 64 DISALLOW_COPY_AND_ASSIGN(CoordinationUnitManager);
52 }; 65 };
53 66
54 } // namespace resource_coordinator 67 } // namespace resource_coordinator
55 68
56 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_ 69 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MAN AGER_H_
OLDNEW
« no previous file with comments | « services/resource_coordinator/DEPS ('k') | services/resource_coordinator/coordination_unit/coordination_unit_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698