diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:54:52 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:54:52 +0000 |
commit | 6a6e657234868ad4044b03bdeb9c6f7e872b5ee6 (patch) | |
tree | 36d9855863e1cf5615b62623b2347ec494447cdb /base/stats_table.cc | |
parent | 15e8abe105f4c2a08cd5dc51e95ec1791ac440f2 (diff) | |
download | chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.zip chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.tar.gz chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.tar.bz2 |
TrackedObjects assumes you can use a "TLS slot" of -1 to indicate uninitialized. This isn't true for the pthread_key_t type, which is unsigned on Linux and reportedly a struct on Macs. This change modifies the Slot type to be a struct containing an "initialized" flag.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/stats_table.cc')
-rw-r--r-- | base/stats_table.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/base/stats_table.cc b/base/stats_table.cc index 23c736a..8b10662 100644 --- a/base/stats_table.cc +++ b/base/stats_table.cc @@ -254,7 +254,7 @@ StatsTable* StatsTable::global_table_ = NULL; StatsTable::StatsTable(const std::wstring& name, int max_threads, int max_counters) - : tls_index_(ThreadLocalStorage::Alloc(SlotReturnFunction)) { + : tls_index_(SlotReturnFunction) { int table_size = AlignedSize(sizeof(TableHeader)) + AlignedSize((max_counters * sizeof(wchar_t) * kMaxCounterNameLength)) + @@ -285,7 +285,7 @@ StatsTable::~StatsTable() { // Return ThreadLocalStorage. At this point, if any registered threads // still exist, they cannot Unregister. - ThreadLocalStorage::Free(tls_index_); + tls_index_.Free(); // Cleanup our shared memory. delete impl_; @@ -329,13 +329,13 @@ int StatsTable::RegisterThread(const std::wstring& name) { StatsTableTLSData* data = new StatsTableTLSData; data->table = this; data->slot = slot; - ThreadLocalStorage::Set(tls_index_, data); + tls_index_.Set(data); return slot; } StatsTableTLSData* StatsTable::GetTLSData() const { StatsTableTLSData* data = - static_cast<StatsTableTLSData*>(ThreadLocalStorage::Get(tls_index_)); + static_cast<StatsTableTLSData*>(tls_index_.Get()); if (!data) return NULL; @@ -355,7 +355,7 @@ void StatsTable::UnregisterThread() { *name = L'\0'; // Remove the calling thread's TLS so that it cannot use the slot. - ThreadLocalStorage::Set(tls_index_, NULL); + tls_index_.Set(NULL); delete data; } |