OLD | NEW |
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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <malloc.h> | 8 #include <malloc.h> |
9 #else | 9 #else |
10 #include <alloca.h> | 10 #include <alloca.h> |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 Browser* Restore() { | 469 Browser* Restore() { |
470 SessionService* session_service = | 470 SessionService* session_service = |
471 SessionServiceFactory::GetForProfile(profile_); | 471 SessionServiceFactory::GetForProfile(profile_); |
472 DCHECK(session_service); | 472 DCHECK(session_service); |
473 session_service->GetLastSession( | 473 session_service->GetLastSession( |
474 &request_consumer_, | 474 &request_consumer_, |
475 base::Bind(&SessionRestoreImpl::OnGotSession, base::Unretained(this))); | 475 base::Bind(&SessionRestoreImpl::OnGotSession, base::Unretained(this))); |
476 | 476 |
477 if (synchronous_) { | 477 if (synchronous_) { |
478 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 478 { |
479 MessageLoop::current()->SetNestableTasksAllowed(true); | 479 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
480 MessageLoop::current()->Run(); | 480 MessageLoop::current()->Run(); |
481 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 481 } |
482 Browser* browser = ProcessSessionWindows(&windows_); | 482 Browser* browser = ProcessSessionWindows(&windows_); |
483 delete this; | 483 delete this; |
484 return browser; | 484 return browser; |
485 } | 485 } |
486 | 486 |
487 if (browser_) { | 487 if (browser_) { |
488 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, | 488 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
489 content::Source<Browser>(browser_)); | 489 content::Source<Browser>(browser_)); |
490 } | 490 } |
491 | 491 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 if (active_session_restorers == NULL) | 976 if (active_session_restorers == NULL) |
977 return false; | 977 return false; |
978 for (std::set<SessionRestoreImpl*>::const_iterator it = | 978 for (std::set<SessionRestoreImpl*>::const_iterator it = |
979 active_session_restorers->begin(); | 979 active_session_restorers->begin(); |
980 it != active_session_restorers->end(); ++it) { | 980 it != active_session_restorers->end(); ++it) { |
981 if ((*it)->profile() == profile) | 981 if ((*it)->profile() == profile) |
982 return true; | 982 return true; |
983 } | 983 } |
984 return false; | 984 return false; |
985 } | 985 } |
OLD | NEW |