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

Side by Side Diff: services/resource_coordinator/resource_coordinator_service.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_RESOURCE_COORDINATOR_SERVICE_H_ 5 #ifndef SERVICES_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_SERVICE_H_
6 #define SERVICES_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_SERVICE_H_ 6 #define SERVICES_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "components/ukm/public/mojo_ukm_recorder.h"
14 #include "services/resource_coordinator/coordination_unit/coordination_unit_mana ger.h" 15 #include "services/resource_coordinator/coordination_unit/coordination_unit_mana ger.h"
15 #include "services/service_manager/public/cpp/binder_registry.h" 16 #include "services/service_manager/public/cpp/binder_registry.h"
16 #include "services/service_manager/public/cpp/service.h" 17 #include "services/service_manager/public/cpp/service.h"
17 #include "services/service_manager/public/cpp/service_context_ref.h" 18 #include "services/service_manager/public/cpp/service_context_ref.h"
18 19
19 namespace resource_coordinator { 20 namespace resource_coordinator {
20 21
21 class ResourceCoordinatorService : public service_manager::Service { 22 class ResourceCoordinatorService : public service_manager::Service {
22 public: 23 public:
23 ResourceCoordinatorService(); 24 ResourceCoordinatorService();
24 ~ResourceCoordinatorService() override; 25 ~ResourceCoordinatorService() override;
25 26
26 // service_manager::Service: 27 // service_manager::Service:
27 // Factory function for use as an embedded service. 28 // Factory function for use as an embedded service.
28 static std::unique_ptr<service_manager::Service> Create(); 29 static std::unique_ptr<service_manager::Service> Create();
29 30
30 // service_manager::Service: 31 // service_manager::Service:
31 void OnStart() override; 32 void OnStart() override;
32 void OnBindInterface(const service_manager::BindSourceInfo& source_info, 33 void OnBindInterface(const service_manager::BindSourceInfo& source_info,
33 const std::string& interface_name, 34 const std::string& interface_name,
34 mojo::ScopedMessagePipeHandle interface_pipe) override; 35 mojo::ScopedMessagePipeHandle interface_pipe) override;
35 36
37 void SetUkmRecorder(std::unique_ptr<ukm::MojoUkmRecorder> ukm_recorder);
38
39 service_manager::BinderRegistry& registry() { return registry_; }
40 service_manager::ServiceContextRefFactory* ref_factory() {
41 return ref_factory_.get();
42 }
43 ukm::MojoUkmRecorder* ukm_recorder() { return ukm_recorder_.get(); }
44
36 private: 45 private:
37 service_manager::BinderRegistry registry_; 46 service_manager::BinderRegistry registry_;
38 std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_; 47 std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_;
39 CoordinationUnitManager coordination_unit_manager_; 48 CoordinationUnitManager coordination_unit_manager_;
49 std::unique_ptr<ukm::MojoUkmRecorder> ukm_recorder_;
40 50
41 // WeakPtrFactory members should always come last so WeakPtrs are destructed 51 // WeakPtrFactory members should always come last so WeakPtrs are destructed
42 // before other members. 52 // before other members.
43 base::WeakPtrFactory<ResourceCoordinatorService> weak_factory_; 53 base::WeakPtrFactory<ResourceCoordinatorService> weak_factory_;
44 54
45 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorService); 55 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorService);
46 }; 56 };
47 57
48 } // namespace resource_coordinator 58 } // namespace resource_coordinator
49 59
50 #endif // SERVICES_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_SERVICE_H_ 60 #endif // SERVICES_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698