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 #include "components/arc/metrics/arc_metrics_service.h" | 5 #include "components/arc/metrics/arc_metrics_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const char kBootProgressEnableScreen[] = "boot_progress_enable_screen"; | 21 const char kBootProgressEnableScreen[] = "boot_progress_enable_screen"; |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace arc { | 25 namespace arc { |
26 | 26 |
27 ArcMetricsService::ArcMetricsService(ArcBridgeService* bridge_service) | 27 ArcMetricsService::ArcMetricsService(ArcBridgeService* bridge_service) |
28 : ArcService(bridge_service), | 28 : ArcService(bridge_service), |
29 binding_(this), | 29 binding_(this), |
30 process_observer_(this), | 30 process_observer_(this), |
| 31 oom_kills_monitor_handle_(OomKillsMonitor::StartMonitoring()), |
31 weak_ptr_factory_(this) { | 32 weak_ptr_factory_(this) { |
32 arc_bridge_service()->metrics()->AddObserver(this); | 33 arc_bridge_service()->metrics()->AddObserver(this); |
33 arc_bridge_service()->process()->AddObserver(&process_observer_); | 34 arc_bridge_service()->process()->AddObserver(&process_observer_); |
34 oom_kills_monitor_.Start(); | |
35 } | 35 } |
36 | 36 |
37 ArcMetricsService::~ArcMetricsService() { | 37 ArcMetricsService::~ArcMetricsService() { |
38 DCHECK(CalledOnValidThread()); | 38 DCHECK(CalledOnValidThread()); |
39 arc_bridge_service()->process()->RemoveObserver(&process_observer_); | 39 arc_bridge_service()->process()->RemoveObserver(&process_observer_); |
40 arc_bridge_service()->metrics()->RemoveObserver(this); | 40 arc_bridge_service()->metrics()->RemoveObserver(this); |
41 } | 41 } |
42 | 42 |
43 bool ArcMetricsService::CalledOnValidThread() { | 43 bool ArcMetricsService::CalledOnValidThread() { |
44 // Make sure access to the Chrome clipboard is happening in the UI thread. | 44 // Make sure access to the Chrome clipboard is happening in the UI thread. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 void ArcMetricsService::ProcessObserver::OnInstanceReady() { | 171 void ArcMetricsService::ProcessObserver::OnInstanceReady() { |
172 arc_metrics_service_->OnProcessInstanceReady(); | 172 arc_metrics_service_->OnProcessInstanceReady(); |
173 } | 173 } |
174 | 174 |
175 void ArcMetricsService::ProcessObserver::OnInstanceClosed() { | 175 void ArcMetricsService::ProcessObserver::OnInstanceClosed() { |
176 arc_metrics_service_->OnProcessInstanceClosed(); | 176 arc_metrics_service_->OnProcessInstanceClosed(); |
177 } | 177 } |
178 | 178 |
179 } // namespace arc | 179 } // namespace arc |
OLD | NEW |