| Index: components/startup_metric_utils/browser/startup_metric_utils.cc
|
| diff --git a/components/startup_metric_utils/browser/startup_metric_utils.cc b/components/startup_metric_utils/browser/startup_metric_utils.cc
|
| index f1ad613d5df94bc95887beaafc255f963664c4c6..aebafa31622dbb9d46fde57d8d603425e89e222b 100644
|
| --- a/components/startup_metric_utils/browser/startup_metric_utils.cc
|
| +++ b/components/startup_metric_utils/browser/startup_metric_utils.cc
|
| @@ -39,7 +39,7 @@ namespace {
|
|
|
| // Mark as volatile to defensively make sure usage is thread-safe.
|
| // Note that at the time of this writing, access is only on the UI thread.
|
| -volatile bool g_non_browser_ui_displayed = false;
|
| +volatile bool g_main_window_startup_interrupted = false;
|
|
|
| base::LazyInstance<base::TimeTicks>::Leaky g_process_creation_ticks =
|
| LAZY_INSTANCE_INITIALIZER;
|
| @@ -557,12 +557,16 @@ void RegisterPrefs(PrefRegistrySimple* registry) {
|
| registry->RegisterIntegerPref(prefs::kSameVersionStartupCount, 0);
|
| }
|
|
|
| -bool WasNonBrowserUIDisplayed() {
|
| - return g_non_browser_ui_displayed;
|
| +bool WasMainWindowStartupInterrupted() {
|
| + return g_main_window_startup_interrupted;
|
| }
|
|
|
| void SetNonBrowserUIDisplayed() {
|
| - g_non_browser_ui_displayed = true;
|
| + g_main_window_startup_interrupted = true;
|
| +}
|
| +
|
| +void SetBackgroundModeEnabled() {
|
| + g_main_window_startup_interrupted = true;
|
| }
|
|
|
| void RecordStartupProcessCreationTime(const base::Time& time) {
|
| @@ -662,7 +666,8 @@ void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) {
|
| if (!is_first_call || ticks.is_null())
|
| return;
|
| is_first_call = false;
|
| - if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| return;
|
|
|
| UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT(
|
| @@ -692,7 +697,8 @@ void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks) {
|
| if (!is_first_call || ticks.is_null())
|
| return;
|
| is_first_call = false;
|
| - if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| return;
|
|
|
| UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT(
|
| @@ -710,7 +716,8 @@ void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks) {
|
| // entry time and the startup temperature are known.
|
| RecordRendererMainEntryHistogram();
|
|
|
| - if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| return;
|
|
|
| base::StackSamplingProfiler::SetProcessMilestone(
|
| @@ -726,7 +733,8 @@ void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks,
|
| if (!is_first_call || ticks.is_null())
|
| return;
|
| is_first_call = false;
|
| - if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| return;
|
|
|
| base::StackSamplingProfiler::SetProcessMilestone(
|
| @@ -758,7 +766,8 @@ void RecordFirstWebContentsMainNavigationFinished(
|
| if (!is_first_call || ticks.is_null())
|
| return;
|
| is_first_call = false;
|
| - if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null())
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| return;
|
|
|
| base::StackSamplingProfiler::SetProcessMilestone(
|
| @@ -769,6 +778,35 @@ void RecordFirstWebContentsMainNavigationFinished(
|
| g_process_creation_ticks.Get(), ticks);
|
| }
|
|
|
| +void RecordBrowserViewFirstPaint(const base::TimeTicks& ticks) {
|
| + static bool is_first_call = true;
|
| + if (!is_first_call || ticks.is_null())
|
| + return;
|
| + is_first_call = false;
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| + return;
|
| +
|
| + UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE(
|
| + UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserView.FirstPaint",
|
| + ticks - g_process_creation_ticks.Get());
|
| +}
|
| +
|
| +void RecordBrowserViewFirstPaintCompositingEnded(const base::TimeTicks& ticks) {
|
| + static bool is_first_call = true;
|
| + if (!is_first_call || ticks.is_null())
|
| + return;
|
| + is_first_call = false;
|
| + if (WasMainWindowStartupInterrupted() ||
|
| + g_process_creation_ticks.Get().is_null())
|
| + return;
|
| +
|
| + UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE(
|
| + UMA_HISTOGRAM_LONG_TIMES_100,
|
| + "Startup.BrowserView.FirstPaint.CompositingEnded",
|
| + g_process_creation_ticks.Get(), ticks);
|
| +}
|
| +
|
| base::TimeTicks MainEntryPointTicks() {
|
| return g_browser_main_entry_point_ticks.Get();
|
| }
|
|
|