summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/common_glue.cc12
-rw-r--r--chrome/default_plugin/plugin_main.cc7
-rw-r--r--content/plugin/plugin_thread.cc10
-rw-r--r--webkit/glue/webkit_glue.cc6
-rw-r--r--webkit/glue/webkit_glue.h19
-rw-r--r--webkit/plugins/npapi/plugin_lib.cc10
-rw-r--r--webkit/plugins/npapi/plugin_lib.h8
-rw-r--r--webkit/plugins/npapi/plugin_list.cc7
-rw-r--r--webkit/plugins/npapi/plugin_list.h3
-rw-r--r--webkit/plugins/npapi/plugin_list_win.cc12
-rw-r--r--webkit/support/webkit_support.cc2
-rw-r--r--webkit/support/webkit_support_glue.cc12
-rw-r--r--webkit/tools/test_shell/test_shell.cc27
13 files changed, 35 insertions, 100 deletions
diff --git a/chrome/common/common_glue.cc b/chrome/common/common_glue.cc
index d02a9c8..18b13cc 100644
--- a/chrome/common/common_glue.cc
+++ b/chrome/common/common_glue.cc
@@ -17,18 +17,6 @@
namespace webkit_glue {
-bool GetExeDirectory(FilePath* path) {
- return PathService::Get(base::DIR_EXE, path);
-}
-
-bool GetApplicationDirectory(FilePath* path) {
- return PathService::Get(chrome::DIR_APP, path);
-}
-
-bool IsPluginRunningInRendererProcess() {
- return !IsPluginProcess();
-}
-
std::string GetWebKitLocale() {
// The browser process should have passed the locale to the renderer via the
// --lang command line flag. In single process mode, this will return the
diff --git a/chrome/default_plugin/plugin_main.cc b/chrome/default_plugin/plugin_main.cc
index 2e5b808..f7b15ab 100644
--- a/chrome/default_plugin/plugin_main.cc
+++ b/chrome/default_plugin/plugin_main.cc
@@ -163,13 +163,6 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16_t mode,
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
- // We don't want the null plugin to work in the following cases:-
- // 1. Test-shell
- // 2. The plugin is running in the renderer process.
- if (webkit_glue::IsPluginRunningInRendererProcess()) {
- return NPERR_GENERIC_ERROR;
- }
-
if (!NegotiateModels(instance))
return NPERR_INCOMPATIBLE_VERSION_ERROR;
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index b6ca82a..eda6c92 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -78,8 +78,12 @@ PluginThread::PluginThread()
scoped_refptr<webkit::npapi::PluginLib> plugin(
webkit::npapi::PluginLib::CreatePluginLib(plugin_path_));
- if (plugin.get())
+ if (plugin.get()) {
plugin->NP_Initialize();
+ // For OOP plugins the plugin dll will be unloaded during process shutdown
+ // time.
+ plugin->set_defer_unload(true);
+ }
content::GetContentClient()->plugin()->PluginProcessStarted(
plugin.get() ? plugin->plugin_info().name : string16());
@@ -140,10 +144,6 @@ void PluginThread::OnNotifyRenderersOfPendingShutdown() {
}
namespace webkit_glue {
-bool IsDefaultPluginEnabled() {
- return true;
-}
-
bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
int net_error;
std::string proxy_result;
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 7e393d9..2749a46 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -14,6 +14,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/path_service.h"
#include "base/string_piece.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
@@ -391,11 +392,6 @@ const std::string& GetUserAgent(const GURL& url) {
}
void SetForcefullyTerminatePluginProcess(bool value) {
- if (IsPluginRunningInRendererProcess()) {
- // Ignore this quirk when the plugins are not running in their own process.
- return;
- }
-
g_forcefully_terminate_plugin_process = value;
}
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 8136a28..b1767f2 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -206,29 +206,10 @@ bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type,
bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer,
std::vector<string16>* filenames);
-// Gets the directory where the application data and libraries exist. This
-// may be a versioned subdirectory, or it may be the same directory as the
-// GetExeDirectory(), depending on the embedder's implementation.
-// Path is an output parameter to receive the path.
-// Returns true if successful, false otherwise.
-bool GetApplicationDirectory(FilePath* path);
-
-// Gets the directory where the launching executable resides on disk.
-// Path is an output parameter to receive the path.
-// Returns true if successful, false otherwise.
-bool GetExeDirectory(FilePath* path);
-
// Embedders implement this function to return the list of plugins to Webkit.
void GetPlugins(bool refresh,
std::vector<webkit::npapi::WebPluginInfo>* plugins);
-// Returns true if the plugins run in the same process as the renderer, and
-// false otherwise.
-bool IsPluginRunningInRendererProcess();
-
-// Returns a bool indicating if the Null plugin should be enabled or not.
-bool IsDefaultPluginEnabled();
-
// Returns true if the protocol implemented to serve |url| supports features
// required by the media engine.
bool IsProtocolSupportedForMedia(const GURL& url);
diff --git a/webkit/plugins/npapi/plugin_lib.cc b/webkit/plugins/npapi/plugin_lib.cc
index 2db2a52..28d6b6c 100644
--- a/webkit/plugins/npapi/plugin_lib.cc
+++ b/webkit/plugins/npapi/plugin_lib.cc
@@ -72,7 +72,8 @@ PluginLib::PluginLib(const WebPluginInfo& info,
initialized_(false),
saved_data_(0),
instance_count_(0),
- skip_unload_(false) {
+ skip_unload_(false),
+ defer_unload_(false) {
base::StatsCounter(kPluginLibrariesLoadedCounter).Increment();
memset(static_cast<void*>(&plugin_funcs_), 0, sizeof(plugin_funcs_));
g_loaded_libs->push_back(make_scoped_refptr(this));
@@ -170,7 +171,7 @@ void PluginLib::CloseInstance() {
instance_count_--;
// If a plugin is running in its own process it will get unloaded on process
// shutdown.
- if ((instance_count_ == 0) && webkit_glue::IsPluginRunningInRendererProcess())
+ if ((instance_count_ == 0) && !defer_unload_)
Unload();
}
@@ -315,8 +316,6 @@ void PluginLib::Unload() {
// In case of single process mode, a plugin can delete itself
// by executing a script. So delay the unloading of the library
// so that the plugin will have a chance to unwind.
- bool defer_unload = webkit_glue::IsPluginRunningInRendererProcess();
-
/* TODO(dglazkov): Revisit when re-enabling the JSC build.
#if USE(JSC)
// The plugin NPAPI instances may still be around. Delay the
@@ -325,8 +324,7 @@ void PluginLib::Unload() {
defer_unload = true;
#endif
*/
-
- if (defer_unload) {
+ if (!defer_unload_) {
FreePluginLibraryTask* free_library_task =
new FreePluginLibraryTask(web_plugin_info_.path,
skip_unload_ ? NULL : library_,
diff --git a/webkit/plugins/npapi/plugin_lib.h b/webkit/plugins/npapi/plugin_lib.h
index 3ba52e9..e501ccb 100644
--- a/webkit/plugins/npapi/plugin_lib.h
+++ b/webkit/plugins/npapi/plugin_lib.h
@@ -91,6 +91,11 @@ class PluginLib : public base::RefCounted<PluginLib> {
// some plugins crash if unloaded).
void PreventLibraryUnload();
+ // Indicates whether plugin unload can be deferred.
+ void set_defer_unload(bool defer_unload) {
+ defer_unload_ = defer_unload;
+ }
+
// protected for testability.
protected:
friend class base::RefCounted<PluginLib>;
@@ -125,6 +130,9 @@ class PluginLib : public base::RefCounted<PluginLib> {
// Function pointers to entry points into the plugin.
PluginEntryPoints entry_points_;
+ // Set to true if unloading of the plugin dll is to be deferred.
+ bool defer_unload_;
+
DISALLOW_COPY_AND_ASSIGN(PluginLib);
};
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index fb81bca..08b3528 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -241,6 +241,8 @@ void PluginList::RegisterInternalPlugin(const FilePath& filename,
base::AutoLock lock(lock_);
internal_plugins_.push_back(plugin);
+ if (filename.value() == kDefaultPluginLibraryName)
+ default_plugin_enabled_ = true;
}
void PluginList::UnregisterInternalPlugin(const FilePath& path) {
@@ -323,7 +325,8 @@ PluginList::PluginList()
plugins_need_refresh_(false),
disable_outdated_plugins_(false),
group_definitions_(kGroupDefinitions),
- num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)) {
+ num_group_definitions_(ARRAYSIZE_UNSAFE(kGroupDefinitions)),
+ default_plugin_enabled_(false) {
PlatformInit();
AddHardcodedPluginGroups(&plugin_groups_);
}
@@ -392,7 +395,7 @@ void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) {
#endif
// Load the default plugin last.
- if (webkit_glue::IsDefaultPluginEnabled())
+ if (default_plugin_enabled_)
LoadPlugin(FilePath(kDefaultPluginLibraryName), plugin_groups);
}
diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h
index 424742c..255b2f8 100644
--- a/webkit/plugins/npapi/plugin_list.h
+++ b/webkit/plugins/npapi/plugin_list.h
@@ -342,6 +342,9 @@ class PluginList {
// accessed on multiple threads.
base::Lock lock_;
+ // Set to true if the default plugin is enabled.
+ bool default_plugin_enabled_;
+
DISALLOW_COPY_AND_ASSIGN(PluginList);
};
diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc
index 908ed35..6e41f2d 100644
--- a/webkit/plugins/npapi/plugin_list_win.cc
+++ b/webkit/plugins/npapi/plugin_list_win.cc
@@ -47,20 +47,24 @@ const char16 kRegistryJavaHome[] = L"JavaHome";
const char16 kJavaDeploy1[] = L"npdeploytk.dll";
const char16 kJavaDeploy2[] = L"npdeployjava1.dll";
-// The application path where we expect to find plugins.
+// Gets the directory where the application data and libraries exist. This
+// may be a versioned subdirectory, or it may be the same directory as the
+// GetExeDirectory(), depending on the embedder's implementation.
+// Path is an output parameter to receive the path.
void GetAppDirectory(std::set<FilePath>* plugin_dirs) {
FilePath app_path;
- if (!webkit_glue::GetApplicationDirectory(&app_path))
+ if (!PathService::Get(base::DIR_MODULE, &app_path))
return;
app_path = app_path.AppendASCII("plugins");
plugin_dirs->insert(app_path);
}
-// The executable path where we expect to find plugins.
+// Gets the directory where the launching executable resides on disk.
+// Path is an output parameter to receive the path.
void GetExeDirectory(std::set<FilePath>* plugin_dirs) {
FilePath exe_path;
- if (!webkit_glue::GetExeDirectory(&exe_path))
+ if (!PathService::Get(base::DIR_EXE, &exe_path))
return;
exe_path = exe_path.AppendASCII("plugins");
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 8210aaa..ae6f08a 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -566,7 +566,7 @@ WebKit::WebThemeEngine* GetThemeEngine() {
// DevTools
WebURL GetDevToolsPathAsURL() {
FilePath dirExe;
- if (!webkit_glue::GetExeDirectory(&dirExe)) {
+ if (!PathService::Get(base::DIR_EXE, &dirExe)) {
DCHECK(false);
return WebURL();
}
diff --git a/webkit/support/webkit_support_glue.cc b/webkit/support/webkit_support_glue.cc
index 522cfa9..f7bcf50 100644
--- a/webkit/support/webkit_support_glue.cc
+++ b/webkit/support/webkit_support_glue.cc
@@ -38,21 +38,9 @@ bool IsDefaultPluginEnabled() {
return false;
}
-bool IsPluginRunningInRendererProcess() {
- return true;
-}
-
void AppendToLog(const char*, int, const char*) {
}
-bool GetApplicationDirectory(FilePath* path) {
- return PathService::Get(base::DIR_EXE, path);
-}
-
-bool GetExeDirectory(FilePath* path) {
- return GetApplicationDirectory(path);
-}
-
bool IsProtocolSupportedForMedia(const GURL& url) {
if (url.SchemeIsFile() ||
url.SchemeIs("http") ||
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 448368f..77a4523 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -625,33 +625,6 @@ WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() {
namespace webkit_glue {
-bool GetApplicationDirectory(FilePath* path) {
- return PathService::Get(base::DIR_EXE, path);
-}
-
-bool GetExeDirectory(FilePath* path) {
- return GetApplicationDirectory(path);
-}
-
-bool IsPluginRunningInRendererProcess() {
- return true;
-}
-
-bool GetPluginFinderURL(std::string* plugin_finder_url) {
- return false;
-}
-
-bool IsDefaultPluginEnabled() {
- FilePath exe_path;
-
- if (PathService::Get(base::FILE_EXE, &exe_path)) {
- std::string exe_name = exe_path.BaseName().MaybeAsASCII();
- if (StartsWithASCII(exe_name, "test_shell_tests", false))
- return true;
- }
- return false;
-}
-
bool IsProtocolSupportedForMedia(const GURL& url) {
if (url.SchemeIsFile() ||
url.SchemeIs("http") ||