Partial reland 1/2: [metrics] Start loading visible tabs before creating FirstWebContentsProfiler.
This is a partial reland of https://crrev.com/c/chromium/src/+/2062692. We confirmed that the CL affected startup metrics on Mac. However, our assessment is that the change is correct (restored tabs are painted before non-restored tabs more often). As a precaution, the original CL is split in two: - Start loading restored tabs earlier (this CL) - Enforce stricter requirements in FirstWebContentsProfiler (http://crrev.com/c/chromium/src/+/2097368) Original change description: On Windows, a visible restored tab starts loading in the following stack, before FirstWebContentsProfiler is created: content::NavigationControllerImpl::LoadIfNecessary content::NavigationControllerImpl::SetActive ... content::WebContentsImpl::UpdateWebContentsVisibility content::WebContentsViewAura::UpdateWebContentsVisibility ... BrowserView::Show SessionRestoreImpl::ShowBrowser SessionRestoreImpl::RestoreTab SessionRestoreImpl::RestoreTabsToBrowser SessionRestoreImpl::ProcessSessionWindows SessionRestoreImpl::ProcessSessionWindowsAndNotify SessionRestoreImpl::Restore SessionRestore::RestoreSession ... StartupBrowserCreator::Start ... content::BrowserMainLoop::PreMainMessageLoopRun On Mac, it starts loading in the following stack, after FirstWebContentsProfiler is created: content::NavigationControllerImpl::LoadIfNecessary content::NavigationControllerImpl::SetActive ... content::WebContentsImpl::UpdateWebContentsVisibility content::WebContentsViewMac::OnWindowVisibilityChanged -[WebContentsViewCocoa updateWebContentsVisibility] -[WebContentsViewCocoa windowChangedOcclusionState:] ... base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run ... ChromeBrowserMainParts::MainMessageLoopRun This prevents FirstWebContentsProfiler from having strict cross-platform expectations about events it observes. With this CL, we ensure that visible restored tab start loading in the following stack on all platforms: content::NavigationControllerImpl::LoadIfNecessary chrome::`anonymous namespace'::CreateRestoredTab chrome::AddRestoredTab ... SessionRestoreImpl::Restore SessionRestore::RestoreSession ... StartupBrowserCreator::Start ... content::BrowserMainLoop::PreMainMessageLoopRun This allows us to enforce strict cross-platform expectations about events observed by FirstWebContentsProfiler, and also have the nice benefits that navigation isn't delayed until we get a window visibility update during a Mac session restore. Bug: 1035419, 1020549, 1022492 Change-Id: I2964de553c0195ba94a35dc41d17c4a28cc5d05d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095970 Commit-Queue: François Doray <fdoray@chromium.org> Reviewed-by:Elly Fong-Jones <ellyjones@chromium.org> Cr-Commit-Position: refs/heads/master@{#749327}
Showing
Please register or sign in to comment