diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-20 03:10:51 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-20 03:10:51 +0000 |
commit | 76724d00d3498f952d945d775a3f33f751624121 (patch) | |
tree | aa28e1bb6656708708780693443a275a2d5d43d8 /chrome/renderer/webplugin_delegate_proxy.cc | |
parent | dd86209f364eb604bb42a47dea7ae177d7166632 (diff) | |
download | chromium_src-76724d00d3498f952d945d775a3f33f751624121.zip chromium_src-76724d00d3498f952d945d775a3f33f751624121.tar.gz chromium_src-76724d00d3498f952d945d775a3f33f751624121.tar.bz2 |
posix: two related changes to make plugin IPC work on POSIX.
[retry, fix windows compile failure]
* use a new ChannelHandle type when passing IPC channels over IPC
The current POSIX code assumes that one end of a channel is always a new
child process (a renderer). For plugins we need to be able to construct
channels between each of the browser, plugin, and renderer.
This change augments the messages related to creating channels to allow
passing in a base::FileDescriptor containing the socket. The intent is
that the browser process, as the initial interchange between plugin and
renderer, creates the socketpair() on their behalf and hands each their
respective end of the connection.
* register channel endpoint names in the global pipe map
The plugin code assumes it can map from a string to a channel endpoint
at basically any time. So whenever we get a channel endpoint over IPC,
we install it in a global map of channel endpoints.
Review URL: http://codereview.chromium.org/113157
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 87d3ec1..8117acf 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -41,6 +41,10 @@ #include "chrome/common/gfx/emf.h" #endif +#if defined(OS_POSIX) +#include "chrome/common/ipc_channel_posix.h" +#endif + using WebKit::WebInputEvent; using WebKit::WebDragData; using WebKit::WebVector; @@ -207,16 +211,24 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, char** argv, int argc, WebPlugin* plugin, bool load_manually) { - std::string channel_name; + IPC::ChannelHandle channel_handle; FilePath plugin_path; if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( url, mime_type_, clsid_, webkit_glue::GetWebKitLocale(), - &channel_name, &plugin_path))) + &channel_handle, &plugin_path))) { return false; + } + +#if defined(OS_POSIX) + // If we received a ChannelHandle, register it now. + if (channel_handle.socket.fd >= 0) + IPC::AddChannelSocket(channel_handle.name, channel_handle.socket.fd); +#endif MessageLoop* ipc_message_loop = RenderThread::current()->owner_loop(); scoped_refptr<PluginChannelHost> channel_host = - PluginChannelHost::GetPluginChannelHost(channel_name, ipc_message_loop); + PluginChannelHost::GetPluginChannelHost(channel_handle.name, + ipc_message_loop); if (!channel_host.get()) return false; |