| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "chrome/common/main_function_params.h" | 47 #include "chrome/common/main_function_params.h" |
| 48 #include "chrome/common/resource_bundle.h" | 48 #include "chrome/common/resource_bundle.h" |
| 49 #include "chrome/common/sandbox_init_wrapper.h" | 49 #include "chrome/common/sandbox_init_wrapper.h" |
| 50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
| 51 #include "sandbox/src/sandbox.h" | 51 #include "sandbox/src/sandbox.h" |
| 52 #include "tools/memory_watcher/memory_watcher.h" | 52 #include "tools/memory_watcher/memory_watcher.h" |
| 53 #endif | 53 #endif |
| 54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 55 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" | 55 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" |
| 56 #endif | 56 #endif |
| 57 #include "skia/include/corecg/SkTypes.h" |
| 57 | 58 |
| 58 extern int BrowserMain(const MainFunctionParams&); | 59 extern int BrowserMain(const MainFunctionParams&); |
| 59 extern int RendererMain(const MainFunctionParams&); | 60 extern int RendererMain(const MainFunctionParams&); |
| 60 extern int PluginMain(const MainFunctionParams&); | 61 extern int PluginMain(const MainFunctionParams&); |
| 61 extern int WorkerMain(const MainFunctionParams&); | 62 extern int WorkerMain(const MainFunctionParams&); |
| 62 | 63 |
| 63 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 64 // TODO(erikkay): isn't this already defined somewhere? | 65 // TODO(erikkay): isn't this already defined somewhere? |
| 65 #define DLLEXPORT __declspec(dllexport) | 66 #define DLLEXPORT __declspec(dllexport) |
| 66 | 67 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 97 const wchar_t* file, unsigned int line, | 98 const wchar_t* file, unsigned int line, |
| 98 uintptr_t reserved) { | 99 uintptr_t reserved) { |
| 99 __debugbreak(); | 100 __debugbreak(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void PureCall() { | 103 void PureCall() { |
| 103 __debugbreak(); | 104 __debugbreak(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 int OnNoMemory(size_t memory_size) { | 107 int OnNoMemory(size_t memory_size) { |
| 108 // Skia indicates that it can safely handle some NULL allocs by clearing |
| 109 // this flag. In this case, we'll ignore the new_handler and won't crash. |
| 110 if (!sk_malloc_will_throw()) { |
| 111 return; |
| 112 } |
| 113 |
| 107 __debugbreak(); | 114 __debugbreak(); |
| 108 // Return memory_size so it is not optimized out. Make sure the return value | 115 // Return memory_size so it is not optimized out. Make sure the return value |
| 109 // is at least 1 so malloc/new is retried, especially useful when under a | 116 // is at least 1 so malloc/new is retried, especially useful when under a |
| 110 // debugger. | 117 // debugger. |
| 111 return memory_size ? static_cast<int>(memory_size) : 1; | 118 return memory_size ? static_cast<int>(memory_size) : 1; |
| 112 } | 119 } |
| 113 | 120 |
| 114 // Handlers to silently dump the current process when there is an assert in | 121 // Handlers to silently dump the current process when there is an assert in |
| 115 // chrome. | 122 // chrome. |
| 116 void ChromeAssert(const std::string& str) { | 123 void ChromeAssert(const std::string& str) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 _CrtDumpMemoryLeaks(); | 417 _CrtDumpMemoryLeaks(); |
| 411 #endif // _CRTDBG_MAP_ALLOC | 418 #endif // _CRTDBG_MAP_ALLOC |
| 412 | 419 |
| 413 _Module.Term(); | 420 _Module.Term(); |
| 414 #endif | 421 #endif |
| 415 | 422 |
| 416 logging::CleanupChromeLogging(); | 423 logging::CleanupChromeLogging(); |
| 417 | 424 |
| 418 return rv; | 425 return rv; |
| 419 } | 426 } |
| OLD | NEW |