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

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

Issue 115896: Making the browser tests work on Unix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "config.h"
6 6
7 #include "webkit/glue/plugins/plugin_lib.h" 7 #include "webkit/glue/plugins/plugin_lib.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/stats_counters.h" 11 #include "base/stats_counters.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "webkit/glue/webkit_glue.h" 13 #include "webkit/glue/webkit_glue.h"
14 #include "webkit/glue/plugins/plugin_instance.h" 14 #include "webkit/glue/plugins/plugin_instance.h"
15 #include "webkit/glue/plugins/plugin_host.h" 15 #include "webkit/glue/plugins/plugin_host.h"
16 #include "webkit/glue/plugins/plugin_list.h" 16 #include "webkit/glue/plugins/plugin_list.h"
17 17
18 // A macro for converting string constants into appropriate
19 // NativeLibraryFunctionNameTypes.
20 #if defined(OS_MACOSX)
21 #define NATIVE_LIBRARY_FUNCTION_NAME(x) CFSTR(x)
22 #else
23 #define NATIVE_LIBRARY_FUNCTION_NAME(x) x
24 #endif // OS_*
25
26 namespace NPAPI 18 namespace NPAPI
27 { 19 {
28 20
29 const char kPluginLibrariesLoadedCounter[] = "PluginLibrariesLoaded"; 21 const char kPluginLibrariesLoadedCounter[] = "PluginLibrariesLoaded";
30 const char kPluginInstancesActiveCounter[] = "PluginInstancesActive"; 22 const char kPluginInstancesActiveCounter[] = "PluginInstancesActive";
31 23
32 // A list of all the instantiated plugins. 24 // A list of all the instantiated plugins.
33 static std::vector<scoped_refptr<PluginLib> >* g_loaded_libs; 25 static std::vector<scoped_refptr<PluginLib> >* g_loaded_libs;
34 26
35 PluginLib* PluginLib::CreatePluginLib(const FilePath& filename) { 27 PluginLib* PluginLib::CreatePluginLib(const FilePath& filename) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return rv; 161 return rv;
170 162
171 library = base::LoadNativeLibrary(web_plugin_info_.path); 163 library = base::LoadNativeLibrary(web_plugin_info_.path);
172 if (library == 0) 164 if (library == 0)
173 return rv; 165 return rv;
174 166
175 rv = true; // assume success now 167 rv = true; // assume success now
176 168
177 entry_points_.np_initialize = 169 entry_points_.np_initialize =
178 (NP_InitializeFunc)base::GetFunctionPointerFromNativeLibrary(library, 170 (NP_InitializeFunc)base::GetFunctionPointerFromNativeLibrary(library,
179 NATIVE_LIBRARY_FUNCTION_NAME("NP_Initialize")); 171 "NP_Initialize");
180 if (entry_points_.np_initialize == 0) 172 if (entry_points_.np_initialize == 0)
181 rv = false; 173 rv = false;
182 174
183 #if !defined(OS_LINUX) 175 #if !defined(OS_LINUX)
184 entry_points_.np_getentrypoints = 176 entry_points_.np_getentrypoints =
185 (NP_GetEntryPointsFunc)base::GetFunctionPointerFromNativeLibrary( 177 (NP_GetEntryPointsFunc)base::GetFunctionPointerFromNativeLibrary(
186 library, 178 library, "NP_GetEntryPoints");
187 NATIVE_LIBRARY_FUNCTION_NAME("NP_GetEntryPoints"));
188 if (entry_points_.np_getentrypoints == 0) 179 if (entry_points_.np_getentrypoints == 0)
189 rv = false; 180 rv = false;
190 #endif 181 #endif
191 182
192 entry_points_.np_shutdown = 183 entry_points_.np_shutdown =
193 (NP_ShutdownFunc)base::GetFunctionPointerFromNativeLibrary(library, 184 (NP_ShutdownFunc)base::GetFunctionPointerFromNativeLibrary(library,
194 NATIVE_LIBRARY_FUNCTION_NAME("NP_Shutdown")); 185 "NP_Shutdown");
195 if (entry_points_.np_shutdown == 0) 186 if (entry_points_.np_shutdown == 0)
196 rv = false; 187 rv = false;
197 } else { 188 } else {
198 rv = true; 189 rv = true;
199 } 190 }
200 191
201 if (rv) { 192 if (rv) {
202 plugin_funcs_.size = sizeof(plugin_funcs_); 193 plugin_funcs_.size = sizeof(plugin_funcs_);
203 plugin_funcs_.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; 194 plugin_funcs_.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
204 #if !defined(OS_LINUX) 195 #if !defined(OS_LINUX)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 265 }
275 266
276 void PluginLib::Shutdown() { 267 void PluginLib::Shutdown() {
277 if (initialized_ && !internal_) { 268 if (initialized_ && !internal_) {
278 NP_Shutdown(); 269 NP_Shutdown();
279 initialized_ = false; 270 initialized_ = false;
280 } 271 }
281 } 272 }
282 273
283 } // namespace NPAPI 274 } // namespace NPAPI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698