diff options
author | jabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 20:33:36 +0000 |
---|---|---|
committer | jabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 20:33:36 +0000 |
commit | 1e9499c21c23b52391d952572bd9059df532efcb (patch) | |
tree | bd96f3ed1bd4226b062085316346c77e6bb999ab /ipc/ipc_sync_channel.h | |
parent | ae2e0f96d38961c160bf54962a55eb1f44a0f943 (diff) | |
download | chromium_src-1e9499c21c23b52391d952572bd9059df532efcb.zip chromium_src-1e9499c21c23b52391d952572bd9059df532efcb.tar.gz chromium_src-1e9499c21c23b52391d952572bd9059df532efcb.tar.bz2 |
Allow synchronous messages to be sent from threads other than the main thread. This simplifies code that needs to do this (i.e. webkit db and file threads).
BUG=23423
Review URL: http://codereview.chromium.org/1601005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_channel.h')
-rw-r--r-- | ipc/ipc_sync_channel.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index cb88f47..e66dd92 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -13,6 +13,7 @@ #include "base/ref_counted.h" #include "base/waitable_event_watcher.h" #include "ipc/ipc_channel_proxy.h" +#include "ipc/ipc_sync_message.h" namespace base { class WaitableEvent; @@ -23,8 +24,8 @@ namespace IPC { class SyncMessage; class MessageReplyDeserializer; -// This is similar to IPC::ChannelProxy, with the added feature of supporting -// sending synchronous messages. +// This is similar to ChannelProxy, with the added feature of supporting sending +// synchronous messages. // Note that care must be taken that the lifetime of the ipc_thread argument // is more than this object. If the message loop goes away while this object // is running and it's used to send a message, then it will use the invalid @@ -63,7 +64,7 @@ class SyncChannel : public ChannelProxy, // Adds information about an outgoing sync message to the context so that // we know how to deserialize the reply. - void Push(IPC::SyncMessage* sync_msg); + void Push(SyncMessage* sync_msg); // Cleanly remove the top deserializer (and throw it away). Returns the // result of the Send call for that message. @@ -96,7 +97,7 @@ class SyncChannel : public ChannelProxy, private: ~SyncContext(); - // IPC::ChannelProxy methods that we override. + // ChannelProxy methods that we override. // Called on the listener thread. virtual void Clear(); @@ -113,18 +114,6 @@ class SyncChannel : public ChannelProxy, // WaitableEventWatcher::Delegate implementation. virtual void OnWaitableEventSignaled(base::WaitableEvent* arg); - // When sending a synchronous message, this structure contains an object - // that knows how to deserialize the response. - struct PendingSyncMsg { - PendingSyncMsg(int id, IPC::MessageReplyDeserializer* d, - base::WaitableEvent* e) : - id(id), deserializer(d), done_event(e), send_result(false) { } - int id; - IPC::MessageReplyDeserializer* deserializer; - base::WaitableEvent* done_event; - bool send_result; - }; - typedef std::deque<PendingSyncMsg> PendingSyncMessageQueue; PendingSyncMessageQueue deserializers_; Lock deserializers_lock_; |