| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); | 359 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); |
| 360 for (size_t i = 0; i < profiles.size(); ++i) | 360 for (size_t i = 0; i < profiles.size(); ++i) |
| 361 profiles[i]->MarkAsCleanShutdown(); | 361 profiles[i]->MarkAsCleanShutdown(); |
| 362 | 362 |
| 363 // Tell the metrics service it was cleanly shutdown. | 363 // Tell the metrics service it was cleanly shutdown. |
| 364 MetricsService* metrics = g_browser_process->metrics_service(); | 364 MetricsService* metrics = g_browser_process->metrics_service(); |
| 365 if (metrics && local_state()) { | 365 if (metrics && local_state()) { |
| 366 metrics->RecordStartOfSessionEnd(); | 366 metrics->RecordStartOfSessionEnd(); |
| 367 | 367 |
| 368 // MetricsService lazily writes to prefs, force it to write now. | 368 // MetricsService lazily writes to prefs, force it to write now. |
| 369 local_state()->SavePersistentPrefs(); | 369 local_state()->CommitPendingWrite(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // We must write that the profile and metrics service shutdown cleanly, | 372 // We must write that the profile and metrics service shutdown cleanly, |
| 373 // otherwise on startup we'll think we crashed. So we block until done and | 373 // otherwise on startup we'll think we crashed. So we block until done and |
| 374 // then proceed with normal shutdown. | 374 // then proceed with normal shutdown. |
| 375 #if defined(USE_X11) | 375 #if defined(USE_X11) |
| 376 // Can't run a local loop on linux. Instead create a waitable event. | 376 // Can't run a local loop on linux. Instead create a waitable event. |
| 377 scoped_ptr<base::WaitableEvent> done_writing( | 377 scoped_ptr<base::WaitableEvent> done_writing( |
| 378 new base::WaitableEvent(false, false)); | 378 new base::WaitableEvent(false, false)); |
| 379 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 379 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 990 } |
| 991 | 991 |
| 992 void BrowserProcessImpl::OnAutoupdateTimer() { | 992 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 993 if (CanAutorestartForUpdate()) { | 993 if (CanAutorestartForUpdate()) { |
| 994 DLOG(WARNING) << "Detected update. Restarting browser."; | 994 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 995 RestartBackgroundInstance(); | 995 RestartBackgroundInstance(); |
| 996 } | 996 } |
| 997 } | 997 } |
| 998 | 998 |
| 999 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 999 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |