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

Side by Side Diff: chrome/common/chrome_plugin_lib.cc

Issue 18299: Changes to make it possible to statically link Gears. This is disabled by an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | « no previous file | gears/SConscript » ('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) 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 "chrome/common/chrome_plugin_lib.h" 5 #include "chrome/common/chrome_plugin_lib.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 18 matching lines...) Expand all
29 PluginMap; 29 PluginMap;
30 30
31 // A map of all the instantiated plugins. 31 // A map of all the instantiated plugins.
32 static PluginMap* g_loaded_libs; 32 static PluginMap* g_loaded_libs;
33 33
34 // The thread plugins are loaded and used in, lazily initialized upon 34 // The thread plugins are loaded and used in, lazily initialized upon
35 // the first creation call. 35 // the first creation call.
36 static DWORD g_plugin_thread_id = 0; 36 static DWORD g_plugin_thread_id = 0;
37 static MessageLoop* g_plugin_thread_loop = NULL; 37 static MessageLoop* g_plugin_thread_loop = NULL;
38 38
39 #ifdef GEARS_STATIC_LIB
40 // defined in gears/base/chrome/module_cr.cc
41 CPError STDCALL Gears_CP_Initialize(CPID id, const CPBrowserFuncs *bfuncs,
42 CPPluginFuncs *pfuncs);
43 #endif
44
39 static bool IsSingleProcessMode() { 45 static bool IsSingleProcessMode() {
40 // We don't support ChromePlugins in single-process mode. 46 // We don't support ChromePlugins in single-process mode.
41 CommandLine command_line; 47 CommandLine command_line;
42 return command_line.HasSwitch(switches::kSingleProcess); 48 return command_line.HasSwitch(switches::kSingleProcess);
43 } 49 }
44 50
45 // static 51 // static
46 bool ChromePluginLib::IsInitialized() { 52 bool ChromePluginLib::IsInitialized() {
47 return (g_loaded_libs != NULL); 53 return (g_loaded_libs != NULL);
48 } 54 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 230
225 int ChromePluginLib::CP_Test(void* param) { 231 int ChromePluginLib::CP_Test(void* param) {
226 DCHECK(initialized_); 232 DCHECK(initialized_);
227 if (!CP_Test_) 233 if (!CP_Test_)
228 return -1; 234 return -1;
229 return CP_Test_(param); 235 return CP_Test_(param);
230 } 236 }
231 237
232 bool ChromePluginLib::Load() { 238 bool ChromePluginLib::Load() {
233 DCHECK(module_ == 0); 239 DCHECK(module_ == 0);
240 #ifdef GEARS_STATIC_LIB
241 FilePath path;
242 if (filename_.BaseName().value().find(FILE_PATH_LITERAL("gears")) == 0) {
243 CP_Initialize_ = &Gears_CP_Initialize;
244 return true;
245 }
246 #endif
247
234 module_ = LoadLibrary(filename_.value().c_str()); 248 module_ = LoadLibrary(filename_.value().c_str());
235 if (module_ == 0) 249 if (module_ == 0)
236 return false; 250 return false;
237 251
238 // required initialization function 252 // required initialization function
239 CP_Initialize_ = reinterpret_cast<CP_InitializeFunc> 253 CP_Initialize_ = reinterpret_cast<CP_InitializeFunc>
240 (GetProcAddress(module_, "CP_Initialize")); 254 (GetProcAddress(module_, "CP_Initialize"));
241 255
242 if (!CP_Initialize_) { 256 if (!CP_Initialize_) {
243 FreeLibrary(module_); 257 FreeLibrary(module_);
(...skipping 19 matching lines...) Expand all
263 NotificationService::NoDetails()); 277 NotificationService::NoDetails());
264 278
265 if (initialized_) 279 if (initialized_)
266 CP_Shutdown(); 280 CP_Shutdown();
267 281
268 if (module_) { 282 if (module_) {
269 FreeLibrary(module_); 283 FreeLibrary(module_);
270 module_ = 0; 284 module_ = 0;
271 } 285 }
272 } 286 }
OLDNEW
« no previous file with comments | « no previous file | gears/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698