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

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

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 Browser* Restore() { 448 Browser* Restore() {
449 SessionService* session_service = 449 SessionService* session_service =
450 SessionServiceFactory::GetForProfile(profile_); 450 SessionServiceFactory::GetForProfile(profile_);
451 DCHECK(session_service); 451 DCHECK(session_service);
452 session_service->GetLastSession( 452 session_service->GetLastSession(
453 &request_consumer_, 453 &request_consumer_,
454 base::Bind(&SessionRestoreImpl::OnGotSession, base::Unretained(this))); 454 base::Bind(&SessionRestoreImpl::OnGotSession, base::Unretained(this)));
455 455
456 if (synchronous_) { 456 if (synchronous_) {
457 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 457 {
458 MessageLoop::current()->SetNestableTasksAllowed(true); 458 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
459 MessageLoop::current()->Run(); 459 MessageLoop::current()->Run();
460 MessageLoop::current()->SetNestableTasksAllowed(old_state); 460 }
461 Browser* browser = ProcessSessionWindows(&windows_); 461 Browser* browser = ProcessSessionWindows(&windows_);
462 delete this; 462 delete this;
463 return browser; 463 return browser;
464 } 464 }
465 465
466 if (browser_) { 466 if (browser_) {
467 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, 467 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
468 content::Source<Browser>(browser_)); 468 content::Source<Browser>(browser_));
469 } 469 }
470 470
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (active_session_restorers == NULL) 934 if (active_session_restorers == NULL)
935 return false; 935 return false;
936 for (std::set<SessionRestoreImpl*>::const_iterator it = 936 for (std::set<SessionRestoreImpl*>::const_iterator it =
937 active_session_restorers->begin(); 937 active_session_restorers->begin();
938 it != active_session_restorers->end(); ++it) { 938 it != active_session_restorers->end(); ++it) {
939 if ((*it)->profile() == profile) 939 if ((*it)->profile() == profile)
940 return true; 940 return true;
941 } 941 }
942 return false; 942 return false;
943 } 943 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698