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..53e26cb45ae48231b701d5fa67bd2fa825eefc52 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_)); |
+ // If |old_contents| isn't set, we didn't switch from anything, so don't |
+ // record it. |
+ RecordSwitchToTab(new_contents); |
} |
} |
@@ -943,4 +946,16 @@ std::vector<TabManager::BrowserInfo> TabManager::GetBrowserInfoList() const { |
return browser_info_list; |
} |
+void TabManager::RecordSwitchToTab(content::WebContents* contents) const { |
+ // TODO(shaseley): Change this test when the TabManager knows if we're in a |
+ // background tab loading state. In that case, we'll want a separate metric |
+ // for that case, and no metrics reported if we are simulaneously in session |
+ // restore and background tab loading. |
fmeawad
2017/06/27 21:22:02
nit: This TODO is implicit from the TODOs in the h
shaseley
2017/06/27 23:22:10
OK, that makes sense, I'll remove this comment.
|
+ if (is_session_restore_loading_tabs_) { |
+ UMA_HISTOGRAM_ENUMERATION("TabManager.SessionRestore.SwitchToTab", |
+ GetWebContentsData(contents)->tab_loading_state(), |
+ TAB_LOADING_STATE_MAX); |
+ } |
+} |
+ |
} // namespace resource_coordinator |