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

Side by Side Diff: webkit/plugins/npapi/plugin_lib.cc

Issue 6864020: linux: don't always print dlopen errors from LoadNativeLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: owners Created 9 years, 8 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 | « ui/gfx/gl/gl_implementation_win.cc ('k') | webkit/plugins/npapi/plugin_lib_posix.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) 2011 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/plugins/npapi/plugin_lib.h" 5 #include "webkit/plugins/npapi/plugin_lib.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/stats_counters.h" 9 #include "base/metrics/stats_counters.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "webkit/glue/webkit_glue.h" 11 #include "webkit/glue/webkit_glue.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if ((instance_count_ == 0) && webkit_glue::IsPluginRunningInRendererProcess()) 173 if ((instance_count_ == 0) && webkit_glue::IsPluginRunningInRendererProcess())
174 Unload(); 174 Unload();
175 } 175 }
176 176
177 bool PluginLib::Load() { 177 bool PluginLib::Load() {
178 if (library_) 178 if (library_)
179 return true; 179 return true;
180 180
181 bool rv = false; 181 bool rv = false;
182 base::NativeLibrary library = 0; 182 base::NativeLibrary library = 0;
183 std::string error;
183 184
184 if (!internal_) { 185 if (!internal_) {
185 #if defined(OS_WIN) 186 #if defined(OS_WIN)
186 // This is to work around a bug in the Real player recorder plugin which 187 // This is to work around a bug in the Real player recorder plugin which
187 // intercepts LoadLibrary calls from chrome.dll and wraps NPAPI functions 188 // intercepts LoadLibrary calls from chrome.dll and wraps NPAPI functions
188 // provided by the plugin. It crashes if the media player plugin is being 189 // provided by the plugin. It crashes if the media player plugin is being
189 // loaded. Workaround is to load the dll dynamically by getting the 190 // loaded. Workaround is to load the dll dynamically by getting the
190 // LoadLibrary API address from kernel32.dll which bypasses the recorder 191 // LoadLibrary API address from kernel32.dll which bypasses the recorder
191 // plugin. 192 // plugin.
192 if (web_plugin_info_.name.find(L"Windows Media Player") != 193 if (web_plugin_info_.name.find(L"Windows Media Player") !=
193 std::wstring::npos) { 194 std::wstring::npos) {
194 library = base::LoadNativeLibraryDynamically(web_plugin_info_.path); 195 library = base::LoadNativeLibraryDynamically(web_plugin_info_.path);
195 } else { 196 } else {
196 library = base::LoadNativeLibrary(web_plugin_info_.path); 197 library = base::LoadNativeLibrary(web_plugin_info_.path, &error);
197 } 198 }
198 #else // OS_WIN 199 #else
199 library = base::LoadNativeLibrary(web_plugin_info_.path); 200 library = base::LoadNativeLibrary(web_plugin_info_.path, &error);
200 #endif // OS_WIN 201 #endif
201 if (library == 0) { 202
203 if (!library) {
202 LOG_IF(ERROR, PluginList::DebugPluginLoading()) 204 LOG_IF(ERROR, PluginList::DebugPluginLoading())
203 << "Couldn't load plugin " << web_plugin_info_.path.value(); 205 << "Couldn't load plugin " << web_plugin_info_.path.value() << " "
206 << error;
204 return rv; 207 return rv;
205 } 208 }
206 209
207 #if defined(OS_MACOSX) 210 #if defined(OS_MACOSX)
208 // According to the WebKit source, QuickTime at least requires us to call 211 // According to the WebKit source, QuickTime at least requires us to call
209 // UseResFile on the plugin resources before loading. 212 // UseResFile on the plugin resources before loading.
210 if (library->bundle_resource_ref != -1) 213 if (library->bundle_resource_ref != -1)
211 UseResFile(library->bundle_resource_ref); 214 UseResFile(library->bundle_resource_ref);
212 #endif 215 #endif
213 216
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 361
359 void PluginLib::Shutdown() { 362 void PluginLib::Shutdown() {
360 if (initialized_ && !internal_) { 363 if (initialized_ && !internal_) {
361 NP_Shutdown(); 364 NP_Shutdown();
362 initialized_ = false; 365 initialized_ = false;
363 } 366 }
364 } 367 }
365 368
366 } // namespace npapi 369 } // namespace npapi
367 } // namespace webkit 370 } // namespace webkit
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_implementation_win.cc ('k') | webkit/plugins/npapi/plugin_lib_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698