summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-20 19:32:16 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-20 19:32:16 +0000
commitbad8cc7d6590b21dfecf4d33f883cfb520070123 (patch)
treefc7f07bcc8a0403a7b955b1f33f3997e9bba8cd2 /ppapi
parent02011fd41e2415b18b54aae03bf3b7f9ace43745 (diff)
downloadchromium_src-bad8cc7d6590b21dfecf4d33f883cfb520070123.zip
chromium_src-bad8cc7d6590b21dfecf4d33f883cfb520070123.tar.gz
chromium_src-bad8cc7d6590b21dfecf4d33f883cfb520070123.tar.bz2
Pepper: Fix AddFilter() order in PpapiDispatcher.
Previously, filters were added to the SyncChannel in PpapiDispatcher after the channel was connected. There was nothing clearly enforcing that messages wouldn't arrive until after the filters were added. This change makes this ordering more explicit and easier to understand. BUG=343768 Review URL: https://codereview.chromium.org/172873004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/plugin_main_nacl.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index 852ff4e..c84828d 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -117,16 +117,17 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop)
// browser.
IPC::ChannelHandle channel_handle(
"NaCl IPC", base::FileDescriptor(NACL_CHROME_DESC_BASE, false));
- // We don't have/need a PID since handle sharing happens outside of the
- // NaCl sandbox.
- channel_.reset(new IPC::SyncChannel(
- channel_handle, IPC::Channel::MODE_SERVER, this,
- GetIPCMessageLoop(), true, GetShutdownEvent()));
+ // Delay initializing the SyncChannel until after we add filters. This
+ // ensures that the filters won't miss any messages received by
+ // the channel.
+ channel_.reset(new IPC::SyncChannel(
+ this, GetIPCMessageLoop(), GetShutdownEvent()));
channel_->AddFilter(new ppapi::proxy::PluginMessageFilter(
NULL, PluginGlobals::Get()->resource_reply_thread_registrar()));
channel_->AddFilter(
new tracing::ChildTraceMessageFilter(message_loop_.get()));
+ channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true);
}
base::MessageLoopProxy* PpapiDispatcher::GetIPCMessageLoop() {