summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_sync_channel.cc
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 21:47:40 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 21:47:40 +0000
commitc3ec35638ea6594b6bdbac7ff92c38add8984623 (patch)
treec51541ac2451e66c410b3d244e1f59ac2218c57e /chrome/common/ipc_sync_channel.cc
parente537c3515e270527ba2fa54fcfc4a1ed49cc975e (diff)
downloadchromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.zip
chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.tar.gz
chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.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@1113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_sync_channel.cc')
-rw-r--r--chrome/common/ipc_sync_channel.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/common/ipc_sync_channel.cc b/chrome/common/ipc_sync_channel.cc
index 25a22c8..3932c6d 100644
--- a/chrome/common/ipc_sync_channel.cc
+++ b/chrome/common/ipc_sync_channel.cc
@@ -57,7 +57,8 @@ namespace IPC {
// sync message while another one is blocked).
// Holds a pointer to the per-thread ReceivedSyncMsgQueue object.
-static int g_tls_index = ThreadLocalStorage::Alloc();
+// TODO(evanm): this shouldn't rely on static initialization.
+static TLSSlot g_tls_index;
class SyncChannel::ReceivedSyncMsgQueue :
public base::RefCountedThreadSafe<ReceivedSyncMsgQueue> {
@@ -69,10 +70,10 @@ class SyncChannel::ReceivedSyncMsgQueue :
}
~ReceivedSyncMsgQueue() {
- DCHECK(ThreadLocalStorage::Get(g_tls_index));
+ DCHECK(g_tls_index.Get());
DCHECK(MessageLoop::current() == listener_message_loop_);
CloseHandle(blocking_event_);
- ThreadLocalStorage::Set(g_tls_index, NULL);
+ g_tls_index.Set(NULL);
}
// Called on IPC thread when a synchronous message or reply arrives.
@@ -237,14 +238,13 @@ SyncChannel::SyncContext::SyncContext(
reply_deserialize_result_(false) {
// We want one ReceivedSyncMsgQueue per listener thread (i.e. since multiple
// SyncChannel objects that can block the same thread).
- received_sync_msgs_ = static_cast<ReceivedSyncMsgQueue*>(
- ThreadLocalStorage::Get(g_tls_index));
+ received_sync_msgs_ = static_cast<ReceivedSyncMsgQueue*>(g_tls_index.Get());
if (!received_sync_msgs_) {
// Stash a pointer to the listener thread's ReceivedSyncMsgQueue, as we
// need to be able to access it in the IPC thread.
received_sync_msgs_ = new ReceivedSyncMsgQueue();
- ThreadLocalStorage::Set(g_tls_index, received_sync_msgs_);
+ g_tls_index.Set(received_sync_msgs_);
}
// Addref manually so that we can ensure destruction on the listener thread