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

Side by Side Diff: webkit/glue/plugins/plugin_lib_posix.cc

Issue 3013039: Enhance plugin logging a bit. This adds logging in a few more places, especia... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/plugin_lib.cc ('k') | webkit/glue/plugins/plugin_lib_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/plugins/plugin_lib.h" 5 #include "webkit/glue/plugins/plugin_lib.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #if defined(OS_OPENBSD) 8 #if defined(OS_OPENBSD)
9 #include <sys/exec_elf.h> 9 #include <sys/exec_elf.h>
10 #else 10 #else
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 LOG(WARNING) << path.value() << " is nspluginwrapper wrapping a " 111 LOG(WARNING) << path.value() << " is nspluginwrapper wrapping a "
112 << "plugin for a different architecture; it will " 112 << "plugin for a different architecture; it will "
113 << "work better if you instead use a native plugin."; 113 << "work better if you instead use a native plugin.";
114 return; 114 return;
115 } 115 }
116 116
117 void* newdl = base::LoadNativeLibrary(path); 117 void* newdl = base::LoadNativeLibrary(path);
118 if (!newdl) { 118 if (!newdl) {
119 // We couldn't load the unwrapped plugin for some reason, despite 119 // We couldn't load the unwrapped plugin for some reason, despite
120 // being able to load the wrapped one. Just use the wrapped one. 120 // being able to load the wrapped one. Just use the wrapped one.
121 LOG_IF(INFO, PluginList::DebugPluginLoading()) 121 LOG_IF(ERROR, PluginList::DebugPluginLoading())
122 << "Could not use unwrapped nspluginwrapper plugin " 122 << "Could not use unwrapped nspluginwrapper plugin "
123 << unwrapped_path->value() << ", using the wrapped one."; 123 << unwrapped_path->value() << ", using the wrapped one.";
124 return; 124 return;
125 } 125 }
126 126
127 // Unload the wrapped plugin, and use the wrapped plugin instead. 127 // Unload the wrapped plugin, and use the wrapped plugin instead.
128 LOG_IF(INFO, PluginList::DebugPluginLoading()) 128 LOG_IF(ERROR, PluginList::DebugPluginLoading())
129 << "Using unwrapped version " << unwrapped_path->value() 129 << "Using unwrapped version " << unwrapped_path->value()
130 << " of nspluginwrapper-wrapped plugin."; 130 << " of nspluginwrapper-wrapped plugin.";
131 base::UnloadNativeLibrary(*dl); 131 base::UnloadNativeLibrary(*dl);
132 *dl = newdl; 132 *dl = newdl;
133 *unwrapped_path = path; 133 *unwrapped_path = path;
134 } 134 }
135 135
136 } // anonymous namespace 136 } // anonymous namespace
137 137
138 namespace NPAPI { 138 namespace NPAPI {
139 139
140 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, 140 bool PluginLib::ReadWebPluginInfo(const FilePath& filename,
141 WebPluginInfo* info) { 141 WebPluginInfo* info) {
142 // The file to reference is: 142 // The file to reference is:
143 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU nix.cpp 143 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU nix.cpp
144 144
145 // Skip files that aren't appropriate for our architecture. 145 // Skip files that aren't appropriate for our architecture.
146 if (!ELFMatchesCurrentArchitecture(filename)) { 146 if (!ELFMatchesCurrentArchitecture(filename)) {
147 LOG_IF(INFO, PluginList::DebugPluginLoading()) 147 LOG_IF(ERROR, PluginList::DebugPluginLoading())
148 << "Skipping plugin " << filename.value() 148 << "Skipping plugin " << filename.value()
149 << " because it doesn't match the current architecture."; 149 << " because it doesn't match the current architecture.";
150 return false; 150 return false;
151 } 151 }
152 152
153 void* dl = base::LoadNativeLibrary(filename); 153 void* dl = base::LoadNativeLibrary(filename);
154 if (!dl) { 154 if (!dl) {
155 LOG_IF(INFO, PluginList::DebugPluginLoading()) 155 LOG_IF(ERROR, PluginList::DebugPluginLoading())
156 << "While reading plugin info, unable to load library " 156 << "While reading plugin info, unable to load library "
157 << filename.value() << ", skipping."; 157 << filename.value() << ", skipping.";
158 return false; 158 return false;
159 } 159 }
160 160
161 info->path = filename; 161 info->path = filename;
162 info->enabled = true; 162 info->enabled = true;
163 163
164 // Attempt to swap in the wrapped plugin if this is nspluginwrapper. 164 // Attempt to swap in the wrapped plugin if this is nspluginwrapper.
165 UnwrapNSPluginWrapper(&dl, &info->path); 165 UnwrapNSPluginWrapper(&dl, &info->path);
(...skipping 20 matching lines...) Expand all
186 const char* name = NULL; 186 const char* name = NULL;
187 NP_GetValue(NULL, nsPluginVariable_NameString, &name); 187 NP_GetValue(NULL, nsPluginVariable_NameString, &name);
188 if (name) 188 if (name)
189 info->name = UTF8ToUTF16(name); 189 info->name = UTF8ToUTF16(name);
190 190
191 const char* description = NULL; 191 const char* description = NULL;
192 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); 192 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description);
193 if (description) 193 if (description)
194 info->desc = UTF8ToUTF16(description); 194 info->desc = UTF8ToUTF16(description);
195 195
196 LOG_IF(INFO, PluginList::DebugPluginLoading()) 196 LOG_IF(ERROR, PluginList::DebugPluginLoading())
197 << "Got info for plugin " << filename.value() 197 << "Got info for plugin " << filename.value()
198 << " Name = \"" << UTF16ToUTF8(info->name) 198 << " Name = \"" << UTF16ToUTF8(info->name)
199 << "\", Description = \"" << UTF16ToUTF8(info->desc) << "\"."; 199 << "\", Description = \"" << UTF16ToUTF8(info->desc) << "\".";
200 } else { 200 } else {
201 LOG_IF(INFO, PluginList::DebugPluginLoading()) 201 LOG_IF(ERROR, PluginList::DebugPluginLoading())
202 << "Plugin " << filename.value() 202 << "Plugin " << filename.value()
203 << " has no GetValue() and probably won't work."; 203 << " has no GetValue() and probably won't work.";
204 } 204 }
205 205
206 // Intentionally not unloading the plugin here, it can lead to crashes. 206 // Intentionally not unloading the plugin here, it can lead to crashes.
207 207
208 return true; 208 return true;
209 } 209 }
210 210
211 // static 211 // static
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 mime_type.description = UTF8ToUTF16(description.substr(ofs)); 246 mime_type.description = UTF8ToUTF16(description.substr(ofs));
247 } 247 }
248 mime_types->push_back(mime_type); 248 mime_types->push_back(mime_type);
249 if (end == std::string::npos) 249 if (end == std::string::npos)
250 break; 250 break;
251 ofs = end + 1; 251 ofs = end + 1;
252 } 252 }
253 } 253 }
254 254
255 } // namespace NPAPI 255 } // namespace NPAPI
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_lib.cc ('k') | webkit/glue/plugins/plugin_lib_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698