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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2643723007: time metric: record elapsed time from when the backgrounded and purged renderer is foregrounded unti (Closed)
Patch Set: s/google.org/google.com/g Created 3 years, 11 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
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 1dcaaa6f25a0819ac9b32f3e6748c033b2c1c9cf..a43966ec8035e3f0460ca14c44ccc26aed9c73a3 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -896,6 +896,8 @@ void RenderThreadImpl::Init(
record_purge_suspend_growth_metric_closure_.Reset(
base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
base::Unretained(this)));
+ record_first_active_paint_ = true;
+ foregrounded_time_ = base::TimeTicks::Now();
base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
@@ -1653,6 +1655,7 @@ void RenderThreadImpl::OnProcessBackgrounded(bool backgrounded) {
record_purge_suspend_growth_metric_closure_.Reset(
base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics,
base::Unretained(this)));
+ foregrounded_time_ = base::TimeTicks::Now();
}
}
@@ -1679,6 +1682,7 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask(
FROM_HERE, record_purge_suspend_metric_closure_.callback(),
base::TimeDelta::FromSeconds(15));
+ record_first_active_paint_ = false;
}
// TODO(tasak): Replace the following GetMallocUsage() with memory-infra
@@ -2442,4 +2446,14 @@ void RenderThreadImpl::OnRendererInterfaceRequest(
renderer_binding_.Bind(std::move(request));
}
+void RenderThreadImpl::OnPostWidgetUpdateVisualState() {
+ if (record_first_active_paint_)
esprehn 2017/01/25 03:22:17 Can we put all of this code into RenderWidget inst
tasak 2017/01/26 09:39:40 I moved the code into RenderWidget.
+ return;
+
+ record_first_active_paint_ = true;
+ base::TimeDelta sample = base::TimeTicks::Now() - foregrounded_time_;
+ UMA_HISTOGRAM_TIMES("PurgeAndSuspend.Experimental.TimeToFirstActivePaint",
+ sample);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698