| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "components/arc/metrics/arc_low_memory_killer_monitor.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 const int kRequestProcessListPeriodInMinutes = 5; | 14 const int kRequestProcessListPeriodInMinutes = 5; |
| 14 const char kArcProcessNamePrefix[] = "org.chromium.arc."; | 15 const char kArcProcessNamePrefix[] = "org.chromium.arc."; |
| 15 const char kGmsProcessNamePrefix[] = "com.google.android.gms"; | 16 const char kGmsProcessNamePrefix[] = "com.google.android.gms"; |
| 16 | 17 |
| 17 } // namespace | 18 } // namespace |
| 18 | 19 |
| 19 namespace arc { | 20 namespace arc { |
| 20 | 21 |
| 21 ArcMetricsService::ArcMetricsService(ArcBridgeService* bridge_service) | 22 ArcMetricsService::ArcMetricsService(ArcBridgeService* bridge_service) |
| 22 : ArcService(bridge_service), weak_ptr_factory_(this) { | 23 : ArcService(bridge_service), |
| 24 low_memory_killer_minotor_(new ArcLowMemoryKillerMonitor()), |
| 25 weak_ptr_factory_(this) { |
| 23 arc_bridge_service()->AddObserver(this); | 26 arc_bridge_service()->AddObserver(this); |
| 27 low_memory_killer_minotor_->Start(); |
| 24 } | 28 } |
| 25 | 29 |
| 26 ArcMetricsService::~ArcMetricsService() { | 30 ArcMetricsService::~ArcMetricsService() { |
| 27 DCHECK(CalledOnValidThread()); | 31 DCHECK(CalledOnValidThread()); |
| 28 arc_bridge_service()->RemoveObserver(this); | 32 arc_bridge_service()->RemoveObserver(this); |
| 29 } | 33 } |
| 30 | 34 |
| 31 bool ArcMetricsService::CalledOnValidThread() { | 35 bool ArcMetricsService::CalledOnValidThread() { |
| 32 // Make sure access to the Chrome clipboard is happening in the UI thread. | 36 // Make sure access to the Chrome clipboard is happening in the UI thread. |
| 33 return thread_checker_.CalledOnValidThread(); | 37 return thread_checker_.CalledOnValidThread(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 VLOG(2) << "Skipped " << process_name << " " << process_state; | 85 VLOG(2) << "Skipped " << process_name << " " << process_state; |
| 82 } else { | 86 } else { |
| 83 ++running_app_count; | 87 ++running_app_count; |
| 84 } | 88 } |
| 85 } | 89 } |
| 86 | 90 |
| 87 UMA_HISTOGRAM_COUNTS_100("Arc.AppCount", running_app_count); | 91 UMA_HISTOGRAM_COUNTS_100("Arc.AppCount", running_app_count); |
| 88 } | 92 } |
| 89 | 93 |
| 90 } // namespace arc | 94 } // namespace arc |
| OLD | NEW |