| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); | 347 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); |
| 348 for (size_t i = 0; i < profiles.size(); ++i) | 348 for (size_t i = 0; i < profiles.size(); ++i) |
| 349 profiles[i]->MarkAsCleanShutdown(); | 349 profiles[i]->MarkAsCleanShutdown(); |
| 350 | 350 |
| 351 // Tell the metrics service it was cleanly shutdown. | 351 // Tell the metrics service it was cleanly shutdown. |
| 352 MetricsService* metrics = g_browser_process->metrics_service(); | 352 MetricsService* metrics = g_browser_process->metrics_service(); |
| 353 if (metrics && local_state()) { | 353 if (metrics && local_state()) { |
| 354 metrics->RecordStartOfSessionEnd(); | 354 metrics->RecordStartOfSessionEnd(); |
| 355 | 355 |
| 356 // MetricsService lazily writes to prefs, force it to write now. | 356 // MetricsService lazily writes to prefs, force it to write now. |
| 357 local_state()->SavePersistentPrefs(); | 357 local_state()->CommitPendingWrite(); |
| 358 } | 358 } |
| 359 | 359 |
| 360 // We must write that the profile and metrics service shutdown cleanly, | 360 // We must write that the profile and metrics service shutdown cleanly, |
| 361 // otherwise on startup we'll think we crashed. So we block until done and | 361 // otherwise on startup we'll think we crashed. So we block until done and |
| 362 // then proceed with normal shutdown. | 362 // then proceed with normal shutdown. |
| 363 #if defined(USE_X11) | 363 #if defined(USE_X11) |
| 364 // Can't run a local loop on linux. Instead create a waitable event. | 364 // Can't run a local loop on linux. Instead create a waitable event. |
| 365 scoped_ptr<base::WaitableEvent> done_writing( | 365 scoped_ptr<base::WaitableEvent> done_writing( |
| 366 new base::WaitableEvent(false, false)); | 366 new base::WaitableEvent(false, false)); |
| 367 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 367 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void BrowserProcessImpl::OnAutoupdateTimer() { | 1156 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1157 if (CanAutorestartForUpdate()) { | 1157 if (CanAutorestartForUpdate()) { |
| 1158 DLOG(WARNING) << "Detected update. Restarting browser."; | 1158 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1159 RestartPersistentInstance(); | 1159 RestartPersistentInstance(); |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1163 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |