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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Mark all the profiles as clean. | 366 // Mark all the profiles as clean. |
367 ProfileManager* pm = profile_manager(); | 367 ProfileManager* pm = profile_manager(); |
368 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); | 368 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); |
369 for (size_t i = 0; i < profiles.size(); ++i) | 369 for (size_t i = 0; i < profiles.size(); ++i) |
370 profiles[i]->SetExitType(Profile::EXIT_SESSION_ENDED); | 370 profiles[i]->SetExitType(Profile::EXIT_SESSION_ENDED); |
371 | 371 |
372 // Tell the metrics service it was cleanly shutdown. | 372 // Tell the metrics service it was cleanly shutdown. |
373 MetricsService* metrics = g_browser_process->metrics_service(); | 373 MetricsService* metrics = g_browser_process->metrics_service(); |
374 if (metrics && local_state()) { | 374 if (metrics && local_state()) { |
375 metrics->RecordStartOfSessionEnd(); | 375 metrics->RecordStartOfSessionEnd(); |
376 | 376 #if !defined(OS_CHROMEOS) |
377 // MetricsService lazily writes to prefs, force it to write now. | 377 // MetricsService lazily writes to prefs, force it to write now. |
| 378 // On ChromeOS, chrome gets killed when hangs, so no need to |
| 379 // commit prefs::kStabilitySessionEndCompleted change immediately. |
378 local_state()->CommitPendingWrite(); | 380 local_state()->CommitPendingWrite(); |
| 381 #endif |
379 } | 382 } |
380 | 383 |
381 // http://crbug.com/125207 | 384 // http://crbug.com/125207 |
382 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 385 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
383 | 386 |
384 // We must write that the profile and metrics service shutdown cleanly, | 387 // We must write that the profile and metrics service shutdown cleanly, |
385 // otherwise on startup we'll think we crashed. So we block until done and | 388 // otherwise on startup we'll think we crashed. So we block until done and |
386 // then proceed with normal shutdown. | 389 // then proceed with normal shutdown. |
387 #if defined(USE_X11) | 390 #if defined(USE_X11) |
388 // Can't run a local loop on linux. Instead create a waitable event. | 391 // 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... |
1065 } | 1068 } |
1066 | 1069 |
1067 void BrowserProcessImpl::OnAutoupdateTimer() { | 1070 void BrowserProcessImpl::OnAutoupdateTimer() { |
1068 if (CanAutorestartForUpdate()) { | 1071 if (CanAutorestartForUpdate()) { |
1069 DLOG(WARNING) << "Detected update. Restarting browser."; | 1072 DLOG(WARNING) << "Detected update. Restarting browser."; |
1070 RestartBackgroundInstance(); | 1073 RestartBackgroundInstance(); |
1071 } | 1074 } |
1072 } | 1075 } |
1073 | 1076 |
1074 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1077 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |