diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:11:47 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:11:47 +0000 |
commit | fa87a2527ca8c0bcef92d8e44791332782936911 (patch) | |
tree | 04dc5d1e6881f8356f91203a386648057b20d924 /base/tracked_objects.cc | |
parent | 4f64d0af5908e36d356c834005d08cca98d579fe (diff) | |
download | chromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.zip chromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.tar.gz chromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.tar.bz2 |
Revert. Failing unit tests.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/tracked_objects.cc')
-rw-r--r-- | base/tracked_objects.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index 83a7fbd..b683a87 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -35,9 +35,9 @@ namespace tracked_objects { -// A TLS slot to the TrackRegistry for the current thread. +// a TLS index to the TrackRegistry for the current thread. // static -TLSSlot ThreadData::tls_index_(base::LINKER_INITIALIZED); +TLSSlot ThreadData::tls_index_ = -1; //------------------------------------------------------------------------------ // Death data tallies durations when a death takes place. @@ -104,14 +104,15 @@ Lock ThreadData::list_lock_; // static ThreadData::Status ThreadData::status_ = ThreadData::UNINITIALIZED; -ThreadData::ThreadData() : message_loop_(MessageLoop::current()) {} +ThreadData::ThreadData() : message_loop_(MessageLoop::current()) {} // static ThreadData* ThreadData::current() { - if (!tls_index_.initialized()) - return NULL; + if (-1 == tls_index_) + return NULL; // not yet initialized. - ThreadData* registry = static_cast<ThreadData*>(tls_index_.Get()); + ThreadData* registry = + static_cast<ThreadData*>(ThreadLocalStorage::Get(tls_index_)); if (!registry) { // We have to create a new registry for ThreadData. bool too_late_to_create = false; @@ -131,7 +132,7 @@ ThreadData* ThreadData::current() { delete registry; registry = NULL; } else { - tls_index_.Set(registry); + ThreadLocalStorage::Set(tls_index_, registry); } } return registry; @@ -343,9 +344,11 @@ bool ThreadData::StartTracking(bool status) { status_ = SHUTDOWN; return true; } + TLSSlot tls_index = ThreadLocalStorage::Alloc(); AutoLock lock(list_lock_); DCHECK(status_ == UNINITIALIZED); - CHECK(tls_index_.Initialize(NULL)); + tls_index_ = tls_index; + CHECK(-1 != tls_index_); status_ = ACTIVE; return true; } @@ -398,9 +401,9 @@ void ThreadData::ShutdownSingleThreadedCleanup() { delete next_thread_data; // Includes all Death Records. } - CHECK(tls_index_.initialized()); - tls_index_.Free(); - DCHECK(!tls_index_.initialized()); + CHECK(-1 != tls_index_); + ThreadLocalStorage::Free(tls_index_); + tls_index_ = -1; status_ = UNINITIALIZED; } |