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

Unified Diff: chrome/browser/metrics/thread_watcher.cc

Issue 8568039: Revert 110235 - chrome: Remove 14 exit time destructors and 2 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/thread_watcher.h ('k') | chrome/browser/policy/device_management_backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/thread_watcher.cc
===================================================================
--- chrome/browser/metrics/thread_watcher.cc (revision 110237)
+++ chrome/browser/metrics/thread_watcher.cc (working copy)
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
-#include "base/lazy_instance.h"
#include "base/string_tokenizer.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
@@ -703,16 +702,12 @@
}
// WatchDogThread methods and members.
+//
+// static
+base::Lock WatchDogThread::lock_;
+// static
+WatchDogThread* WatchDogThread::watchdog_thread_ = NULL;
-// This lock protects g_watchdog_thread.
-static base::LazyInstance<base::Lock,
- base::LeakyLazyInstanceTraits<base::Lock> >
- g_watchdog_lock = LAZY_INSTANCE_INITIALIZER;
-
-// The singleton of this class.
-static WatchDogThread* g_watchdog_thread = NULL;
-
-
// The WatchDogThread object must outlive any tasks posted to the IO thread
// before the Quit task.
DISABLE_RUNNABLE_METHOD_REFCOUNT(WatchDogThread);
@@ -726,9 +721,9 @@
// static
bool WatchDogThread::CurrentlyOnWatchDogThread() {
- base::AutoLock lock(g_watchdog_lock.Get());
- return g_watchdog_thread &&
- g_watchdog_thread->message_loop() == MessageLoop::current();
+ base::AutoLock lock(lock_);
+ return watchdog_thread_ &&
+ watchdog_thread_->message_loop() == MessageLoop::current();
}
// static
@@ -750,10 +745,10 @@
const base::Closure& task,
int64 delay_ms) {
{
- base::AutoLock lock(g_watchdog_lock.Get());
+ base::AutoLock lock(lock_);
- MessageLoop* message_loop = g_watchdog_thread ?
- g_watchdog_thread->message_loop() : NULL;
+ MessageLoop* message_loop = watchdog_thread_ ?
+ watchdog_thread_->message_loop() : NULL;
if (message_loop) {
message_loop->PostDelayedTask(from_here, task, delay_ms);
return true;
@@ -767,14 +762,14 @@
// This thread shouldn't be allowed to perform any blocking disk I/O.
base::ThreadRestrictions::SetIOAllowed(false);
- base::AutoLock lock(g_watchdog_lock.Get());
- CHECK(!g_watchdog_thread);
- g_watchdog_thread = this;
+ base::AutoLock lock(lock_);
+ CHECK(!watchdog_thread_);
+ watchdog_thread_ = this;
}
void WatchDogThread::CleanUp() {
- base::AutoLock lock(g_watchdog_lock.Get());
- g_watchdog_thread = NULL;
+ base::AutoLock lock(lock_);
+ watchdog_thread_ = NULL;
}
namespace {
« no previous file with comments | « chrome/browser/metrics/thread_watcher.h ('k') | chrome/browser/policy/device_management_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698