OLD | NEW |
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 // TODO(port): the ifdefs in here are a first step towards trying to determine | 5 // TODO(port): the ifdefs in here are a first step towards trying to determine |
6 // the correct abstraction for all the OS functionality required at this | 6 // the correct abstraction for all the OS functionality required at this |
7 // stage of process initialization. It should not be taken as a final | 7 // stage of process initialization. It should not be taken as a final |
8 // abstraction. | 8 // abstraction. |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/common/resource_bundle.h" | 44 #include "chrome/common/resource_bundle.h" |
45 #include "chrome/common/sandbox_init_wrapper.h" | 45 #include "chrome/common/sandbox_init_wrapper.h" |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
47 #include "sandbox/src/sandbox.h" | 47 #include "sandbox/src/sandbox.h" |
48 #include "tools/memory_watcher/memory_watcher.h" | 48 #include "tools/memory_watcher/memory_watcher.h" |
49 #endif | 49 #endif |
50 | 50 |
51 extern int BrowserMain(const MainFunctionParams&); | 51 extern int BrowserMain(const MainFunctionParams&); |
52 extern int RendererMain(const MainFunctionParams&); | 52 extern int RendererMain(const MainFunctionParams&); |
53 extern int PluginMain(const MainFunctionParams&); | 53 extern int PluginMain(const MainFunctionParams&); |
| 54 extern int WorkerMain(const MainFunctionParams&); |
54 | 55 |
55 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
56 // TODO(erikkay): isn't this already defined somewhere? | 57 // TODO(erikkay): isn't this already defined somewhere? |
57 #define DLLEXPORT __declspec(dllexport) | 58 #define DLLEXPORT __declspec(dllexport) |
58 | 59 |
59 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 60 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
60 extern "C" { | 61 extern "C" { |
61 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 62 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
62 sandbox::SandboxInterfaceInfo* sandbox_info, | 63 sandbox::SandboxInterfaceInfo* sandbox_info, |
63 TCHAR* command_line); | 64 TCHAR* command_line); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 &autorelease_pool); | 316 &autorelease_pool); |
316 | 317 |
317 // TODO(port): turn on these main() functions as they've been de-winified. | 318 // TODO(port): turn on these main() functions as they've been de-winified. |
318 int rv = -1; | 319 int rv = -1; |
319 if (process_type == switches::kRendererProcess) { | 320 if (process_type == switches::kRendererProcess) { |
320 rv = RendererMain(main_params); | 321 rv = RendererMain(main_params); |
321 } else if (process_type == switches::kPluginProcess) { | 322 } else if (process_type == switches::kPluginProcess) { |
322 #if defined(OS_WIN) | 323 #if defined(OS_WIN) |
323 rv = PluginMain(main_params); | 324 rv = PluginMain(main_params); |
324 #endif | 325 #endif |
| 326 } else if (process_type == switches::kWorkerProcess) { |
| 327 #if defined(OS_WIN) |
| 328 rv = WorkerMain(main_params); |
| 329 #endif |
325 } else if (process_type.empty()) { | 330 } else if (process_type.empty()) { |
326 ScopedOleInitializer ole_initializer; | 331 ScopedOleInitializer ole_initializer; |
327 rv = BrowserMain(main_params); | 332 rv = BrowserMain(main_params); |
328 } else { | 333 } else { |
329 NOTREACHED() << "Unknown process type"; | 334 NOTREACHED() << "Unknown process type"; |
330 } | 335 } |
331 | 336 |
332 if (!process_type.empty()) { | 337 if (!process_type.empty()) { |
333 #if defined(OS_WIN) || defined(OS_LINUX) | 338 #if defined(OS_WIN) || defined(OS_LINUX) |
334 // TODO(port-mac): enable when we figure out resource bundle issues | 339 // TODO(port-mac): enable when we figure out resource bundle issues |
335 ResourceBundle::CleanupSharedInstance(); | 340 ResourceBundle::CleanupSharedInstance(); |
336 #endif | 341 #endif |
337 } | 342 } |
338 | 343 |
339 #if defined(OS_WIN) | 344 #if defined(OS_WIN) |
340 #ifdef _CRTDBG_MAP_ALLOC | 345 #ifdef _CRTDBG_MAP_ALLOC |
341 _CrtDumpMemoryLeaks(); | 346 _CrtDumpMemoryLeaks(); |
342 #endif // _CRTDBG_MAP_ALLOC | 347 #endif // _CRTDBG_MAP_ALLOC |
343 | 348 |
344 _Module.Term(); | 349 _Module.Term(); |
345 #endif | 350 #endif |
346 | 351 |
347 logging::CleanupChromeLogging(); | 352 logging::CleanupChromeLogging(); |
348 | 353 |
349 return rv; | 354 return rv; |
350 } | 355 } |
351 | 356 |
352 | 357 |
OLD | NEW |