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

Side by Side Diff: chrome/browser/metrics/first_web_contents_profiler.cc

Issue 2913423003: Refactor recording of the Startup.FirstWebContents.RenderProcessHostInit.ToNonEmptyPaint metric
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/metrics/first_web_contents_profiler.h" 5 #include "chrome/browser/metrics/first_web_contents_profiler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void FirstWebContentsProfiler::DidFirstVisuallyNonEmptyPaint() { 101 void FirstWebContentsProfiler::DidFirstVisuallyNonEmptyPaint() {
102 if (collected_paint_metric_) 102 if (collected_paint_metric_)
103 return; 103 return;
104 if (startup_metric_utils::WasMainWindowStartupInterrupted()) { 104 if (startup_metric_utils::WasMainWindowStartupInterrupted()) {
105 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI); 105 FinishedCollectingMetrics(FinishReason::ABANDON_BLOCKING_UI);
106 return; 106 return;
107 } 107 }
108 108
109 collected_paint_metric_ = true; 109 collected_paint_metric_ = true;
110 startup_metric_utils::RecordFirstWebContentsNonEmptyPaint( 110 startup_metric_utils::RecordFirstWebContentsNonEmptyPaint(
111 base::TimeTicks::Now(), web_contents() 111 base::TimeTicks::Now());
112 ->GetMainFrame()
113 ->GetProcess()
114 ->GetInitTimeForNavigationMetrics());
115 112
116 metrics::TrackingSynchronizer::OnProfilingPhaseCompleted( 113 metrics::TrackingSynchronizer::OnProfilingPhaseCompleted(
117 metrics::ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT); 114 metrics::ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT);
118 115
119 if (IsFinishedCollectingMetrics()) 116 if (IsFinishedCollectingMetrics())
120 FinishedCollectingMetrics(FinishReason::DONE); 117 FinishedCollectingMetrics(FinishReason::DONE);
121 } 118 }
122 119
123 void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() { 120 void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() {
124 if (collected_load_metric_) 121 if (collected_load_metric_)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 const bool single_tab = browser_list->size() == 1 && tab_strip->count() == 1; 251 const bool single_tab = browser_list->size() == 1 && tab_strip->count() == 1;
255 252
256 // FirstWebContentsProfiler owns itself and is also bound to 253 // FirstWebContentsProfiler owns itself and is also bound to
257 // |web_contents|'s lifetime by observing WebContentsDestroyed(). 254 // |web_contents|'s lifetime by observing WebContentsDestroyed().
258 new FirstWebContentsProfiler(web_contents, 255 new FirstWebContentsProfiler(web_contents,
259 single_tab ? WebContentsWorkload::SINGLE_TAB 256 single_tab ? WebContentsWorkload::SINGLE_TAB
260 : WebContentsWorkload::MULTI_TABS); 257 : WebContentsWorkload::MULTI_TABS);
261 } 258 }
262 259
263 } // namespace metrics 260 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698