| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::TimeDelta::FromMinutes(kRequestProcessListPeriodInMinutes), | 68 base::TimeDelta::FromMinutes(kRequestProcessListPeriodInMinutes), |
| 69 this, &ArcMetricsService::RequestProcessList); | 69 this, &ArcMetricsService::RequestProcessList); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ArcMetricsService::OnProcessInstanceClosed() { | 72 void ArcMetricsService::OnProcessInstanceClosed() { |
| 73 VLOG(2) << "Stop updating process list."; | 73 VLOG(2) << "Stop updating process list."; |
| 74 timer_.Stop(); | 74 timer_.Stop(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ArcMetricsService::RequestProcessList() { | 77 void ArcMetricsService::RequestProcessList() { |
| 78 mojom::ProcessInstance* process_instance = | 78 mojom::ProcessInstance* process_instance = GET_INSTANCE_FOR_METHOD( |
| 79 arc_bridge_service()->process()->GetInstanceForMethod( | 79 arc_bridge_service()->process(), RequestProcessList); |
| 80 "RequestProcessList"); | |
| 81 if (!process_instance) | 80 if (!process_instance) |
| 82 return; | 81 return; |
| 83 VLOG(2) << "RequestProcessList"; | 82 VLOG(2) << "RequestProcessList"; |
| 84 process_instance->RequestProcessList(base::Bind( | 83 process_instance->RequestProcessList(base::Bind( |
| 85 &ArcMetricsService::ParseProcessList, weak_ptr_factory_.GetWeakPtr())); | 84 &ArcMetricsService::ParseProcessList, weak_ptr_factory_.GetWeakPtr())); |
| 86 } | 85 } |
| 87 | 86 |
| 88 void ArcMetricsService::ParseProcessList( | 87 void ArcMetricsService::ParseProcessList( |
| 89 std::vector<mojom::RunningAppProcessInfoPtr> processes) { | 88 std::vector<mojom::RunningAppProcessInfoPtr> processes) { |
| 90 int running_app_count = 0; | 89 int running_app_count = 0; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 113 | 112 |
| 114 void ArcMetricsService::OnArcStartTimeRetrieved( | 113 void ArcMetricsService::OnArcStartTimeRetrieved( |
| 115 bool success, | 114 bool success, |
| 116 base::TimeTicks arc_start_time) { | 115 base::TimeTicks arc_start_time) { |
| 117 DCHECK(CalledOnValidThread()); | 116 DCHECK(CalledOnValidThread()); |
| 118 if (!success) { | 117 if (!success) { |
| 119 LOG(ERROR) << "Failed to retrieve ARC start timeticks."; | 118 LOG(ERROR) << "Failed to retrieve ARC start timeticks."; |
| 120 return; | 119 return; |
| 121 } | 120 } |
| 122 auto* instance = | 121 auto* instance = |
| 123 arc_bridge_service()->metrics()->GetInstanceForMethod("Init"); | 122 GET_INSTANCE_FOR_METHOD(arc_bridge_service()->metrics(), Init); |
| 124 if (!instance) | 123 if (!instance) |
| 125 return; | 124 return; |
| 126 | 125 |
| 127 // The binding of host interface is deferred until the ARC start time is | 126 // The binding of host interface is deferred until the ARC start time is |
| 128 // retrieved here because it prevents race condition of the ARC start | 127 // retrieved here because it prevents race condition of the ARC start |
| 129 // time availability in ReportBootProgress(). | 128 // time availability in ReportBootProgress(). |
| 130 if (!binding_.is_bound()) { | 129 if (!binding_.is_bound()) { |
| 131 mojom::MetricsHostPtr host_ptr; | 130 mojom::MetricsHostPtr host_ptr; |
| 132 binding_.Bind(mojo::MakeRequest(&host_ptr)); | 131 binding_.Bind(mojo::MakeRequest(&host_ptr)); |
| 133 instance->Init(std::move(host_ptr)); | 132 instance->Init(std::move(host_ptr)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 167 |
| 169 void ArcMetricsService::ProcessObserver::OnInstanceReady() { | 168 void ArcMetricsService::ProcessObserver::OnInstanceReady() { |
| 170 arc_metrics_service_->OnProcessInstanceReady(); | 169 arc_metrics_service_->OnProcessInstanceReady(); |
| 171 } | 170 } |
| 172 | 171 |
| 173 void ArcMetricsService::ProcessObserver::OnInstanceClosed() { | 172 void ArcMetricsService::ProcessObserver::OnInstanceClosed() { |
| 174 arc_metrics_service_->OnProcessInstanceClosed(); | 173 arc_metrics_service_->OnProcessInstanceClosed(); |
| 175 } | 174 } |
| 176 | 175 |
| 177 } // namespace arc | 176 } // namespace arc |
| OLD | NEW |