| OLD | NEW |
| 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/metrics/oom_kills_monitor.h" | 15 #include "components/arc/metrics/oom_kills_monitor.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 17 |
| 18 namespace arc { | 18 namespace arc { |
| 19 | 19 |
| 20 // Collects information from other ArcServices and send UMA metrics. | 20 // Collects information from other ArcServices and send UMA metrics. |
| 21 class ArcMetricsService : public ArcService, | 21 class ArcMetricsService |
| 22 public ArcBridgeService::Observer, | 22 : public ArcService, |
| 23 public mojom::MetricsHost { | 23 public ArcBridgeService::InstanceObserver<mojom::MetricsInstance>, |
| 24 public ArcBridgeService::InstanceObserver<mojom::ProcessInstance>, |
| 25 public mojom::MetricsHost { |
| 24 public: | 26 public: |
| 25 explicit ArcMetricsService(ArcBridgeService* bridge_service); | 27 explicit ArcMetricsService(ArcBridgeService* bridge_service); |
| 26 ~ArcMetricsService() override; | 28 ~ArcMetricsService() override; |
| 27 | 29 |
| 28 // ArcBridgeService::Observer overrides. | 30 // ArcBridgeService::InstanceObserver<mojom::MetricsInstance> overrides. |
| 29 void OnMetricsInstanceReady() override; | 31 void OnInstanceReady(mojom::MetricsInstance*, uint32_t version) override; |
| 30 void OnMetricsInstanceClosed() override; | 32 void OnInstanceClosed(mojom::MetricsInstance*) override; |
| 31 void OnProcessInstanceReady() override; | 33 |
| 32 void OnProcessInstanceClosed() override; | 34 // ArcBridgeService::InstanceObserver<mojom::ProcessInstance> overrides. |
| 35 void OnInstanceReady(mojom::ProcessInstance*, uint32_t version) override; |
| 36 void OnInstanceClosed(mojom::ProcessInstance*) override; |
| 33 | 37 |
| 34 // MetricsHost overrides. | 38 // MetricsHost overrides. |
| 35 void ReportBootProgress( | 39 void ReportBootProgress( |
| 36 mojo::Array<arc::mojom::BootProgressEventPtr> events) override; | 40 mojo::Array<arc::mojom::BootProgressEventPtr> events) override; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 bool CalledOnValidThread(); | 43 bool CalledOnValidThread(); |
| 40 void RequestProcessList(); | 44 void RequestProcessList(); |
| 41 void ParseProcessList( | 45 void ParseProcessList( |
| 42 mojo::Array<arc::mojom::RunningAppProcessInfoPtr> processes); | 46 mojo::Array<arc::mojom::RunningAppProcessInfoPtr> processes); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 | 60 |
| 57 // Always keep this the last member of this class to make sure it's the | 61 // Always keep this the last member of this class to make sure it's the |
| 58 // first thing to be destructed. | 62 // first thing to be destructed. |
| 59 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; | 63 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; |
| 60 | 64 |
| 61 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); | 65 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); |
| 62 }; | 66 }; |
| 63 | 67 |
| 64 } // namespace arc | 68 } // namespace arc |
| 65 | 69 |
| 66 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H | 70 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_ |
| OLD | NEW |