Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3608)

Unified Diff: chrome/common/child_thread.cc

Issue 1601005: Allow synchronous messages to be sent from threads other than the main thread... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/child_thread.h ('k') | chrome/common/database_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/child_thread.cc
===================================================================
--- chrome/common/child_thread.cc (revision 43588)
+++ chrome/common/child_thread.cc (working copy)
@@ -13,6 +13,7 @@
#include "chrome/common/socket_stream_dispatcher.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message.h"
+#include "ipc/ipc_sync_message_filter.h"
#include "ipc/ipc_switches.h"
#include "webkit/glue/webkit_glue.h"
@@ -49,6 +50,10 @@
resource_dispatcher_.reset(new ResourceDispatcher(this));
socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
+ sync_message_filter_ =
+ new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
+ channel_->AddFilter(sync_message_filter_.get());
+
// When running in unit tests, there is already a NotificationService object.
// Since only one can exist at a time per thread, check first.
if (!NotificationService::current())
@@ -60,6 +65,8 @@
IPC::Logging::current()->SetIPCSender(NULL);
#endif
+ channel_->RemoveFilter(sync_message_filter_.get());
+
// The ChannelProxy object caches a pointer to the IPC thread, so need to
// reset it as it's not guaranteed to outlive this object.
// NOTE: this also has the side-effect of not closing the main IPC channel to
@@ -126,7 +133,7 @@
#if defined(IPC_MESSAGE_LOG_ENABLED)
IPC_MESSAGE_HANDLER(PluginProcessMsg_SetIPCLoggingEnabled,
OnSetIPCLoggingEnabled)
-#endif // IPC_MESSAGE_HANDLER
+#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
« no previous file with comments | « chrome/common/child_thread.h ('k') | chrome/common/database_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698