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

Side by Side Diff: components/arc/metrics/arc_metrics_service.h

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: more rebase Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H 5 #ifndef COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
6 #define COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H 6 #define COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "components/arc/arc_bridge_service.h" 12 #include "components/arc/arc_bridge_service.h"
13 #include "components/arc/arc_service.h" 13 #include "components/arc/arc_service.h"
14 #include "components/arc/common/arc_bridge.mojom.h" 14 #include "components/arc/common/arc_bridge.mojom.h"
15 #include "components/arc/instance_holder.h"
15 #include "components/arc/metrics/oom_kills_monitor.h" 16 #include "components/arc/metrics/oom_kills_monitor.h"
16 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
17 18
18 namespace arc { 19 namespace arc {
19 20
20 // Collects information from other ArcServices and send UMA metrics. 21 // Collects information from other ArcServices and send UMA metrics.
21 class ArcMetricsService : public ArcService, 22 class ArcMetricsService
22 public ArcBridgeService::Observer, 23 : public ArcService,
23 public mojom::MetricsHost { 24 public InstanceHolder<mojom::MetricsInstance>::Observer,
25 public InstanceHolder<mojom::ProcessInstance>::Observer,
26 public mojom::MetricsHost {
24 public: 27 public:
25 explicit ArcMetricsService(ArcBridgeService* bridge_service); 28 explicit ArcMetricsService(ArcBridgeService* bridge_service);
26 ~ArcMetricsService() override; 29 ~ArcMetricsService() override;
27 30
28 // ArcBridgeService::Observer overrides. 31 // InstanceHolder<mojom::MetricsInstance>::Observer overrides.
29 void OnMetricsInstanceReady() override; 32 void OnInstanceReady(mojom::MetricsInstance*, uint32_t version) override;
30 void OnMetricsInstanceClosed() override; 33 void OnInstanceClosed(mojom::MetricsInstance*) override;
31 void OnProcessInstanceReady() override; 34
32 void OnProcessInstanceClosed() override; 35 // InstanceHolder<mojom::ProcessInstance>::Observer overrides.
36 void OnInstanceReady(mojom::ProcessInstance*, uint32_t version) override;
37 void OnInstanceClosed(mojom::ProcessInstance*) override;
33 38
34 // MetricsHost overrides. 39 // MetricsHost overrides.
35 void ReportBootProgress( 40 void ReportBootProgress(
36 mojo::Array<arc::mojom::BootProgressEventPtr> events) override; 41 mojo::Array<arc::mojom::BootProgressEventPtr> events) override;
37 42
38 private: 43 private:
39 bool CalledOnValidThread(); 44 bool CalledOnValidThread();
40 void RequestProcessList(); 45 void RequestProcessList();
41 void ParseProcessList( 46 void ParseProcessList(
42 mojo::Array<arc::mojom::RunningAppProcessInfoPtr> processes); 47 mojo::Array<arc::mojom::RunningAppProcessInfoPtr> processes);
(...skipping 13 matching lines...) Expand all
56 61
57 // Always keep this the last member of this class to make sure it's the 62 // Always keep this the last member of this class to make sure it's the
58 // first thing to be destructed. 63 // first thing to be destructed.
59 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; 64 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_;
60 65
61 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); 66 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService);
62 }; 67 };
63 68
64 } // namespace arc 69 } // namespace arc
65 70
66 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H 71 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698