Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/metrics/thread_watcher.cc

Issue 9034032: And now NewRunnableMethod(), you die. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_frame_automation Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 // WatchDogThread methods and members. 715 // WatchDogThread methods and members.
716 716
717 // This lock protects g_watchdog_thread. 717 // This lock protects g_watchdog_thread.
718 static base::LazyInstance<base::Lock, 718 static base::LazyInstance<base::Lock,
719 base::LeakyLazyInstanceTraits<base::Lock> > 719 base::LeakyLazyInstanceTraits<base::Lock> >
720 g_watchdog_lock = LAZY_INSTANCE_INITIALIZER; 720 g_watchdog_lock = LAZY_INSTANCE_INITIALIZER;
721 721
722 // The singleton of this class. 722 // The singleton of this class.
723 static WatchDogThread* g_watchdog_thread = NULL; 723 static WatchDogThread* g_watchdog_thread = NULL;
724 724
725
726 // The WatchDogThread object must outlive any tasks posted to the IO thread
727 // before the Quit task.
728 DISABLE_RUNNABLE_METHOD_REFCOUNT(WatchDogThread);
729
730 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") { 725 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") {
731 } 726 }
732 727
733 WatchDogThread::~WatchDogThread() { 728 WatchDogThread::~WatchDogThread() {
734 Stop(); 729 Stop();
735 } 730 }
736 731
737 // static 732 // static
738 bool WatchDogThread::CurrentlyOnWatchDogThread() { 733 bool WatchDogThread::CurrentlyOnWatchDogThread() {
739 base::AutoLock lock(g_watchdog_lock.Get()); 734 base::AutoLock lock(g_watchdog_lock.Get());
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 911
917 #if defined(OS_WIN) 912 #if defined(OS_WIN)
918 // On Windows XP, give twice the time for shutdown. 913 // On Windows XP, give twice the time for shutdown.
919 if (base::win::GetVersion() <= base::win::VERSION_XP) 914 if (base::win::GetVersion() <= base::win::VERSION_XP)
920 actual_duration *= 2; 915 actual_duration *= 2;
921 #endif 916 #endif
922 917
923 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 918 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
924 shutdown_watchdog_->Arm(); 919 shutdown_watchdog_->Arm();
925 } 920 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/thread_watcher.h ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698