| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #define DLLEXPORT __declspec(dllexport) | 85 #define DLLEXPORT __declspec(dllexport) |
| 86 | 86 |
| 87 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 87 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| 88 extern "C" { | 88 extern "C" { |
| 89 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 89 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
| 90 sandbox::SandboxInterfaceInfo* sandbox_info, | 90 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 91 TCHAR* command_line); | 91 TCHAR* command_line); |
| 92 } | 92 } |
| 93 #elif defined(OS_POSIX) | 93 #elif defined(OS_POSIX) |
| 94 extern "C" { | 94 extern "C" { |
| 95 __attribute__((visibility("default"))) |
| 95 int ChromeMain(int argc, const char** argv); | 96 int ChromeMain(int argc, const char** argv); |
| 96 } | 97 } |
| 97 #endif | 98 #endif |
| 98 | 99 |
| 99 namespace { | 100 namespace { |
| 100 | 101 |
| 101 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 102 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; | 103 const wchar_t kProfilingDll[] = L"memory_watcher.dll"; |
| 103 | 104 |
| 104 // Load the memory profiling DLL. All it needs to be activated | 105 // Load the memory profiling DLL. All it needs to be activated |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 289 |
| 289 #if defined(OS_WIN) | 290 #if defined(OS_WIN) |
| 290 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 291 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
| 291 sandbox::SandboxInterfaceInfo* sandbox_info, | 292 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 292 TCHAR* command_line) { | 293 TCHAR* command_line) { |
| 293 #elif defined(OS_POSIX) | 294 #elif defined(OS_POSIX) |
| 294 int ChromeMain(int argc, const char** argv) { | 295 int ChromeMain(int argc, const char** argv) { |
| 295 #endif | 296 #endif |
| 296 | 297 |
| 297 #if defined(OS_MACOSX) | 298 #if defined(OS_MACOSX) |
| 299 // TODO(mark): Some of these things ought to be handled in chrome_exe_main.mm, |
| 300 // such as Breakpad initialization. Under the current architecture, nothing |
| 301 // in chrome_exe_main can rely directly on chrome_dll code on the Mac, |
| 302 // though, so until some of this code is refactored to avoid such a |
| 303 // dependency, it lives here. See also the TODO(mark) below at |
| 304 // DestructCrashReporter(). |
| 305 base::EnableTerminationOnHeapCorruption(); |
| 306 |
| 307 // The exit manager is in charge of calling the dtors of singletons. |
| 308 // Win has one here, but we assert with multiples from BrowserMain() if we |
| 309 // keep it. |
| 310 // base::AtExitManager exit_manager; |
| 311 |
| 312 #if defined(GOOGLE_CHROME_BUILD) |
| 313 InitCrashReporter(); |
| 314 #endif |
| 315 |
| 298 // If Breakpad is not present then turn off os crash dumps so we don't have | 316 // If Breakpad is not present then turn off os crash dumps so we don't have |
| 299 // to wait eons for Apple's Crash Reporter to generate a dump. | 317 // to wait eons for Apple's Crash Reporter to generate a dump. |
| 300 if (IsCrashReporterDisabled()) { | 318 if (IsCrashReporterDisabled()) { |
| 301 DebugUtil::DisableOSCrashDumps(); | 319 DebugUtil::DisableOSCrashDumps(); |
| 302 } | 320 } |
| 303 #endif | 321 #endif // OS_MACOSX |
| 304 RegisterInvalidParamHandler(); | 322 RegisterInvalidParamHandler(); |
| 305 | 323 |
| 306 // The exit manager is in charge of calling the dtors of singleton objects. | 324 // The exit manager is in charge of calling the dtors of singleton objects. |
| 307 base::AtExitManager exit_manager; | 325 base::AtExitManager exit_manager; |
| 308 | 326 |
| 309 // We need this pool for all the objects created before we get to the | 327 // We need this pool for all the objects created before we get to the |
| 310 // event loop, but we don't want to leave them hanging around until the | 328 // event loop, but we don't want to leave them hanging around until the |
| 311 // app quits. Each "main" needs to flush this pool right before it goes into | 329 // app quits. Each "main" needs to flush this pool right before it goes into |
| 312 // its main event loop to get rid of the cruft. | 330 // its main event loop to get rid of the cruft. |
| 313 base::ScopedNSAutoreleasePool autorelease_pool; | 331 base::ScopedNSAutoreleasePool autorelease_pool; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 #if defined(OS_WIN) | 567 #if defined(OS_WIN) |
| 550 #ifdef _CRTDBG_MAP_ALLOC | 568 #ifdef _CRTDBG_MAP_ALLOC |
| 551 _CrtDumpMemoryLeaks(); | 569 _CrtDumpMemoryLeaks(); |
| 552 #endif // _CRTDBG_MAP_ALLOC | 570 #endif // _CRTDBG_MAP_ALLOC |
| 553 | 571 |
| 554 _Module.Term(); | 572 _Module.Term(); |
| 555 #endif | 573 #endif |
| 556 | 574 |
| 557 logging::CleanupChromeLogging(); | 575 logging::CleanupChromeLogging(); |
| 558 | 576 |
| 577 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
| 578 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
| 579 DestructCrashReporter(); |
| 580 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
| 581 |
| 559 return rv; | 582 return rv; |
| 560 } | 583 } |
| OLD | NEW |