diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-06 16:54:09 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-06 16:54:09 +0000 |
commit | aeee1ee51a37c27a0a9c6465ff118777d623b9e6 (patch) | |
tree | 0061b4f3ec11fc3b428a5469c70a0467c4652e4c /components | |
parent | 9134a8c5bd338f555a61f9863b0a50ffe28e0d5a (diff) | |
download | chromium_src-aeee1ee51a37c27a0a9c6465ff118777d623b9e6.zip chromium_src-aeee1ee51a37c27a0a9c6465ff118777d623b9e6.tar.gz chromium_src-aeee1ee51a37c27a0a9c6465ff118777d623b9e6.tar.bz2 |
Pepper: Split PpapiHostMsg_ChannelCreated use.
PpapiHostMsg_ChannelCreated is used for two purposes:
* Notifying the browser that a browser<->plugin channel has been created, and
* Notifying that browser that a renderer<->plugin channel has been created.
In this case renderer<->plugin channel is for NaCl-based plugins, and is
special because it does some inspection of message contents and passes on the
message to the untrusted side of the plugin.
I've changed this because I think it makes the code easier to read, and I'm
adding an additional renderer<->plugin channel anyway.
BUG=
TBR=mseaborn,jschuh
Review URL: https://codereview.chromium.org/98183012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/nacl/browser/nacl_process_host.cc | 27 | ||||
-rw-r--r-- | components/nacl/browser/nacl_process_host.h | 7 | ||||
-rw-r--r-- | components/nacl/loader/nacl_ipc_adapter.cc | 2 |
3 files changed, 22 insertions, 14 deletions
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index 5a36b43..558c65d 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc @@ -572,7 +572,7 @@ bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { OnAttachDebugExceptionHandler) #endif IPC_MESSAGE_HANDLER(NaClProcessHostMsg_PpapiChannelCreated, - OnPpapiChannelCreated) + OnPpapiBrowserChannelCreated) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -778,14 +778,11 @@ bool NaClProcessHost::SendStart() { } // This method is called when NaClProcessHostMsg_PpapiChannelCreated is -// received or PpapiHostMsg_ChannelCreated is forwarded by our plugin -// listener. -void NaClProcessHost::OnPpapiChannelCreated( +// received. +void NaClProcessHost::OnPpapiBrowserChannelCreated( const IPC::ChannelHandle& channel_handle) { // Only renderer processes should create a channel. DCHECK(enable_ppapi_proxy()); - // If the proxy channel is null, this must be the initial NaCl-Browser IPC - // channel. if (!ipc_proxy_channel_.get()) { DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type); @@ -833,11 +830,19 @@ void NaClProcessHost::OnPpapiChannelCreated( args, SerializedHandle(SerializedHandle::CHANNEL_HANDLE, IPC::InvalidPlatformFileForTransit()))); - } else if (reply_msg_) { - // Otherwise, this must be a renderer channel. + } else { + // Attempt to open more than 1 browser channel is not supported. + // Shut down the NaCl process. + process_->GetHost()->ForceShutdown(); + } +} + +void NaClProcessHost::OnPpapiRendererChannelCreated( + const IPC::ChannelHandle& channel_handle) { + if (reply_msg_) { ReplyToRenderer(channel_handle); } else { - // Attempt to open more than 1 renderer channel is not supported. + // Attempt to open more than 1 NaCl renderer channel is not supported. // Shut down the NaCl process. process_->GetHost()->ForceShutdown(); } @@ -848,8 +853,8 @@ bool NaClProcessHost::OnUntrustedMessageForwarded(const IPC::Message& msg) { // These messages come from untrusted code so should be handled with care. bool handled = true; IPC_BEGIN_MESSAGE_MAP(NaClProcessHost, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_ChannelCreated, - OnPpapiChannelCreated) + IPC_MESSAGE_HANDLER(PpapiHostMsg_NaClChannelCreated, + OnPpapiRendererChannelCreated) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/components/nacl/browser/nacl_process_host.h b/components/nacl/browser/nacl_process_host.h index 994799b..26c4914 100644 --- a/components/nacl/browser/nacl_process_host.h +++ b/components/nacl/browser/nacl_process_host.h @@ -176,8 +176,11 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { IPC::Message* reply_msg); #endif - // Called when a PPAPI IPC channel has been created. - void OnPpapiChannelCreated(const IPC::ChannelHandle& channel_handle); + // Called when the PPAPI IPC channel to the browser has been created. + void OnPpapiBrowserChannelCreated(const IPC::ChannelHandle& channel_handle); + // Called when the PPAPI IPC channel to the renderer has been created. + void OnPpapiRendererChannelCreated(const IPC::ChannelHandle& channel_handle); + // Called by PluginListener, so messages from the untrusted side of // the IPC proxy can be handled. bool OnUntrustedMessageForwarded(const IPC::Message& msg); diff --git a/components/nacl/loader/nacl_ipc_adapter.cc b/components/nacl/loader/nacl_ipc_adapter.cc index 2feabf5..3843572 100644 --- a/components/nacl/loader/nacl_ipc_adapter.cc +++ b/components/nacl/loader/nacl_ipc_adapter.cc @@ -521,7 +521,7 @@ bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) { nacl_desc.reset(new NaClDescWrapper(ipc_adapter->MakeNaClDesc())); // Send back a message that the channel was created. scoped_ptr<IPC::Message> response( - new PpapiHostMsg_ChannelCreated(channel_handle)); + new PpapiHostMsg_NaClChannelCreated(channel_handle)); task_runner_->PostTask(FROM_HERE, base::Bind(&NaClIPCAdapter::SendMessageOnIOThread, this, base::Passed(&response))); |