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 // MetricsService::RecordStartOfSessionEnd writes to prefs immediately. |
jar (doing other things)
2013/10/02 01:18:31
Can you point to where this happens? I don't see
| |
366 if (metrics && local_state()) | |
366 metrics->RecordStartOfSessionEnd(); | 367 metrics->RecordStartOfSessionEnd(); |
367 | 368 |
368 // MetricsService lazily writes to prefs, force it to write now. | |
369 local_state()->CommitPendingWrite(); | |
370 } | |
371 | |
372 // http://crbug.com/125207 | 369 // http://crbug.com/125207 |
373 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 370 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
374 | 371 |
375 // We must write that the profile and metrics service shutdown cleanly, | 372 // 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 | 373 // otherwise on startup we'll think we crashed. So we block until done and |
377 // then proceed with normal shutdown. | 374 // then proceed with normal shutdown. |
378 #if defined(USE_X11) | 375 #if defined(USE_X11) |
379 // 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. |
380 scoped_ptr<base::WaitableEvent> done_writing( | 377 scoped_ptr<base::WaitableEvent> done_writing( |
381 new base::WaitableEvent(false, false)); | 378 new base::WaitableEvent(false, false)); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1056 } | 1053 } |
1057 | 1054 |
1058 void BrowserProcessImpl::OnAutoupdateTimer() { | 1055 void BrowserProcessImpl::OnAutoupdateTimer() { |
1059 if (CanAutorestartForUpdate()) { | 1056 if (CanAutorestartForUpdate()) { |
1060 DLOG(WARNING) << "Detected update. Restarting browser."; | 1057 DLOG(WARNING) << "Detected update. Restarting browser."; |
1061 RestartBackgroundInstance(); | 1058 RestartBackgroundInstance(); |
1062 } | 1059 } |
1063 } | 1060 } |
1064 | 1061 |
1065 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1062 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |