summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 17:57:38 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 17:57:38 +0000
commit679d965b4292d028e68591c2d0d2b84e23eed005 (patch)
tree6b23e979cd5a2884564f83c7a1aca3c312f60ba1 /webkit
parentd01f431e5e9eb08fbabd807985446c3169d0585d (diff)
downloadchromium_src-679d965b4292d028e68591c2d0d2b84e23eed005.zip
chromium_src-679d965b4292d028e68591c2d0d2b84e23eed005.tar.gz
chromium_src-679d965b4292d028e68591c2d0d2b84e23eed005.tar.bz2
Miscellaneous webkit_glue namespace changes in preparation for building src\content as a dll. This CL
removes the IsDefaultPluginEnabled function in the webkit_glue namespace. This function has been replaced by a flag in the PluginList instance which is set when the default plugin is registered as an internal plugin. The webkit_glue.cc file now implements the GetApplicationDirectory and GetExeDirectory functions in the webkit_glue namespace. Previously these functions were implemented in common_glue.cc and in test_shell. Removed the IsPluginRunningInRendererProcess function from webkit_glue and fixed the callers to not depend on this functionality. BUG=82454 Review URL: http://codereview.chromium.org/6975028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-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
10 files changed, 30 insertions, 76 deletions
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") ||