| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 84 #include "base/win_util.h" | 84 #include "base/win_util.h" |
| 85 #include "sandbox/src/sandbox.h" | 85 #include "sandbox/src/sandbox.h" |
| 86 #include "tools/memory_watcher/memory_watcher.h" | 86 #include "tools/memory_watcher/memory_watcher.h" |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 #if defined(USE_TCMALLOC) | 89 #if defined(USE_TCMALLOC) |
| 90 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 90 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 #if defined(OS_CHROMEOS) |
| 94 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 95 #endif |
| 96 |
| 93 extern int BrowserMain(const MainFunctionParams&); | 97 extern int BrowserMain(const MainFunctionParams&); |
| 94 extern int RendererMain(const MainFunctionParams&); | 98 extern int RendererMain(const MainFunctionParams&); |
| 95 extern int GpuMain(const MainFunctionParams&); | 99 extern int GpuMain(const MainFunctionParams&); |
| 96 extern int PluginMain(const MainFunctionParams&); | 100 extern int PluginMain(const MainFunctionParams&); |
| 97 extern int WorkerMain(const MainFunctionParams&); | 101 extern int WorkerMain(const MainFunctionParams&); |
| 98 extern int NaClMain(const MainFunctionParams&); | 102 extern int NaClMain(const MainFunctionParams&); |
| 99 extern int UtilityMain(const MainFunctionParams&); | 103 extern int UtilityMain(const MainFunctionParams&); |
| 100 extern int ProfileImportMain(const MainFunctionParams&); | 104 extern int ProfileImportMain(const MainFunctionParams&); |
| 101 extern int ZygoteMain(const MainFunctionParams&); | 105 extern int ZygoteMain(const MainFunctionParams&); |
| 102 #if defined(_WIN64) | 106 #if defined(_WIN64) |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } // namespace | 405 } // namespace |
| 402 | 406 |
| 403 #if defined(OS_WIN) | 407 #if defined(OS_WIN) |
| 404 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 408 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
| 405 sandbox::SandboxInterfaceInfo* sandbox_info, | 409 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 406 TCHAR* command_line) { | 410 TCHAR* command_line) { |
| 407 #elif defined(OS_POSIX) | 411 #elif defined(OS_POSIX) |
| 408 int ChromeMain(int argc, char** argv) { | 412 int ChromeMain(int argc, char** argv) { |
| 409 #endif | 413 #endif |
| 410 #if defined(OS_CHROMEOS) | 414 #if defined(OS_CHROMEOS) |
| 411 // Output our start times. Save the result to appease warn_unused_result. | 415 chromeos::BootTimesLoader::SaveChromeMainStats(); |
| 412 int result = 0; | |
| 413 result = system("if [ ! -f /tmp/uptime-chrome-main ]; " | |
| 414 "then cat /proc/uptime > /tmp/uptime-chrome-main ; fi"); | |
| 415 result = system("if [ ! -f /tmp/disk-chrome-main ]; " | |
| 416 "then cat /sys/block/sda/stat > /tmp/disk-chrome-main ; fi"); | |
| 417 #endif | 416 #endif |
| 418 #if defined(OS_MACOSX) | 417 #if defined(OS_MACOSX) |
| 419 // TODO(mark): Some of these things ought to be handled in chrome_exe_main.mm. | 418 // TODO(mark): Some of these things ought to be handled in chrome_exe_main.mm. |
| 420 // Under the current architecture, nothing in chrome_exe_main can rely | 419 // Under the current architecture, nothing in chrome_exe_main can rely |
| 421 // directly on chrome_dll code on the Mac, though, so until some of this code | 420 // directly on chrome_dll code on the Mac, though, so until some of this code |
| 422 // is refactored to avoid such a dependency, it lives here. See also the | 421 // is refactored to avoid such a dependency, it lives here. See also the |
| 423 // TODO(mark) below at InitCrashReporter() and DestructCrashReporter(). | 422 // TODO(mark) below at InitCrashReporter() and DestructCrashReporter(). |
| 424 base::EnableTerminationOnHeapCorruption(); | 423 base::EnableTerminationOnHeapCorruption(); |
| 425 base::EnableTerminationOnOutOfMemory(); | 424 base::EnableTerminationOnOutOfMemory(); |
| 426 #endif // OS_MACOSX | 425 #endif // OS_MACOSX |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 | 845 |
| 847 logging::CleanupChromeLogging(); | 846 logging::CleanupChromeLogging(); |
| 848 | 847 |
| 849 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 848 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
| 850 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 849 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
| 851 DestructCrashReporter(); | 850 DestructCrashReporter(); |
| 852 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 851 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
| 853 | 852 |
| 854 return rv; | 853 return rv; |
| 855 } | 854 } |
| OLD | NEW |