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

Unified Diff: chrome/browser/resource_coordinator/tab_manager.cc

Issue 2930013005: [Tab Metrics] Measure FP, FCP and FMP for Foreground Tab during Session Restore (Closed)
Patch Set: Add RemoveFromWebContents() to RestoreOrigin. Created 3 years, 5 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
Index: chrome/browser/resource_coordinator/tab_manager.cc
diff --git a/chrome/browser/resource_coordinator/tab_manager.cc b/chrome/browser/resource_coordinator/tab_manager.cc
index 7332949cbdacd598ba3f6665fb179a7af6a3ae0e..846d73c0a561ed81bcab7e826da259044e033545 100644
--- a/chrome/browser/resource_coordinator/tab_manager.cc
+++ b/chrome/browser/resource_coordinator/tab_manager.cc
@@ -155,6 +155,7 @@ TabManager::TabManager()
browser_tab_strip_tracker_(this, nullptr, this),
test_tick_clock_(nullptr),
is_session_restore_loading_tabs_(false),
+ initial_session_restore_foreground_tab_changed_(false),
force_load_timer_(base::MakeUnique<base::OneShotTimer>()),
weak_ptr_factory_(this) {
#if defined(OS_CHROMEOS)
@@ -515,6 +516,9 @@ int64_t TabManager::IdFromWebContents(WebContents* web_contents) {
void TabManager::OnSessionRestoreStartedLoadingTabs() {
DCHECK(!is_session_restore_loading_tabs_);
is_session_restore_loading_tabs_ = true;
+
+ // Needs to reset this flag for each session restore.
+ initial_session_restore_foreground_tab_changed_ = false;
}
void TabManager::OnSessionRestoreFinishedLoadingTabs() {
@@ -887,6 +891,15 @@ void TabManager::ActiveTabChanged(content::WebContents* old_contents,
}
ResumeTabNavigationIfNeeded(new_contents);
+
+ if (old_contents && !initial_session_restore_foreground_tab_changed_) {
+ RestoreOrigin* restore_origin =
+ RestoreOrigin::FromWebContents(old_contents);
+ if (restore_origin &&
+ restore_origin->type() == RestoreOrigin::Type::SESSION_RESTORE) {
+ initial_session_restore_foreground_tab_changed_ = true;
+ }
+ }
}
void TabManager::TabInsertedAt(TabStripModel* tab_strip_model,

Powered by Google App Engine
This is Rietveld 408576698