| 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/metrics/thread_watcher.h" | 5 #include "chrome/browser/metrics/thread_watcher.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 return; | 700 return; |
| 701 last_wakeup_time_ = now; | 701 last_wakeup_time_ = now; |
| 702 WatchDogThread::PostTask( | 702 WatchDogThread::PostTask( |
| 703 FROM_HERE, | 703 FROM_HERE, |
| 704 base::Bind(&ThreadWatcherList::WakeUpAll)); | 704 base::Bind(&ThreadWatcherList::WakeUpAll)); |
| 705 } | 705 } |
| 706 | 706 |
| 707 // WatchDogThread methods and members. | 707 // WatchDogThread methods and members. |
| 708 | 708 |
| 709 // This lock protects g_watchdog_thread. | 709 // This lock protects g_watchdog_thread. |
| 710 static base::LazyInstance<base::Lock, | 710 static base::LazyInstance<base::Lock>::Leaky |
| 711 base::LeakyLazyInstanceTraits<base::Lock> > | |
| 712 g_watchdog_lock = LAZY_INSTANCE_INITIALIZER; | 711 g_watchdog_lock = LAZY_INSTANCE_INITIALIZER; |
| 713 | 712 |
| 714 // The singleton of this class. | 713 // The singleton of this class. |
| 715 static WatchDogThread* g_watchdog_thread = NULL; | 714 static WatchDogThread* g_watchdog_thread = NULL; |
| 716 | 715 |
| 717 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") { | 716 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") { |
| 718 } | 717 } |
| 719 | 718 |
| 720 WatchDogThread::~WatchDogThread() { | 719 WatchDogThread::~WatchDogThread() { |
| 721 Stop(); | 720 Stop(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 914 |
| 916 #if defined(OS_WIN) | 915 #if defined(OS_WIN) |
| 917 // On Windows XP, give twice the time for shutdown. | 916 // On Windows XP, give twice the time for shutdown. |
| 918 if (base::win::GetVersion() <= base::win::VERSION_XP) | 917 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 919 actual_duration *= 2; | 918 actual_duration *= 2; |
| 920 #endif | 919 #endif |
| 921 | 920 |
| 922 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 921 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 923 shutdown_watchdog_->Arm(); | 922 shutdown_watchdog_->Arm(); |
| 924 } | 923 } |
| OLD | NEW |