summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/plugin_channel_base.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 20:14:17 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 20:14:17 +0000
commit8ad72d593603097cc468e5c308db81aa26613fff (patch)
tree799b2ebec6c975f1fd06eaff27a82977b2125adb /chrome/plugin/plugin_channel_base.cc
parent2df19bbe98514cda5a61d0805b62beacd85a85d0 (diff)
downloadchromium_src-8ad72d593603097cc468e5c308db81aa26613fff.zip
chromium_src-8ad72d593603097cc468e5c308db81aa26613fff.tar.gz
chromium_src-8ad72d593603097cc468e5c308db81aa26613fff.tar.bz2
Fix for the missing plugin message displayed at times on sites like youtube while playing
playlists, etc. The message is displayed when we fail to create a channel for the plugin process. The problem occurs because of a race condition between the plugin channel information being deleted from the channel map and the actual channel being deleted. This race occurs if the plugin is in the context of a sync call to the renderer which results in the plugin instance being deleted and the new one getting created in the same context. This results in the plugin channel information getting deleted from the map. The actual channel gets deleted only when the plugin sync call unwinds which occurs after the browser sends in a request to create the channel for the new plugin instance. Fix is to create the channel name with an incrementing number in the plugin process, if the mode is server. The channel map is still keyed off the process id and renderer id as before. Fixes bug http://code.google.com/p/chromium/issues/detail?id=43595 Bug=43595 Test=Covered by new ui test SelfDeleteCreatePluginInNPNEvaluate. The other change is a fix in the test plugin to delete a windows timer correctly and to add support for a new plugin test case. Review URL: http://codereview.chromium.org/3142039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_channel_base.cc')
-rw-r--r--chrome/plugin/plugin_channel_base.cc15
1 files changed, 11 insertions, 4 deletions
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;
}