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

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

Issue 1637943003: Remove HostDesktopType from BrowserList::GetInstance() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen-wrapper-land
Patch Set: mac2 Created 4 years, 11 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
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager.cc
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index 7124a5c13dc1a74f8caeb87d4c915b63d2f4f2fd..ebcbe6400fda1cba478954593af32cfbf1ce6742 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -205,19 +205,8 @@ TabStatsList TabManager::GetTabStats() {
TabStatsList stats_list;
stats_list.reserve(32); // 99% of users have < 30 tabs open
- // Go through each window to get all the tabs. Depending on the platform,
- // windows are either native or ash or both. The goal is to make sure to go
- // through them all, starting with the active window first (use
- // chrome::GetActiveDesktop to get the current used type).
- AddTabStats(BrowserList::GetInstance(chrome::GetActiveDesktop()), true,
- &stats_list);
- if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_NATIVE) {
- AddTabStats(BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE),
- false, &stats_list);
- } else if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH) {
- AddTabStats(BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH), false,
- &stats_list);
- }
+ // Go through each window to get all the tabs.
+ AddTabStats(&stats_list);
// Sort the collected data so that least desirable to be killed is first, most
// desirable is last.
@@ -409,12 +398,10 @@ int TabManager::GetTabCount() const {
return tab_count;
}
-void TabManager::AddTabStats(BrowserList* browser_list,
- bool active_desktop,
- TabStatsList* stats_list) {
- // If it's the active desktop, the first window will be the active one.
- // Otherwise, assume no active windows.
- bool browser_active = active_desktop;
+void TabManager::AddTabStats(TabStatsList* stats_list) {
+ BrowserList* browser_list = BrowserList::GetInstance();
+ // The first window will be the active one.
+ bool browser_active = true;
for (BrowserList::const_reverse_iterator browser_iterator =
browser_list->begin_last_active();
browser_iterator != browser_list->end_last_active();
@@ -460,8 +447,7 @@ void TabManager::UpdateTimerCallback() {
if (g_browser_process->IsShuttingDown())
return;
- if (BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH)->empty() &&
- BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty())
+ if (BrowserList::GetInstance()->empty())
return;
// Check for a discontinuity in time caused by the machine being suspended.
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698