From 1e9499c21c23b52391d952572bd9059df532efcb Mon Sep 17 00:00:00 2001 From: "jabdelmalek@google.com" Date: Tue, 6 Apr 2010 20:33:36 +0000 Subject: 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 --- chrome/common/child_thread.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'chrome/common/child_thread.h') 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 channel_; + // Allows threads other than the main thread to send sync messages. + scoped_refptr sync_message_filter_; + // Implements message routing functionality to the consumers of ChildThread. MessageRouter router_; -- cgit v1.1