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

Unified Diff: webkit/glue/plugins/plugin_lib.cc

Issue 5020001: Don't call NP_Shutdown in FreePluginLibraryTask if the library has already been reloaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « webkit/data/plugins/force_reload.html ('k') | webkit/tools/test_shell/plugin_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/plugin_lib.cc
===================================================================
--- webkit/glue/plugins/plugin_lib.cc (revision 66158)
+++ webkit/glue/plugins/plugin_lib.cc (working copy)
@@ -235,25 +235,41 @@
// This class implements delayed NP_Shutdown and FreeLibrary on the plugin dll.
class FreePluginLibraryTask : public Task {
public:
- FreePluginLibraryTask(base::NativeLibrary library,
+ FreePluginLibraryTask(const FilePath& path,
+ base::NativeLibrary library,
NP_ShutdownFunc shutdown_func)
- : library_(library),
+ : path_(path),
+ library_(library),
NP_Shutdown_(shutdown_func) {
}
~FreePluginLibraryTask() {}
void Run() {
- if (NP_Shutdown_)
- NP_Shutdown_();
+ if (NP_Shutdown_) {
+ // Don't call NP_Shutdown if the library has been reloaded since this task
+ // was posted.
+ bool reloaded = false;
+ if (g_loaded_libs) {
+ for (size_t i = 0; i < g_loaded_libs->size(); ++i) {
+ if ((*g_loaded_libs)[i]->plugin_info().path == path_)
+ reloaded = true;
+ }
+ }
+ if (!reloaded)
+ NP_Shutdown_();
+ }
if (library_) {
+ // Always call base::UnloadNativeLibrary so that the system reference
+ // count is decremented.
base::UnloadNativeLibrary(library_);
library_ = NULL;
}
}
private:
+ FilePath path_;
base::NativeLibrary library_;
NP_ShutdownFunc NP_Shutdown_;
DISALLOW_COPY_AND_ASSIGN(FreePluginLibraryTask);
@@ -277,7 +293,8 @@
if (defer_unload) {
FreePluginLibraryTask* free_library_task =
- new FreePluginLibraryTask(skip_unload_ ? NULL : library_,
+ new FreePluginLibraryTask(web_plugin_info_.path,
+ skip_unload_ ? NULL : library_,
entry_points_.np_shutdown);
LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Scheduling delayed unload for plugin "
« no previous file with comments | « webkit/data/plugins/force_reload.html ('k') | webkit/tools/test_shell/plugin_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698