summaryrefslogtreecommitdiffstats
path: root/chrome/common/notification_service.cc
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 22:54:52 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 22:54:52 +0000
commit6a6e657234868ad4044b03bdeb9c6f7e872b5ee6 (patch)
tree36d9855863e1cf5615b62623b2347ec494447cdb /chrome/common/notification_service.cc
parent15e8abe105f4c2a08cd5dc51e95ec1791ac440f2 (diff)
downloadchromium_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 'chrome/common/notification_service.cc')
-rw-r--r--chrome/common/notification_service.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/common/notification_service.cc b/chrome/common/notification_service.cc
index 672052f..2345ba0 100644
--- a/chrome/common/notification_service.cc
+++ b/chrome/common/notification_service.cc
@@ -29,9 +29,11 @@
#include "chrome/common/notification_service.h"
-int NotificationService::tls_index_ = ThreadLocalStorage::Alloc();
+// TODO(evanm): This shouldn't depend on static initialization.
+// static
+TLSSlot NotificationService::tls_index_;
-/* static */
+// static
bool NotificationService::HasKey(const NotificationSourceMap& map,
const NotificationSource& source) {
return map.find(source.map_key()) != map.end();
@@ -43,7 +45,7 @@ NotificationService::NotificationService() {
memset(observer_counts_, 0, sizeof(observer_counts_));
#endif
- ThreadLocalStorage::Set(tls_index_, this);
+ tls_index_.Set(this);
}
void NotificationService::AddObserver(NotificationObserver* observer,
@@ -117,7 +119,7 @@ void NotificationService::Notify(NotificationType type,
NotificationService::~NotificationService() {
- ThreadLocalStorage::Set(tls_index_, NULL);
+ tls_index_.Set(NULL);
#ifndef NDEBUG
for (int i = 0; i < NOTIFICATION_TYPE_COUNT; i++) {