summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-12 20:40:16 +0000
committerjabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-12 20:40:16 +0000
commita3936602d482942c4fd64245f809320a8d251995 (patch)
treecbedec47bfc1a0edba85bb06264cae003a96615f
parentd37225fe08bb63a70cc52bcfbbd845af5726c419 (diff)
downloadchromium_src-a3936602d482942c4fd64245f809320a8d251995.zip
chromium_src-a3936602d482942c4fd64245f809320a8d251995.tar.gz
chromium_src-a3936602d482942c4fd64245f809320a8d251995.tar.bz2
Revert my change
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@740 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/ipc_sync_channel.cc22
-rw-r--r--chrome/common/ipc_sync_channel.h4
2 files changed, 10 insertions, 16 deletions
diff --git a/chrome/common/ipc_sync_channel.cc b/chrome/common/ipc_sync_channel.cc
index e29d330..e01759a 100644
--- a/chrome/common/ipc_sync_channel.cc
+++ b/chrome/common/ipc_sync_channel.cc
@@ -69,10 +69,7 @@ class SyncChannel::ReceivedSyncMsgQueue :
}
~ReceivedSyncMsgQueue() {
- DCHECK(ThreadLocalStorage::Get(g_tls_index));
- DCHECK(MessageLoop::current() == listener_message_loop_);
CloseHandle(blocking_event_);
- ThreadLocalStorage::Set(g_tls_index, NULL);
}
// Called on IPC thread when a synchronous message or reply arrives.
@@ -185,7 +182,6 @@ class SyncChannel::ReceivedSyncMsgQueue :
}
HANDLE blocking_event() { return blocking_event_; }
- MessageLoop* listener_message_loop() { return listener_message_loop_; }
private:
// Called on the ipc thread to check if we can unblock any current Send()
@@ -251,24 +247,24 @@ SyncChannel::SyncContext::SyncContext(
received_sync_msgs_ = static_cast<ReceivedSyncMsgQueue*>(
ThreadLocalStorage::Get(g_tls_index));
- if (!received_sync_msgs_) {
+ if (!received_sync_msgs_.get()) {
// 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_);
+ // TODO(jcampan): http:///b/1319842 we are adding an extra-ref to keep this
+ // object around for the duration of the process. We used to remove it from
+ // the TLS when it was destroyed, but that was causing problems as we could
+ // be destroyed in a different thread then the thread we had been created
+ // on. This needs to be revisited at some point.
+ received_sync_msgs_->AddRef();
+
+ ThreadLocalStorage::Set(g_tls_index, received_sync_msgs_.get());
}
-
- // Addref manually so that we can ensure destruction on the listener thread
- // (so that the TLS object is NULLd).
- received_sync_msgs_->AddRef();
}
SyncChannel::SyncContext::~SyncContext() {
while (!deserializers_.empty())
PopDeserializer(true);
-
- received_sync_msgs_->listener_message_loop()->ReleaseSoon(
- FROM_HERE, received_sync_msgs_);
}
// Adds information about an outgoing sync message to the context so that
diff --git a/chrome/common/ipc_sync_channel.h b/chrome/common/ipc_sync_channel.h
index fa3566e..bd473d4 100644
--- a/chrome/common/ipc_sync_channel.h
+++ b/chrome/common/ipc_sync_channel.h
@@ -128,9 +128,7 @@ class SyncChannel : public ChannelProxy {
PendingSyncMessageQueue deserializers_;
Lock deserializers_lock_;
- // This can't be a scoped_refptr because it needs to be released on the
- // listener thread.
- ReceivedSyncMsgQueue* received_sync_msgs_;
+ scoped_refptr<ReceivedSyncMsgQueue> received_sync_msgs_;
bool channel_closed_;
bool reply_deserialize_result_;