Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1151)

Unified Diff: content/renderer/webplugin_delegate_proxy.cc

Issue 10824388: Retry channel setup for NPAPI plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge oops. This time tried compiling before... Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/np_channel_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webplugin_delegate_proxy.cc
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index a72e872d59642f34ddce93e6d7f84dc544aa2495..de54a894ac4f9b37d7529b9845ec4177cecea029 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -301,59 +301,74 @@ bool WebPluginDelegateProxy::Initialize(
const std::vector<std::string>& arg_values,
webkit::npapi::WebPlugin* plugin,
bool load_manually) {
+ // TODO(shess): Attempt to work around http://crbug.com/97285 and
+ // http://crbug.com/141055 by retrying the connection. Reports seem
+ // to indicate that the plugin hasn't crashed, and that the problem
+ // is not 100% persistent.
+ const size_t kAttempts = 2;
+
+ bool result = false;
+ scoped_refptr<PluginChannelHost> channel_host;
+ int instance_id = 0;
+
+ for (size_t attempt = 0; !result && attempt < kAttempts; attempt++) {
#if defined(OS_MACOSX)
- // TODO(shess): Debugging for http://crbug.com/97285 . See comment
- // in plugin_channel_host.cc.
- scoped_ptr<AutoReset<bool> > track_nested_removes(new AutoReset<bool>(
- PluginChannelHost::GetRemoveTrackingFlag(), true));
+ // TODO(shess): Debugging for http://crbug.com/97285 . See comment
+ // in plugin_channel_host.cc.
+ scoped_ptr<AutoReset<bool> > track_nested_removes(new AutoReset<bool>(
+ PluginChannelHost::GetRemoveTrackingFlag(), true));
#endif
- IPC::ChannelHandle channel_handle;
- if (!RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPlugin(
- render_view_->routing_id(), url, page_url_, mime_type_,
- &channel_handle, &info_))) {
- return false;
- }
-
- if (channel_handle.name.empty()) {
- // We got an invalid handle. Either the plugin couldn't be found (which
- // shouldn't happen, since if we got here the plugin should exist) or the
- // plugin crashed on initialization.
- if (!info_.path.empty()) {
- render_view_->PluginCrashed(info_.path);
- LOG(ERROR) << "Plug-in crashed on start";
+ IPC::ChannelHandle channel_handle;
+ if (!RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPlugin(
+ render_view_->routing_id(), url, page_url_, mime_type_,
+ &channel_handle, &info_))) {
+ continue;
+ }
- // Return true so that the plugin widget is created and we can paint the
- // crashed plugin there.
- return true;
+ if (channel_handle.name.empty()) {
+ // We got an invalid handle. Either the plugin couldn't be found (which
+ // shouldn't happen, since if we got here the plugin should exist) or the
+ // plugin crashed on initialization.
+ if (!info_.path.empty()) {
+ render_view_->PluginCrashed(info_.path);
+ LOG(ERROR) << "Plug-in crashed on start";
+
+ // Return true so that the plugin widget is created and we can paint the
+ // crashed plugin there.
+ return true;
+ }
+ LOG(ERROR) << "Plug-in couldn't be found";
+ return false;
}
- LOG(ERROR) << "Plug-in couldn't be found";
- return false;
- }
- scoped_refptr<PluginChannelHost> channel_host(
- PluginChannelHost::GetPluginChannelHost(
- channel_handle, ChildProcess::current()->io_message_loop_proxy()));
- if (!channel_host.get()) {
- LOG(ERROR) << "Couldn't get PluginChannelHost";
- return false;
- }
+ channel_host =
+ PluginChannelHost::GetPluginChannelHost(
+ channel_handle, ChildProcess::current()->io_message_loop_proxy());
+ if (!channel_host.get()) {
+ LOG(ERROR) << "Couldn't get PluginChannelHost";
+ continue;
+ }
#if defined(OS_MACOSX)
- track_nested_removes.reset();
+ track_nested_removes.reset();
#endif
- int instance_id;
- {
- // TODO(bauerb): Debugging for http://crbug.com/141055.
- ScopedLogLevel log_level(-2); // Equivalent to --v=2
- bool result = channel_host->Send(new PluginMsg_CreateInstance(
- mime_type_, &instance_id));
- if (!result) {
- LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance";
- return false;
+ {
+ // TODO(bauerb): Debugging for http://crbug.com/141055.
+ ScopedLogLevel log_level(-2); // Equivalent to --v=2
+ result = channel_host->Send(new PluginMsg_CreateInstance(
+ mime_type_, &instance_id));
+ if (!result) {
+ LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance";
+ continue;
+ }
}
}
+ // Failed too often, give up.
+ if (!result)
+ return false;
+
channel_host_ = channel_host;
instance_id_ = instance_id;
@@ -384,7 +399,7 @@ bool WebPluginDelegateProxy::Initialize(
plugin_ = plugin;
- bool result = false;
+ result = false;
IPC::Message* msg = new PluginMsg_Init(instance_id_, params, &result);
Send(msg);
« no previous file with comments | « content/common/np_channel_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698