Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 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 weak_ptr_factory_(this) { | 31 weak_ptr_factory_(this) { |
| 32 arc_bridge_service()->metrics()->AddObserver(this); | 32 arc_bridge_service()->metrics()->AddObserver(this); |
| 33 arc_bridge_service()->process()->AddObserver(&process_observer_); | 33 arc_bridge_service()->process()->AddObserver(&process_observer_); |
| 34 oom_kills_monitor_.Start(); | 34 oom_kills_monitor_handle_ = OomKillsMonitor::StartMonitoring(); |
|
Luis Héctor Chávez
2016/07/29 21:48:45
Can this be initialized in the initializer list?
gab
2016/08/01 15:15:02
Done.
| |
| 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 |