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

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 10831308: Revert 151036 - Speculative revert to see if this change introduced a performance regression on Mac… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 void TabLoader::LoadNextTab() { 261 void TabLoader::LoadNextTab() {
262 if (!tabs_to_load_.empty()) { 262 if (!tabs_to_load_.empty()) {
263 NavigationController* tab = tabs_to_load_.front(); 263 NavigationController* tab = tabs_to_load_.front();
264 DCHECK(tab); 264 DCHECK(tab);
265 tabs_loading_.insert(tab); 265 tabs_loading_.insert(tab);
266 if (tabs_loading_.size() > max_parallel_tab_loads_) 266 if (tabs_loading_.size() > max_parallel_tab_loads_)
267 max_parallel_tab_loads_ = tabs_loading_.size(); 267 max_parallel_tab_loads_ = tabs_loading_.size();
268 tabs_to_load_.pop_front(); 268 tabs_to_load_.pop_front();
269 tab->LoadIfNecessary(); 269 tab->LoadIfNecessary();
270 if (tab->GetWebContents()) { 270 content::WebContents* contents = tab->GetWebContents();
271 int tab_index; 271 if (contents) {
272 Browser* browser = browser::FindBrowserForController(tab, &tab_index); 272 Browser* browser = browser::FindBrowserWithWebContents(contents);
273 if (browser && browser->active_index() != tab_index) { 273 if (browser && chrome::GetActiveWebContents(browser) != contents) {
274 // By default tabs are marked as visible. As only the active tab is 274 // By default tabs are marked as visible. As only the active tab is
275 // visible we need to explicitly tell non-active tabs they are hidden. 275 // visible we need to explicitly tell non-active tabs they are hidden.
276 // Without this call non-active tabs are not marked as backgrounded. 276 // Without this call non-active tabs are not marked as backgrounded.
277 // 277 //
278 // NOTE: We need to do this here rather than when the tab is added to 278 // NOTE: We need to do this here rather than when the tab is added to
279 // the Browser as at that time not everything has been created, so that 279 // the Browser as at that time not everything has been created, so that
280 // the call would do nothing. 280 // the call would do nothing.
281 tab->GetWebContents()->WasHidden(); 281 contents->WasHidden();
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 if (!tabs_to_load_.empty()) { 286 if (!tabs_to_load_.empty()) {
287 force_load_timer_.Stop(); 287 force_load_timer_.Stop();
288 // Each time we load a tab we also set a timer to force us to start loading 288 // Each time we load a tab we also set a timer to force us to start loading
289 // the next tab if this one doesn't load quickly enough. 289 // the next tab if this one doesn't load quickly enough.
290 force_load_timer_.Start(FROM_HERE, 290 force_load_timer_.Start(FROM_HERE,
291 base::TimeDelta::FromMilliseconds(force_load_delay_), 291 base::TimeDelta::FromMilliseconds(force_load_delay_),
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 if (active_session_restorers == NULL) 1102 if (active_session_restorers == NULL)
1103 return false; 1103 return false;
1104 for (std::set<SessionRestoreImpl*>::const_iterator it = 1104 for (std::set<SessionRestoreImpl*>::const_iterator it =
1105 active_session_restorers->begin(); 1105 active_session_restorers->begin();
1106 it != active_session_restorers->end(); ++it) { 1106 it != active_session_restorers->end(); ++it) {
1107 if ((*it)->profile() == profile) 1107 if ((*it)->profile() == profile)
1108 return true; 1108 return true;
1109 } 1109 }
1110 return false; 1110 return false;
1111 } 1111 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/sessions/tab_restore_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698