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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "chrome/common/main_function_params.h" | 53 #include "chrome/common/main_function_params.h" |
54 #include "chrome/common/resource_bundle.h" | 54 #include "chrome/common/resource_bundle.h" |
55 #include "chrome/common/sandbox_init_wrapper.h" | 55 #include "chrome/common/sandbox_init_wrapper.h" |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 #include "sandbox/src/sandbox.h" | 57 #include "sandbox/src/sandbox.h" |
58 #include "tools/memory_watcher/memory_watcher.h" | 58 #include "tools/memory_watcher/memory_watcher.h" |
59 #endif | 59 #endif |
60 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
61 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" | 61 #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" |
62 #endif | 62 #endif |
| 63 #include "skia/include/corecg/SkTypes.h" |
63 | 64 |
64 extern int BrowserMain(const MainFunctionParams&); | 65 extern int BrowserMain(const MainFunctionParams&); |
65 extern int RendererMain(const MainFunctionParams&); | 66 extern int RendererMain(const MainFunctionParams&); |
66 extern int PluginMain(const MainFunctionParams&); | 67 extern int PluginMain(const MainFunctionParams&); |
67 extern int WorkerMain(const MainFunctionParams&); | 68 extern int WorkerMain(const MainFunctionParams&); |
68 | 69 |
69 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
70 // TODO(erikkay): isn't this already defined somewhere? | 71 // TODO(erikkay): isn't this already defined somewhere? |
71 #define DLLEXPORT __declspec(dllexport) | 72 #define DLLEXPORT __declspec(dllexport) |
72 | 73 |
(...skipping 30 matching lines...) Expand all Loading... |
103 const wchar_t* file, unsigned int line, | 104 const wchar_t* file, unsigned int line, |
104 uintptr_t reserved) { | 105 uintptr_t reserved) { |
105 __debugbreak(); | 106 __debugbreak(); |
106 } | 107 } |
107 | 108 |
108 void PureCall() { | 109 void PureCall() { |
109 __debugbreak(); | 110 __debugbreak(); |
110 } | 111 } |
111 | 112 |
112 void OnNoMemory() { | 113 void OnNoMemory() { |
| 114 // Skia indicates that it can safely handle some NULL allocs by clearing |
| 115 // this flag. In this case, we'll ignore the new_handler and won't crash. |
| 116 if (!sk_malloc_will_throw()) { |
| 117 return; |
| 118 } |
| 119 |
113 // Kill the process. This is important for security, since WebKit doesn't | 120 // Kill the process. This is important for security, since WebKit doesn't |
114 // NULL-check many memory allocations. If a malloc fails, returns NULL, and | 121 // NULL-check many memory allocations. If a malloc fails, returns NULL, and |
115 // the buffer is then used, it provides a handy mapping of memory starting at | 122 // the buffer is then used, it provides a handy mapping of memory starting at |
116 // address 0 for an attacker to utilize. | 123 // address 0 for an attacker to utilize. |
117 __debugbreak(); | 124 __debugbreak(); |
118 } | 125 } |
119 | 126 |
120 // Handlers to silently dump the current process when there is an assert in | 127 // Handlers to silently dump the current process when there is an assert in |
121 // chrome. | 128 // chrome. |
122 void ChromeAssert(const std::string& str) { | 129 void ChromeAssert(const std::string& str) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 _CrtDumpMemoryLeaks(); | 471 _CrtDumpMemoryLeaks(); |
465 #endif // _CRTDBG_MAP_ALLOC | 472 #endif // _CRTDBG_MAP_ALLOC |
466 | 473 |
467 _Module.Term(); | 474 _Module.Term(); |
468 #endif | 475 #endif |
469 | 476 |
470 logging::CleanupChromeLogging(); | 477 logging::CleanupChromeLogging(); |
471 | 478 |
472 return rv; | 479 return rv; |
473 } | 480 } |
OLD | NEW |