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

Side by Side Diff: chrome/browser/resource_coordinator/tab_manager.cc

Issue 2962773002: [Tab Metrics] Added TabManager.SessionRestore.SwitchToTab UMA. (Closed)
Patch Set: Remove gratuitous TODOs 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/resource_coordinator/tab_manager.h" 5 #include "chrome/browser/resource_coordinator/tab_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 GetWebContentsData(new_contents)->SetDiscardState(false); 822 GetWebContentsData(new_contents)->SetDiscardState(false);
823 // When ActiveTabChanged, |new_contents| purged state changes to be false. 823 // When ActiveTabChanged, |new_contents| purged state changes to be false.
824 GetWebContentsData(new_contents)->set_is_purged(false); 824 GetWebContentsData(new_contents)->set_is_purged(false);
825 // If |old_contents| is set, that tab has switched from being active to 825 // If |old_contents| is set, that tab has switched from being active to
826 // inactive, so record the time of that transition. 826 // inactive, so record the time of that transition.
827 if (old_contents) { 827 if (old_contents) {
828 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks()); 828 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks());
829 // Re-setting time-to-purge every time a tab becomes inactive. 829 // Re-setting time-to-purge every time a tab becomes inactive.
830 GetWebContentsData(old_contents) 830 GetWebContentsData(old_contents)
831 ->set_time_to_purge(GetTimeToPurge(min_time_to_purge_)); 831 ->set_time_to_purge(GetTimeToPurge(min_time_to_purge_));
832 // If |old_contents| isn't set, we didn't switch from anything, so don't
833 // record it.
zhenw 2017/06/29 15:44:00 nit: The comment here is describing the case where
shaseley 2017/06/29 16:20:50 Done, I changed the comment.
834 RecordSwitchToTab(new_contents);
832 } 835 }
833 } 836 }
834 837
835 void TabManager::TabInsertedAt(TabStripModel* tab_strip_model, 838 void TabManager::TabInsertedAt(TabStripModel* tab_strip_model,
836 content::WebContents* contents, 839 content::WebContents* contents,
837 int index, 840 int index,
838 bool foreground) { 841 bool foreground) {
839 // Only interested in background tabs, as foreground tabs get taken care of by 842 // Only interested in background tabs, as foreground tabs get taken care of by
840 // ActiveTabChanged. 843 // ActiveTabChanged.
841 if (foreground) 844 if (foreground)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 browser_info.window_is_active = browser->window()->IsActive(); 939 browser_info.window_is_active = browser->window()->IsActive();
937 browser_info.window_is_minimized = browser->window()->IsMinimized(); 940 browser_info.window_is_minimized = browser->window()->IsMinimized();
938 browser_info.window_bounds = browser->window()->GetBounds(); 941 browser_info.window_bounds = browser->window()->GetBounds();
939 browser_info.browser_is_app = browser->is_app(); 942 browser_info.browser_is_app = browser->is_app();
940 browser_info_list.push_back(browser_info); 943 browser_info_list.push_back(browser_info);
941 } 944 }
942 945
943 return browser_info_list; 946 return browser_info_list;
944 } 947 }
945 948
949 void TabManager::RecordSwitchToTab(content::WebContents* contents) const {
950 if (is_session_restore_loading_tabs_) {
951 UMA_HISTOGRAM_ENUMERATION("TabManager.SessionRestore.SwitchToTab",
952 GetWebContentsData(contents)->tab_loading_state(),
953 TAB_LOADING_STATE_MAX);
954 }
955 }
956
946 } // namespace resource_coordinator 957 } // namespace resource_coordinator
OLDNEW
« no previous file with comments | « chrome/browser/resource_coordinator/tab_manager.h ('k') | chrome/browser/resource_coordinator/tab_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698