| 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 void BrowserProcessImpl::EndSession() { | 356 void BrowserProcessImpl::EndSession() { |
| 357 // Mark all the profiles as clean. | 357 // Mark all the profiles as clean. |
| 358 ProfileManager* pm = profile_manager(); | 358 ProfileManager* pm = profile_manager(); |
| 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]->SetExitType(Profile::EXIT_SESSION_ENDED); | 361 profiles[i]->SetExitType(Profile::EXIT_SESSION_ENDED); |
| 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) { |
| 366 // MetricsService::RecordStartOfSessionEnd writes to prefs immediately. |
| 366 metrics->RecordStartOfSessionEnd(); | 367 metrics->RecordStartOfSessionEnd(); |
| 367 | |
| 368 // MetricsService lazily writes to prefs, force it to write now. | |
| 369 local_state()->CommitPendingWrite(); | |
| 370 } | 368 } |
| 371 | 369 |
| 372 // http://crbug.com/125207 | 370 // http://crbug.com/125207 |
| 373 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 371 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 374 | 372 |
| 375 // We must write that the profile and metrics service shutdown cleanly, | 373 // We must write that the profile and metrics service shutdown cleanly, |
| 376 // otherwise on startup we'll think we crashed. So we block until done and | 374 // otherwise on startup we'll think we crashed. So we block until done and |
| 377 // then proceed with normal shutdown. | 375 // then proceed with normal shutdown. |
| 378 #if defined(USE_X11) | 376 #if defined(USE_X11) |
| 379 // Can't run a local loop on linux. Instead create a waitable event. | 377 // Can't run a local loop on linux. Instead create a waitable event. |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 1054 } |
| 1057 | 1055 |
| 1058 void BrowserProcessImpl::OnAutoupdateTimer() { | 1056 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1059 if (CanAutorestartForUpdate()) { | 1057 if (CanAutorestartForUpdate()) { |
| 1060 DLOG(WARNING) << "Detected update. Restarting browser."; | 1058 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1061 RestartBackgroundInstance(); | 1059 RestartBackgroundInstance(); |
| 1062 } | 1060 } |
| 1063 } | 1061 } |
| 1064 | 1062 |
| 1065 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1063 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |