summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 21:10:25 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 21:10:25 +0000
commitc18388fbdee1812b724d90b7736291502e6dd68f (patch)
tree6c6c3e74cc2e815330f9843f3a4aa23b8d0a1944
parent4880161eeb57ce0911dc2b2c7d9b8f374d5e7f4f (diff)
downloadchromium_src-c18388fbdee1812b724d90b7736291502e6dd68f.zip
chromium_src-c18388fbdee1812b724d90b7736291502e6dd68f.tar.gz
chromium_src-c18388fbdee1812b724d90b7736291502e6dd68f.tar.bz2
Don't attempt to unload Silverlight on the Mac
BUG=28131 TEST=covered by buildbot (no user-visible effect since the crash happens after the pages are closed) Review URL: http://codereview.chromium.org/597027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38811 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/plugins/plugin_lib.cc13
-rw-r--r--webkit/glue/plugins/plugin_lib.h5
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm4
3 files changed, 19 insertions, 3 deletions
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index 2768fc7..d63045a 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -64,7 +64,8 @@ PluginLib::PluginLib(const WebPluginInfo& info,
library_(0),
initialized_(false),
saved_data_(0),
- instance_count_(0) {
+ instance_count_(0),
+ skip_unload_(false) {
StatsCounter(kPluginLibrariesLoadedCounter).Increment();
memset((void*)&plugin_funcs_, 0, sizeof(plugin_funcs_));
g_loaded_libs->push_back(this);
@@ -127,6 +128,10 @@ void PluginLib::NP_Shutdown(void) {
entry_points_.np_shutdown();
}
+void PluginLib::PreventLibraryUnload() {
+ skip_unload_ = true;
+}
+
PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) {
PluginInstance* new_instance = new PluginInstance(this, mime_type);
instance_count_++;
@@ -259,11 +264,13 @@ void PluginLib::Unload() {
if (defer_unload) {
FreePluginLibraryTask* free_library_task =
- new FreePluginLibraryTask(library_, entry_points_.np_shutdown);
+ new FreePluginLibraryTask(skip_unload_ ? NULL : library_,
+ entry_points_.np_shutdown);
MessageLoop::current()->PostTask(FROM_HERE, free_library_task);
} else {
Shutdown();
- base::UnloadNativeLibrary(library_);
+ if (!skip_unload_)
+ base::UnloadNativeLibrary(library_);
}
library_ = 0;
diff --git a/webkit/glue/plugins/plugin_lib.h b/webkit/glue/plugins/plugin_lib.h
index 7dded2f..6af2893 100644
--- a/webkit/glue/plugins/plugin_lib.h
+++ b/webkit/glue/plugins/plugin_lib.h
@@ -74,6 +74,10 @@ class PluginLib : public base::RefCounted<PluginLib> {
int instance_count() const { return instance_count_; }
+ // Prevents the library code from being unload when Unload() is called (since
+ // some plugins crash if unloaded).
+ void PreventLibraryUnload();
+
private:
friend class base::RefCounted<PluginLib>;
@@ -102,6 +106,7 @@ class PluginLib : public base::RefCounted<PluginLib> {
bool initialized_; // Is the plugin initialized?
NPSavedData *saved_data_; // Persisted plugin info for NPAPI.
int instance_count_; // Count of plugins in use.
+ bool skip_unload_; // True if library_ should not be unloaded.
// Function pointers to entry points into the plugin.
PluginEntryPoints entry_points_;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 014e755..4b5c093 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -219,6 +219,10 @@ void WebPluginDelegateImpl::PlatformInitialize() {
// destroyPlugin in WebNetscapePluginView.mm, for examples).
quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY;
+ // Silverlight doesn't always unload cleanly, so don't unload it at shutdown.
+ if (instance()->mime_type().find("x-silverlight") != std::string::npos)
+ instance()->plugin_lib()->PreventLibraryUnload();
+
#ifndef NP_NO_CARBON
if (instance()->event_model() == NPEventModelCarbon) {
// Create a stand-in for the browser window so that the plugin will have