summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/plugin_channel.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 20:37:52 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 20:37:52 +0000
commitd2e884d22945641cc92afa1a7d29329b75809ce8 (patch)
treefdda6c3e63f93ded0217f7e68b5dcd803c6bd010 /chrome/plugin/plugin_channel.cc
parent5a639de2090282a219922cc5799116919320cb18 (diff)
downloadchromium_src-d2e884d22945641cc92afa1a7d29329b75809ce8.zip
chromium_src-d2e884d22945641cc92afa1a7d29329b75809ce8.tar.gz
chromium_src-d2e884d22945641cc92afa1a7d29329b75809ce8.tar.bz2
posix: two related changes to make plugin IPC work on POSIX.
[re-retry, seeing if reliability bots like it] * 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@18950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_channel.cc')
-rw-r--r--chrome/plugin/plugin_channel.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index 4ff7b2b..b9e7a52 100644
--- a/chrome/plugin/plugin_channel.cc
+++ b/chrome/plugin/plugin_channel.cc
@@ -7,17 +7,29 @@
#include "base/command_line.h"
#include "base/process_util.h"
#include "base/string_util.h"
+#include "build/build_config.h"
#include "chrome/common/child_process.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/plugin/plugin_thread.h"
+#if defined(OS_POSIX)
+#include "chrome/common/ipc_channel_posix.h"
+#endif
+
PluginChannel* PluginChannel::GetPluginChannel(
- int process_id, MessageLoop* ipc_message_loop) {
+ int process_id, MessageLoop* ipc_message_loop, int channel_fd) {
// map renderer's process id to a (single) channel to that process
std::string channel_name = StringPrintf(
"%d.r%d", base::GetCurrentProcId(), process_id);
+#if defined(OS_POSIX)
+ // If we were provided an already-open channel, associate it with
+ // the channel name in this process's name<->socket map.
+ if (channel_fd > 0)
+ IPC::AddChannelSocket(channel_name, channel_fd);
+#endif
+
return static_cast<PluginChannel*>(PluginChannelBase::GetChannel(
channel_name,
IPC::Channel::MODE_SERVER,