summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_channel.cc4
-rw-r--r--chrome/plugin/plugin_channel_base.cc15
-rw-r--r--chrome/plugin/plugin_channel_base.h2
3 files changed, 14 insertions, 7 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index 2ea37be..941db8c 100644
--- a/chrome/plugin/plugin_channel.cc
+++ b/chrome/plugin/plugin_channel.cc
@@ -136,12 +136,12 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter {
PluginChannel* PluginChannel::GetPluginChannel(int renderer_id,
MessageLoop* ipc_message_loop) {
// Map renderer ID to a (single) channel to that process.
- std::string channel_name = StringPrintf(
+ std::string channel_key = StringPrintf(
"%d.r%d", base::GetCurrentProcId(), renderer_id);
PluginChannel* channel =
static_cast<PluginChannel*>(PluginChannelBase::GetChannel(
- channel_name,
+ channel_key,
IPC::Channel::MODE_SERVER,
ClassFactory,
ipc_message_loop,
diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc
index 5d18654..df7cccc 100644
--- a/chrome/plugin/plugin_channel_base.cc
+++ b/chrome/plugin/plugin_channel_base.cc
@@ -9,6 +9,7 @@
#include "base/auto_reset.h"
#include "base/hash_tables.h"
#include "base/lazy_instance.h"
+#include "base/string_number_conversions.h"
#include "chrome/common/child_process.h"
#include "ipc/ipc_sync_message.h"
@@ -24,13 +25,15 @@ static PluginChannelMap g_plugin_channels_;
static base::LazyInstance<std::stack<scoped_refptr<PluginChannelBase> > >
lazy_plugin_channel_stack_(base::LINKER_INITIALIZED);
+static int next_pipe_id = 0;
+
PluginChannelBase* PluginChannelBase::GetChannel(
- const std::string& channel_name, IPC::Channel::Mode mode,
+ const std::string& channel_key, IPC::Channel::Mode mode,
PluginChannelFactory factory, MessageLoop* ipc_message_loop,
bool create_pipe_now) {
scoped_refptr<PluginChannelBase> channel;
- PluginChannelMap::const_iterator iter = g_plugin_channels_.find(channel_name);
+ PluginChannelMap::const_iterator iter = g_plugin_channels_.find(channel_key);
if (iter == g_plugin_channels_.end()) {
channel = factory();
} else {
@@ -40,10 +43,14 @@ PluginChannelBase* PluginChannelBase::GetChannel(
DCHECK(channel != NULL);
if (!channel->channel_valid()) {
- channel->channel_name_ = channel_name;
+ channel->channel_name_ = channel_key;
+ if (mode == IPC::Channel::MODE_SERVER) {
+ channel->channel_name_.append(".");
+ channel->channel_name_.append(base::IntToString(next_pipe_id++));
+ }
channel->mode_ = mode;
if (channel->Init(ipc_message_loop, create_pipe_now)) {
- g_plugin_channels_[channel_name] = channel;
+ g_plugin_channels_[channel_key] = channel;
} else {
channel = NULL;
}
diff --git a/chrome/plugin/plugin_channel_base.h b/chrome/plugin/plugin_channel_base.h
index a67049a..30fdc22 100644
--- a/chrome/plugin/plugin_channel_base.h
+++ b/chrome/plugin/plugin_channel_base.h
@@ -75,7 +75,7 @@ class PluginChannelBase : public IPC::Channel::Listener,
// must still ref count the returned value. When there are no more routes
// on the channel and its ref count is 0, the object deletes itself.
static PluginChannelBase* GetChannel(
- const std::string& channel_name, IPC::Channel::Mode mode,
+ const std::string& channel_key, IPC::Channel::Mode mode,
PluginChannelFactory factory, MessageLoop* ipc_message_loop,
bool create_pipe_now);