summaryrefslogtreecommitdiffstats
path: root/chrome/common/child_thread.h
diff options
context:
space:
mode:
authorjabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:33:36 +0000
committerjabdelmalek@google.com <jabdelmalek@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:33:36 +0000
commit1e9499c21c23b52391d952572bd9059df532efcb (patch)
treebd96f3ed1bd4226b062085316346c77e6bb999ab /chrome/common/child_thread.h
parentae2e0f96d38961c160bf54962a55eb1f44a0f943 (diff)
downloadchromium_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 'chrome/common/child_thread.h')
-rw-r--r--chrome/common/child_thread.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/common/child_thread.h b/chrome/common/child_thread.h
index ee05e11..72af5aa 100644
--- a/chrome/common/child_thread.h
+++ b/chrome/common/child_thread.h
@@ -15,6 +15,10 @@
class NotificationService;
class SocketStreamDispatcher;
+namespace IPC {
+class SyncMessageFilter;
+}
+
// The main thread of a child process derives from this class.
class ChildThread : public IPC::Channel::Listener,
public IPC::Message::Sender {
@@ -49,6 +53,10 @@ class ChildThread : public IPC::Channel::Listener,
return socket_stream_dispatcher_.get();
}
+ // Safe to call on any thread, as long as it's guaranteed that the thread's
+ // lifetime is less than the main thread.
+ IPC::SyncMessageFilter* sync_message_filter() { return sync_message_filter_; }
+
MessageLoop* message_loop() { return message_loop_; }
// Returns the one child thread.
@@ -84,6 +92,9 @@ class ChildThread : public IPC::Channel::Listener,
std::string channel_name_;
scoped_ptr<IPC::SyncChannel> channel_;
+ // Allows threads other than the main thread to send sync messages.
+ scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
+
// Implements message routing functionality to the consumers of ChildThread.
MessageRouter router_;