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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 212403002: Add UMA stats for SharedWorker in RenderProcessHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 0fdf90c9fd784d2c53221a418a77df2d53b8fc33..a0f5a94d82be4d738e1eb12d804043916ae7c7a7 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1285,8 +1285,11 @@ bool RenderProcessHostImpl::FastShutdownIfPossible() {
if (!SuddenTerminationAllowed())
return false;
- if (worker_ref_count_ != 0)
+ if (worker_ref_count_ != 0) {
+ if (survive_for_worker_start_time_.is_null())
+ survive_for_worker_start_time_ = base::TimeTicks::Now();
return false;
+ }
// Set this before ProcessDied() so observers can tell if the render process
// died due to fast shutdown versus another cause.
@@ -1511,8 +1514,19 @@ void RenderProcessHostImpl::Cleanup() {
}
delayed_cleanup_needed_ = false;
+ // Records the time when the process starts surviving for workers for UMA.
+ if (listeners_.IsEmpty() && worker_ref_count_ > 0 &&
+ survive_for_worker_start_time_.is_null()) {
+ survive_for_worker_start_time_ = base::TimeTicks::Now();
+ }
+
// When there are no other owners of this object, we can delete ourselves.
if (listeners_.IsEmpty() && worker_ref_count_ == 0) {
+ if (!survive_for_worker_start_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES(
+ "SharedWorker.RendererSurviveForWorkerTime",
+ base::TimeTicks::Now() - survive_for_worker_start_time_);
+ }
// We cannot clean up twice; if this fails, there is an issue with our
// control flow.
DCHECK(!deleting_soon_);
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698