Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: components/arc/metrics/arc_metrics_service.cc

Issue 1885683005: Add module suffix in .mojom files for components/arc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/metrics/arc_metrics_service.h ('k') | components/arc/net/arc_net_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 this, 42 this,
43 &ArcMetricsService::RequestProcessList); 43 &ArcMetricsService::RequestProcessList);
44 } 44 }
45 45
46 void ArcMetricsService::OnProcessInstanceClosed() { 46 void ArcMetricsService::OnProcessInstanceClosed() {
47 VLOG(2) << "Stop updating process list."; 47 VLOG(2) << "Stop updating process list.";
48 timer_.Stop(); 48 timer_.Stop();
49 } 49 }
50 50
51 void ArcMetricsService::RequestProcessList() { 51 void ArcMetricsService::RequestProcessList() {
52 ProcessInstance* process_instance = 52 mojom::ProcessInstance* process_instance =
53 arc_bridge_service()->process_instance(); 53 arc_bridge_service()->process_instance();
54 if (!process_instance) { 54 if (!process_instance) {
55 LOG(ERROR) << "No process instance found before RequestProcessList"; 55 LOG(ERROR) << "No process instance found before RequestProcessList";
56 return; 56 return;
57 } 57 }
58 58
59 VLOG(2) << "RequestProcessList"; 59 VLOG(2) << "RequestProcessList";
60 process_instance->RequestProcessList( 60 process_instance->RequestProcessList(
61 base::Bind(&ArcMetricsService::ParseProcessList, 61 base::Bind(&ArcMetricsService::ParseProcessList,
62 weak_ptr_factory_.GetWeakPtr())); 62 weak_ptr_factory_.GetWeakPtr()));
63 } 63 }
64 64
65 void ArcMetricsService::ParseProcessList( 65 void ArcMetricsService::ParseProcessList(
66 mojo::Array<arc::RunningAppProcessInfoPtr> processes) { 66 mojo::Array<arc::mojom::RunningAppProcessInfoPtr> processes) {
67 int running_app_count = 0; 67 int running_app_count = 0;
68 for (const auto& process : processes) { 68 for (const auto& process : processes) {
69 const mojo::String& process_name = process->process_name; 69 const mojo::String& process_name = process->process_name;
70 const ProcessState& process_state = process->process_state; 70 const mojom::ProcessState& process_state = process->process_state;
71 71
72 // Processes like the ARC launcher and intent helper are always running 72 // Processes like the ARC launcher and intent helper are always running
73 // and not counted as apps running by users. With the same reasoning, 73 // and not counted as apps running by users. With the same reasoning,
74 // GMS (Google Play Services) and its related processes are skipped as 74 // GMS (Google Play Services) and its related processes are skipped as
75 // well. The process_state check below filters out system processes, 75 // well. The process_state check below filters out system processes,
76 // services, apps that are cached because they've run before. 76 // services, apps that are cached because they've run before.
77 if (base::StartsWith(process_name.get(), kArcProcessNamePrefix, 77 if (base::StartsWith(process_name.get(), kArcProcessNamePrefix,
78 base::CompareCase::SENSITIVE) || 78 base::CompareCase::SENSITIVE) ||
79 base::StartsWith(process_name.get(), kGmsProcessNamePrefix, 79 base::StartsWith(process_name.get(), kGmsProcessNamePrefix,
80 base::CompareCase::SENSITIVE) || 80 base::CompareCase::SENSITIVE) ||
81 process_state != ProcessState::TOP) { 81 process_state != mojom::ProcessState::TOP) {
82 VLOG(2) << "Skipped " << process_name << " " << process_state; 82 VLOG(2) << "Skipped " << process_name << " " << process_state;
83 } else { 83 } else {
84 ++running_app_count; 84 ++running_app_count;
85 } 85 }
86 } 86 }
87 87
88 UMA_HISTOGRAM_COUNTS_100("Arc.AppCount", running_app_count); 88 UMA_HISTOGRAM_COUNTS_100("Arc.AppCount", running_app_count);
89 } 89 }
90 90
91 } // namespace arc 91 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/metrics/arc_metrics_service.h ('k') | components/arc/net/arc_net_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698