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

Unified Diff: components/arc/metrics/arc_metrics_service.cc

Issue 2357053002: Always use arc::InstanceHolder<T>::GetInstanceForMethod (Closed)
Patch Set: rebase, no code change Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/intent_helper/link_handler_model_impl.cc ('k') | components/arc/net/arc_net_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/metrics/arc_metrics_service.cc
diff --git a/components/arc/metrics/arc_metrics_service.cc b/components/arc/metrics/arc_metrics_service.cc
index 826f064740039dbd0ef4176b81d5c3c59ecbfabe..bb4cf9d8d402c86e3b8a989506a7ce57287e115b 100644
--- a/components/arc/metrics/arc_metrics_service.cc
+++ b/components/arc/metrics/arc_metrics_service.cc
@@ -76,12 +76,10 @@ void ArcMetricsService::OnProcessInstanceClosed() {
void ArcMetricsService::RequestProcessList() {
mojom::ProcessInstance* process_instance =
- arc_bridge_service()->process()->instance();
- if (!process_instance) {
- LOG(ERROR) << "No process instance found before RequestProcessList";
+ arc_bridge_service()->process()->GetInstanceForMethod(
+ "RequestProcessList");
+ if (!process_instance)
return;
- }
-
VLOG(2) << "RequestProcessList";
process_instance->RequestProcessList(base::Bind(
&ArcMetricsService::ParseProcessList, weak_ptr_factory_.GetWeakPtr()));
@@ -121,10 +119,10 @@ void ArcMetricsService::OnArcStartTimeRetrieved(
LOG(ERROR) << "Failed to retrieve ARC start timeticks.";
return;
}
- if (!arc_bridge_service()->metrics()->instance()) {
- LOG(ERROR) << "ARC metrics instance went away while retrieving start time.";
+ auto* instance =
+ arc_bridge_service()->metrics()->GetInstanceForMethod("Init");
+ if (!instance)
return;
- }
// The binding of host interface is deferred until the ARC start time is
// retrieved here because it prevents race condition of the ARC start
@@ -132,7 +130,7 @@ void ArcMetricsService::OnArcStartTimeRetrieved(
if (!binding_.is_bound()) {
mojom::MetricsHostPtr host_ptr;
binding_.Bind(mojo::GetProxy(&host_ptr));
- arc_bridge_service()->metrics()->instance()->Init(std::move(host_ptr));
+ instance->Init(std::move(host_ptr));
}
arc_start_time_ = arc_start_time;
VLOG(2) << "ARC start @" << arc_start_time_;
« no previous file with comments | « components/arc/intent_helper/link_handler_model_impl.cc ('k') | components/arc/net/arc_net_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698