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

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

Issue 8427007: Thread::Stop() must be called before any subclass's destructor completes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest version as trybot-ted Created 9 years, 1 month 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
« no previous file with comments | « base/threading/thread_unittest.cc ('k') | chrome/browser/printing/print_job_worker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 WatchDogThread* WatchDogThread::watchdog_thread_ = NULL; 623 WatchDogThread* WatchDogThread::watchdog_thread_ = NULL;
624 624
625 // The WatchDogThread object must outlive any tasks posted to the IO thread 625 // The WatchDogThread object must outlive any tasks posted to the IO thread
626 // before the Quit task. 626 // before the Quit task.
627 DISABLE_RUNNABLE_METHOD_REFCOUNT(WatchDogThread); 627 DISABLE_RUNNABLE_METHOD_REFCOUNT(WatchDogThread);
628 628
629 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") { 629 WatchDogThread::WatchDogThread() : Thread("BrowserWatchdog") {
630 } 630 }
631 631
632 WatchDogThread::~WatchDogThread() { 632 WatchDogThread::~WatchDogThread() {
633 // We cannot rely on our base class to stop the thread since we want our
634 // CleanUp function to run.
635 Stop(); 633 Stop();
636 } 634 }
637 635
638 // static 636 // static
639 bool WatchDogThread::CurrentlyOnWatchDogThread() { 637 bool WatchDogThread::CurrentlyOnWatchDogThread() {
640 base::AutoLock lock(lock_); 638 base::AutoLock lock(lock_);
641 return watchdog_thread_ && 639 return watchdog_thread_ &&
642 watchdog_thread_->message_loop() == MessageLoop::current(); 640 watchdog_thread_->message_loop() == MessageLoop::current();
643 } 641 }
644 642
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 789
792 #if defined(OS_WIN) 790 #if defined(OS_WIN)
793 // On Windows XP, give twice the time for shutdown. 791 // On Windows XP, give twice the time for shutdown.
794 if (base::win::GetVersion() <= base::win::VERSION_XP) 792 if (base::win::GetVersion() <= base::win::VERSION_XP)
795 actual_duration *= 2; 793 actual_duration *= 2;
796 #endif 794 #endif
797 795
798 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 796 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
799 shutdown_watchdog_->Arm(); 797 shutdown_watchdog_->Arm();
800 } 798 }
OLDNEW
« no previous file with comments | « base/threading/thread_unittest.cc ('k') | chrome/browser/printing/print_job_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698