diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 05:35:07 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 05:35:07 +0000 |
commit | fa6caa4ffb83896cb42198f35ca7837ae3b7c83c (patch) | |
tree | 7f42b778a87a10b5db39bbe26f3d380dda05f8eb /chrome | |
parent | a57ea3fc6c3cfe3b44dcd0771d0d56c76bd238df (diff) | |
download | chromium_src-fa6caa4ffb83896cb42198f35ca7837ae3b7c83c.zip chromium_src-fa6caa4ffb83896cb42198f35ca7837ae3b7c83c.tar.gz chromium_src-fa6caa4ffb83896cb42198f35ca7837ae3b7c83c.tar.bz2 |
Fix regression from r11509 which caused each plugin instance to have its own IPC channel (doh!).
BUG=119052
TEST=covered by ui test that Amit added
Review URL: http://codereview.chromium.org/119158
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 1 | ||||
-rw-r--r-- | chrome/common/plugin_messages_internal.h | 7 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel.cc | 7 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel.h | 3 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel_base.cc | 3 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel_base.h | 2 | ||||
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 4 | ||||
-rw-r--r-- | chrome/plugin/plugin_thread.h | 2 |
8 files changed, 17 insertions, 12 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 39ec81d..921f860 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -524,6 +524,7 @@ void PluginProcessHost::RequestPluginChannel( // a deadlock can occur if the plugin creation request from the renderer is // a result of a sync message by the plugin process. PluginProcessMsg_CreateChannel* msg = new PluginProcessMsg_CreateChannel( + renderer_message_filter->GetProcessId(), renderer_message_filter->off_the_record()); msg->set_unblock(true); if (Send(msg)) { diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index da8cd13d..b2805fc 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -12,8 +12,11 @@ IPC_BEGIN_MESSAGES(PluginProcess) // Tells the plugin process to create a new channel for communication with a // renderer. The channel name is returned in a - // PluginProcessHostMsg_ChannelCreated message. - IPC_MESSAGE_CONTROL1(PluginProcessMsg_CreateChannel, + // PluginProcessHostMsg_ChannelCreated message. The renderer's process_id is + // passed so that the plugin process reuses an existing channel to that + // process if it exists. + IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, + int /* process_id */, bool /* off_the_record */) // Allows a chrome plugin loaded in the browser process to send arbitrary diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index 5d6143e..4ff7b2b 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -12,10 +12,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/plugin/plugin_thread.h" -PluginChannel* PluginChannel::GetPluginChannel(MessageLoop* ipc_message_loop) { - static int next_id; +PluginChannel* PluginChannel::GetPluginChannel( + int process_id, MessageLoop* ipc_message_loop) { + // map renderer's process id to a (single) channel to that process std::string channel_name = StringPrintf( - "%d.r%d", base::GetCurrentProcId(), ++next_id); + "%d.r%d", base::GetCurrentProcId(), process_id); return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( channel_name, diff --git a/chrome/plugin/plugin_channel.h b/chrome/plugin/plugin_channel.h index a1643d1..f0bba80 100644 --- a/chrome/plugin/plugin_channel.h +++ b/chrome/plugin/plugin_channel.h @@ -15,7 +15,8 @@ // process. On the renderer side there's a corresponding PluginChannelHost. class PluginChannel : public PluginChannelBase { public: - static PluginChannel* GetPluginChannel(MessageLoop* ipc_message_loop); + static PluginChannel* GetPluginChannel( + int process_id, MessageLoop* ipc_message_loop); ~PluginChannel(); diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc index d939a179..c05321b 100644 --- a/chrome/plugin/plugin_channel_base.cc +++ b/chrome/plugin/plugin_channel_base.cc @@ -47,14 +47,13 @@ PluginChannelBase::PluginChannelBase() peer_pid_(0), in_remove_route_(false), channel_valid_(false), + in_dispatch_(0), send_unblocking_only_during_dispatch_(false) { } PluginChannelBase::~PluginChannelBase() { } -int PluginChannelBase::in_dispatch_ = 0; - void PluginChannelBase::CleanupChannels() { // Make a copy of the references as we can't iterate the map since items will // be removed from it as we clean them up. diff --git a/chrome/plugin/plugin_channel_base.h b/chrome/plugin/plugin_channel_base.h index 7cb816a..877ce70 100644 --- a/chrome/plugin/plugin_channel_base.h +++ b/chrome/plugin/plugin_channel_base.h @@ -110,7 +110,7 @@ class PluginChannelBase : public IPC::Channel::Listener, // Track whether we're within a dispatch; works like a refcount, 0 when we're // not. - static int in_dispatch_; + int in_dispatch_; // If true, sync messages will only be marked as unblocking if the channel is // in the middle of dispatching a message. diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 8f71662..08c96c9 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -97,10 +97,10 @@ void PluginThread::CleanUp() { ChildThread::CleanUp(); } -void PluginThread::OnCreateChannel(bool off_the_record) { +void PluginThread::OnCreateChannel(int process_id, bool off_the_record) { std::string channel_name; scoped_refptr<PluginChannel> channel = - PluginChannel::GetPluginChannel(owner_loop()); + PluginChannel::GetPluginChannel(process_id, owner_loop()); if (channel.get()) { channel_name = channel->channel_name(); channel->set_off_the_record(off_the_record); diff --git a/chrome/plugin/plugin_thread.h b/chrome/plugin/plugin_thread.h index 06b2f7f..052be0a 100644 --- a/chrome/plugin/plugin_thread.h +++ b/chrome/plugin/plugin_thread.h @@ -31,7 +31,7 @@ class PluginThread : public ChildThread { virtual void Init(); virtual void CleanUp(); - void OnCreateChannel(bool off_the_record); + void OnCreateChannel(int process_id, bool off_the_record); void OnPluginMessage(const std::vector<uint8> &data); scoped_ptr<NotificationService> notification_service_; |