Index: chrome/browser/ui/browser_init.cc |
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc |
index ecb78e4a4e607e4787414b5510db5d736aa6e751..a6555eb4219373c8def171617542824735495565 100644 |
--- a/chrome/browser/ui/browser_init.cc |
+++ b/chrome/browser/ui/browser_init.cc |
@@ -504,9 +504,6 @@ void RegisterComponentsForUpdate(const CommandLine& command_line) { |
// BrowserInit ---------------------------------------------------------------- |
-bool BrowserInit::was_restarted_ = false; |
-bool BrowserInit::was_restarted_read_ = false; |
- |
BrowserInit::BrowserInit() {} |
BrowserInit::~BrowserInit() {} |
@@ -595,14 +592,20 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line, |
// static |
bool BrowserInit::WasRestarted() { |
- if (!was_restarted_read_) { |
+ // Stores the value of the preference kWasRestarted had when it was read. |
+ static bool was_restarted = false; |
+ |
+ // True if we have already read and reset the preference kWasRestarted. |
+ static bool was_restarted_read = false; |
+ |
+ if (!was_restarted_read) { |
PrefService* pref_service = g_browser_process->local_state(); |
- was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); |
+ was_restarted = pref_service->GetBoolean(prefs::kWasRestarted); |
pref_service->SetBoolean(prefs::kWasRestarted, false); |
pref_service->ScheduleSavePersistentPrefs(); |
- was_restarted_read_ = true; |
+ was_restarted_read = true; |
} |
- return was_restarted_; |
+ return was_restarted; |
} |
// BrowserInit::LaunchWithProfile::Tab ---------------------------------------- |