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

Unified Diff: chrome/browser/sessions/session_restore.cc

Issue 7274033: Fixes race condition that could lead to premature shutdown. When (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove FLAKY_ from test Created 9 years, 6 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/sessions/session_restore.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 8ea64e0ae1b49cf82db54d42c34f60a6cffc3ec9..8e30ddccaac6019ece35a628ef8ccb16470ebf58 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -15,6 +15,7 @@
#include "base/metrics/histogram.h"
#include "base/stl_util-inl.h"
#include "base/stringprintf.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_service.h"
@@ -421,6 +422,10 @@ class SessionRestoreImpl : public NotificationObserver {
always_create_tabbed_browser_(always_create_tabbed_browser),
urls_to_open_(urls_to_open),
restore_started_(base::TimeTicks::Now()) {
+ // When asynchronous its possible for there to be no windows. To make sure
+ // Chrome doesn't prematurely exit AddRef the process. We'll release in the
+ // destructor when restore is done.
+ g_browser_process->AddRefModule();
}
Browser* Restore() {
@@ -491,6 +496,7 @@ class SessionRestoreImpl : public NotificationObserver {
~SessionRestoreImpl() {
STLDeleteElements(&windows_);
restoring = false;
+ g_browser_process->ReleaseModule();
}
virtual void Observe(NotificationType type,
« no previous file with comments | « chrome/browser/sessions/session_restore.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698