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 122f6bd73eb70bc170bab67c512cbc4fa47f4678..8e06a04a0e89fa6157c6e22b2fcd4741b19bc406 100644 |
--- a/chrome/browser/resource_coordinator/tab_manager.cc |
+++ b/chrome/browser/resource_coordinator/tab_manager.cc |
@@ -829,6 +829,9 @@ void TabManager::ActiveTabChanged(content::WebContents* old_contents, |
// Re-setting time-to-purge every time a tab becomes inactive. |
GetWebContentsData(old_contents) |
->set_time_to_purge(GetTimeToPurge(min_time_to_purge_)); |
+ // Only record switch-to-tab metrics when a switch happens, i.e. |
+ // |old_contents| is set. |
+ RecordSwitchToTab(new_contents); |
} |
} |
@@ -943,4 +946,12 @@ std::vector<TabManager::BrowserInfo> TabManager::GetBrowserInfoList() const { |
return browser_info_list; |
} |
+void TabManager::RecordSwitchToTab(content::WebContents* contents) const { |
+ if (is_session_restore_loading_tabs_) { |
+ UMA_HISTOGRAM_ENUMERATION("TabManager.SessionRestore.SwitchToTab", |
+ GetWebContentsData(contents)->tab_loading_state(), |
+ TAB_LOADING_STATE_MAX); |
+ } |
+} |
+ |
} // namespace resource_coordinator |