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

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

Issue 2110603002: Remove calls to MessageLoop::current() in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 } 742 }
743 743
744 WatchDogThread::~WatchDogThread() { 744 WatchDogThread::~WatchDogThread() {
745 Stop(); 745 Stop();
746 } 746 }
747 747
748 // static 748 // static
749 bool WatchDogThread::CurrentlyOnWatchDogThread() { 749 bool WatchDogThread::CurrentlyOnWatchDogThread() {
750 base::AutoLock lock(g_watchdog_lock.Get()); 750 base::AutoLock lock(g_watchdog_lock.Get());
751 return g_watchdog_thread && 751 return g_watchdog_thread &&
752 g_watchdog_thread->message_loop() == base::MessageLoop::current(); 752 g_watchdog_thread->task_runner()->BelongsToCurrentThread();
753 } 753 }
754 754
755 // static 755 // static
756 bool WatchDogThread::PostTask(const tracked_objects::Location& from_here, 756 bool WatchDogThread::PostTask(const tracked_objects::Location& from_here,
757 const base::Closure& task) { 757 const base::Closure& task) {
758 return PostTaskHelper(from_here, task, base::TimeDelta()); 758 return PostTaskHelper(from_here, task, base::TimeDelta());
759 } 759 }
760 760
761 // static 761 // static
762 bool WatchDogThread::PostDelayedTask(const tracked_objects::Location& from_here, 762 bool WatchDogThread::PostDelayedTask(const tracked_objects::Location& from_here,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1000
1001 #if defined(OS_WIN) 1001 #if defined(OS_WIN)
1002 // On Windows XP, give twice the time for shutdown. 1002 // On Windows XP, give twice the time for shutdown.
1003 if (base::win::GetVersion() <= base::win::VERSION_XP) 1003 if (base::win::GetVersion() <= base::win::VERSION_XP)
1004 actual_duration *= 2; 1004 actual_duration *= 2;
1005 #endif 1005 #endif
1006 1006
1007 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 1007 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
1008 shutdown_watchdog_->Arm(); 1008 shutdown_watchdog_->Arm();
1009 } 1009 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/browser/process_singleton_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698