• Francois Doray's avatar
    [metrics] Start loading visible tabs before creating FirstWebContentsProfiler. · 47b6798d
    Francois Doray authored
    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: I26f1a1a7cfa73cf95a3bdb32a83bf2dc1722d3f6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976500Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
    Commit-Queue: François Doray <fdoray@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#731969}
    47b6798d
web_contents_sizer.h 698 Bytes