summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 20:28:01 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 20:28:01 +0000
commita6f77608f3f890eb2ae436bc0b152962d1f3b184 (patch)
tree456f479502ff1b04898bb8066f9f8b53b6863b81 /webkit
parentc19269afdfa949b11b25349b44920ba88dc9ea74 (diff)
downloadchromium_src-a6f77608f3f890eb2ae436bc0b152962d1f3b184.zip
chromium_src-a6f77608f3f890eb2ae436bc0b152962d1f3b184.tar.gz
chromium_src-a6f77608f3f890eb2ae436bc0b152962d1f3b184.tar.bz2
Enhance plugin logging a bit. This adds logging in a few more places, especially for Windows. This also changes the log level to ERROR so that when you opt in to plugin logging, you don't also have to set the log level to be INFO and put up with a low of log spew.
TEST=none BUG=none Review URL: http://codereview.chromium.org/3013039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/plugin_lib.cc20
-rw-r--r--webkit/glue/plugins/plugin_lib_posix.cc12
-rw-r--r--webkit/glue/plugins/plugin_lib_win.cc13
-rw-r--r--webkit/glue/plugins/plugin_list.cc8
-rw-r--r--webkit/glue/plugins/plugin_list_posix.cc18
5 files changed, 42 insertions, 29 deletions
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index 877548e..9a0770e 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -98,8 +98,9 @@ NPPluginFuncs* PluginLib::functions() {
}
NPError PluginLib::NP_Initialize() {
- LOG(INFO) << "PluginLib::NP_Initialize(" << web_plugin_info_.path.value() <<
- "): initialized=" << initialized_;
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "PluginLib::NP_Initialize(" << web_plugin_info_.path.value()
+ << "): initialized=" << initialized_;
if (initialized_)
return NPERR_NO_ERROR;
@@ -123,8 +124,9 @@ NPError PluginLib::NP_Initialize() {
}
#endif // OS_MACOSX
#endif
- LOG(INFO) << "PluginLib::NP_Initialize(" << web_plugin_info_.path.value() <<
- "): result=" << rv;
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "PluginLib::NP_Initialize(" << web_plugin_info_.path.value()
+ << "): result=" << rv;
initialized_ = (rv == NPERR_NO_ERROR);
return rv;
}
@@ -165,7 +167,7 @@ bool PluginLib::Load() {
if (!internal_) {
library = base::LoadNativeLibrary(web_plugin_info_.path);
if (library == 0) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Couldn't load plugin " << web_plugin_info_.path.value();
return rv;
}
@@ -215,12 +217,12 @@ bool PluginLib::Load() {
if (!internal_) {
if (rv) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Plugin " << web_plugin_info_.path.value()
<< " loaded successfully.";
library_ = library;
} else {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Plugin " << web_plugin_info_.path.value()
<< " failed to load, unloading.";
base::UnloadNativeLibrary(library);
@@ -277,14 +279,14 @@ void PluginLib::Unload() {
FreePluginLibraryTask* free_library_task =
new FreePluginLibraryTask(skip_unload_ ? NULL : library_,
entry_points_.np_shutdown);
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Scheduling delayed unload for plugin "
<< web_plugin_info_.path.value();
MessageLoop::current()->PostTask(FROM_HERE, free_library_task);
} else {
Shutdown();
if (!skip_unload_) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Unloading plugin " << web_plugin_info_.path.value();
base::UnloadNativeLibrary(library_);
}
diff --git a/webkit/glue/plugins/plugin_lib_posix.cc b/webkit/glue/plugins/plugin_lib_posix.cc
index dbc64ed..dfeed55 100644
--- a/webkit/glue/plugins/plugin_lib_posix.cc
+++ b/webkit/glue/plugins/plugin_lib_posix.cc
@@ -118,14 +118,14 @@ void UnwrapNSPluginWrapper(void **dl, FilePath* unwrapped_path) {
if (!newdl) {
// We couldn't load the unwrapped plugin for some reason, despite
// being able to load the wrapped one. Just use the wrapped one.
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Could not use unwrapped nspluginwrapper plugin "
<< unwrapped_path->value() << ", using the wrapped one.";
return;
}
// Unload the wrapped plugin, and use the wrapped plugin instead.
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Using unwrapped version " << unwrapped_path->value()
<< " of nspluginwrapper-wrapped plugin.";
base::UnloadNativeLibrary(*dl);
@@ -144,7 +144,7 @@ bool PluginLib::ReadWebPluginInfo(const FilePath& filename,
// Skip files that aren't appropriate for our architecture.
if (!ELFMatchesCurrentArchitecture(filename)) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Skipping plugin " << filename.value()
<< " because it doesn't match the current architecture.";
return false;
@@ -152,7 +152,7 @@ bool PluginLib::ReadWebPluginInfo(const FilePath& filename,
void* dl = base::LoadNativeLibrary(filename);
if (!dl) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "While reading plugin info, unable to load library "
<< filename.value() << ", skipping.";
return false;
@@ -193,12 +193,12 @@ bool PluginLib::ReadWebPluginInfo(const FilePath& filename,
if (description)
info->desc = UTF8ToUTF16(description);
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Got info for plugin " << filename.value()
<< " Name = \"" << UTF16ToUTF8(info->name)
<< "\", Description = \"" << UTF16ToUTF8(info->desc) << "\".";
} else {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Plugin " << filename.value()
<< " has no GetValue() and probably won't work.";
}
diff --git a/webkit/glue/plugins/plugin_lib_win.cc b/webkit/glue/plugins/plugin_lib_win.cc
index 00f6243..382c2c8 100644
--- a/webkit/glue/plugins/plugin_lib_win.cc
+++ b/webkit/glue/plugins/plugin_lib_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,12 +6,13 @@
#include "base/file_version_info.h"
#include "base/file_version_info_win.h"
+#include "base/logging.h"
#include "base/path_service.h"
#include "webkit/glue/plugins/plugin_constants_win.h"
#include "webkit/glue/plugins/plugin_list.h"
-namespace NPAPI
-{
+namespace NPAPI {
+
bool PluginLib::ReadWebPluginInfo(const FilePath &filename,
WebPluginInfo* info) {
// On windows, the way we get the mime types for the library is
@@ -21,8 +22,12 @@ bool PluginLib::ReadWebPluginInfo(const FilePath &filename,
// video/quicktime|audio/aiff|image/jpeg
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(filename.value()));
- if (!version_info.get())
+ if (!version_info.get()) {
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "Could not get version info for plugin "
+ << filename.value();
return false;
+ }
FileVersionInfoWin* version_info_win =
static_cast<FileVersionInfoWin*>(version_info.get());
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index a3412d7..be0ec58 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -108,8 +108,11 @@ bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi,
info->mime_types.clear();
- if (mime_types.empty())
+ if (mime_types.empty()) {
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "Plugin " << pvi.product_name << " has no MIME types, skipping";
return false;
+ }
info->name = WideToUTF16(pvi.product_name);
info->desc = WideToUTF16(pvi.file_description);
@@ -230,6 +233,9 @@ void PluginList::LoadPlugins(bool refresh) {
void PluginList::LoadPlugin(const FilePath& path,
std::vector<WebPluginInfo>* plugins) {
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "Loading plugin " << path.value();
+
WebPluginInfo plugin_info;
const PluginEntryPoints* entry_points;
diff --git a/webkit/glue/plugins/plugin_list_posix.cc b/webkit/glue/plugins/plugin_list_posix.cc
index 1fbd76f..92eef7e 100644
--- a/webkit/glue/plugins/plugin_list_posix.cc
+++ b/webkit/glue/plugins/plugin_list_posix.cc
@@ -183,18 +183,18 @@ void PluginList::LoadPluginsFromDir(const FilePath& dir_path,
// symlinks.
FilePath orig_path = path;
file_util::AbsolutePath(&path);
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Resolved " << orig_path.value() << " -> " << path.value();
if (visited_plugins->find(path) != visited_plugins->end()) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Skipping duplicate instance of " << path.value();
continue;
}
visited_plugins->insert(path);
if (IsBlacklistedPlugin(path)) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Skipping blacklisted plugin " << path.value();
continue;
}
@@ -209,8 +209,9 @@ void PluginList::LoadPluginsFromDir(const FilePath& dir_path,
// Go back to the old path.
path = orig_path;
} else {
- LOG(ERROR) << "Flash misbehaves when used from a directory containing "
- << kNetscapeInPath << ", so skipping " << orig_path.value();
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "Flash misbehaves when used from a directory containing "
+ << kNetscapeInPath << ", so skipping " << orig_path.value();
continue;
}
}
@@ -232,14 +233,13 @@ void PluginList::LoadPluginsFromDir(const FilePath& dir_path,
}
}
-
bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
std::vector<WebPluginInfo>* plugins) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Considering " << info.path.value() << " (" << info.name << ")";
if (IsUndesirablePlugin(info)) {
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< info.path.value() << " is undesirable.";
// See if we have a better version of this plugin.
@@ -248,7 +248,7 @@ bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
!IsUndesirablePlugin(plugins->at(i))) {
// Skip the current undesirable one so we can use the better one
// we just found.
- LOG_IF(INFO, PluginList::DebugPluginLoading())
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
<< "Skipping " << info.path.value() << ", preferring "
<< plugins->at(i).path.value();
return false;