| 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 <vector> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 11 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 12 #include "components/arc/arc_service.h" | 14 #include "components/arc/arc_service.h" |
| 13 #include "components/arc/common/metrics.mojom.h" | 15 #include "components/arc/common/metrics.mojom.h" |
| 14 #include "components/arc/common/process.mojom.h" | 16 #include "components/arc/common/process.mojom.h" |
| 15 #include "components/arc/instance_holder.h" | 17 #include "components/arc/instance_holder.h" |
| 16 #include "components/arc/metrics/oom_kills_monitor.h" | 18 #include "components/arc/metrics/oom_kills_monitor.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 // InstanceHolder<mojom::MetricsInstance>::Observer overrides. | 34 // InstanceHolder<mojom::MetricsInstance>::Observer overrides. |
| 33 void OnInstanceReady() override; | 35 void OnInstanceReady() override; |
| 34 void OnInstanceClosed() override; | 36 void OnInstanceClosed() override; |
| 35 | 37 |
| 36 // Implementations for InstanceHolder<mojom::ProcessInstance>::Observer. | 38 // Implementations for InstanceHolder<mojom::ProcessInstance>::Observer. |
| 37 void OnProcessInstanceReady(); | 39 void OnProcessInstanceReady(); |
| 38 void OnProcessInstanceClosed(); | 40 void OnProcessInstanceClosed(); |
| 39 | 41 |
| 40 // MetricsHost overrides. | 42 // MetricsHost overrides. |
| 41 void ReportBootProgress( | 43 void ReportBootProgress( |
| 42 mojo::Array<mojom::BootProgressEventPtr> events) override; | 44 std::vector<mojom::BootProgressEventPtr> events) override; |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 bool CalledOnValidThread(); | 47 bool CalledOnValidThread(); |
| 46 void RequestProcessList(); | 48 void RequestProcessList(); |
| 47 void ParseProcessList(mojo::Array<mojom::RunningAppProcessInfoPtr> processes); | 49 void ParseProcessList(std::vector<mojom::RunningAppProcessInfoPtr> processes); |
| 48 | 50 |
| 49 // DBus callbacks. | 51 // DBus callbacks. |
| 50 void OnArcStartTimeRetrieved(bool success, base::TimeTicks arc_start_time); | 52 void OnArcStartTimeRetrieved(bool success, base::TimeTicks arc_start_time); |
| 51 | 53 |
| 52 private: | 54 private: |
| 53 // Adapter to be able to also observe ProcessInstance events. | 55 // Adapter to be able to also observe ProcessInstance events. |
| 54 class ProcessObserver | 56 class ProcessObserver |
| 55 : public InstanceHolder<mojom::ProcessInstance>::Observer { | 57 : public InstanceHolder<mojom::ProcessInstance>::Observer { |
| 56 public: | 58 public: |
| 57 explicit ProcessObserver(ArcMetricsService* arc_metrics_service); | 59 explicit ProcessObserver(ArcMetricsService* arc_metrics_service); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 // Always keep this the last member of this class to make sure it's the | 80 // Always keep this the last member of this class to make sure it's the |
| 79 // first thing to be destructed. | 81 // first thing to be destructed. |
| 80 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; | 82 base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); | 84 DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace arc | 87 } // namespace arc |
| 86 | 88 |
| 87 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_ | 89 #endif // COMPONENTS_ARC_METRICS_ARC_METRICS_SERVICE_H_ |
| OLD | NEW |