| 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/arc_low_memory_killer_monitor.h" |
| 15 | 16 |
| 16 namespace arc { | 17 namespace arc { |
| 17 | 18 |
| 18 // Collects information from other ArcServices and send UMA metrics. | 19 // Collects information from other ArcServices and send UMA metrics. |
| 19 class ArcMetricsService : public ArcService, | 20 class ArcMetricsService : public ArcService, |
| 20 public ArcBridgeService::Observer { | 21 public ArcBridgeService::Observer { |
| 21 public: | 22 public: |
| 22 explicit ArcMetricsService(ArcBridgeService* bridge_service); | 23 explicit ArcMetricsService(ArcBridgeService* bridge_service); |
| 23 ~ArcMetricsService() override; | 24 ~ArcMetricsService() override; |
| 24 | 25 |
| 25 // ArcBridgeService::Observer overrides. | 26 // ArcBridgeService::Observer overrides. |
| 26 void OnProcessInstanceReady() override; | 27 void OnProcessInstanceReady() override; |
| 27 void OnProcessInstanceClosed() override; | 28 void OnProcessInstanceClosed() override; |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 bool CalledOnValidThread(); | 31 bool CalledOnValidThread(); |
| 31 void RequestProcessList(); | 32 void RequestProcessList(); |
| 32 void ParseProcessList(mojo::Array<arc::RunningAppProcessInfoPtr> processes); | 33 void ParseProcessList(mojo::Array<arc::RunningAppProcessInfoPtr> processes); |
| 33 | 34 |
| 34 base::ThreadChecker thread_checker_; | 35 base::ThreadChecker thread_checker_; |
| 35 base::RepeatingTimer timer_; | 36 base::RepeatingTimer timer_; |
| 36 | 37 |
| 38 ArcLowMemoryKillerMonitor low_memory_killer_minotor_; |
| 39 |
| 37 // Always keep this the last member of this class to make sure it's the | 40 // Always keep this the last member of this class to make sure it's the |
| 38 // first thing to be destructed. | 41 // first thing to be destructed. |
| 39 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; | 42 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; |
| 40 | 43 |
| 41 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); | 44 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 } // namespace arc | 47 } // namespace arc |
| 45 | 48 |
| 46 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H | 49 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H |
| OLD | NEW |