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/logging_chrome.h" | 53 #include "chrome/common/logging_chrome.h" |
54 #include "chrome/common/main_function_params.h" | 54 #include "chrome/common/main_function_params.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" | |
64 | 63 |
65 extern int BrowserMain(const MainFunctionParams&); | 64 extern int BrowserMain(const MainFunctionParams&); |
66 extern int RendererMain(const MainFunctionParams&); | 65 extern int RendererMain(const MainFunctionParams&); |
67 extern int PluginMain(const MainFunctionParams&); | 66 extern int PluginMain(const MainFunctionParams&); |
68 extern int WorkerMain(const MainFunctionParams&); | 67 extern int WorkerMain(const MainFunctionParams&); |
69 | 68 |
70 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
71 // TODO(erikkay): isn't this already defined somewhere? | 70 // TODO(erikkay): isn't this already defined somewhere? |
72 #define DLLEXPORT __declspec(dllexport) | 71 #define DLLEXPORT __declspec(dllexport) |
73 | 72 |
(...skipping 30 matching lines...) Expand all Loading... |
104 const wchar_t* file, unsigned int line, | 103 const wchar_t* file, unsigned int line, |
105 uintptr_t reserved) { | 104 uintptr_t reserved) { |
106 __debugbreak(); | 105 __debugbreak(); |
107 } | 106 } |
108 | 107 |
109 void PureCall() { | 108 void PureCall() { |
110 __debugbreak(); | 109 __debugbreak(); |
111 } | 110 } |
112 | 111 |
113 void OnNoMemory() { | 112 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 | |
120 // Kill the process. This is important for security, since WebKit doesn't | 113 // Kill the process. This is important for security, since WebKit doesn't |
121 // NULL-check many memory allocations. If a malloc fails, returns NULL, and | 114 // NULL-check many memory allocations. If a malloc fails, returns NULL, and |
122 // the buffer is then used, it provides a handy mapping of memory starting at | 115 // the buffer is then used, it provides a handy mapping of memory starting at |
123 // address 0 for an attacker to utilize. | 116 // address 0 for an attacker to utilize. |
124 __debugbreak(); | 117 __debugbreak(); |
125 } | 118 } |
126 | 119 |
127 // Handlers to silently dump the current process when there is an assert in | 120 // Handlers to silently dump the current process when there is an assert in |
128 // chrome. | 121 // chrome. |
129 void ChromeAssert(const std::string& str) { | 122 void ChromeAssert(const std::string& str) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 _CrtDumpMemoryLeaks(); | 467 _CrtDumpMemoryLeaks(); |
475 #endif // _CRTDBG_MAP_ALLOC | 468 #endif // _CRTDBG_MAP_ALLOC |
476 | 469 |
477 _Module.Term(); | 470 _Module.Term(); |
478 #endif | 471 #endif |
479 | 472 |
480 logging::CleanupChromeLogging(); | 473 logging::CleanupChromeLogging(); |
481 | 474 |
482 return rv; | 475 return rv; |
483 } | 476 } |
OLD | NEW |