OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef BASE_PROCESS_MEMORY_H_ | 5 #ifndef BASE_PROCESS_MEMORY_H_ |
6 #define BASE_PROCESS_MEMORY_H_ | 6 #define BASE_PROCESS_MEMORY_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Note: Returns true on Windows 2000 without doing anything. | 32 // Note: Returns true on Windows 2000 without doing anything. |
33 BASE_EXPORT bool EnableLowFragmentationHeap(); | 33 BASE_EXPORT bool EnableLowFragmentationHeap(); |
34 | 34 |
35 // Enables 'terminate on heap corruption' flag. Helps protect against heap | 35 // Enables 'terminate on heap corruption' flag. Helps protect against heap |
36 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 36 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
37 BASE_EXPORT void EnableTerminationOnHeapCorruption(); | 37 BASE_EXPORT void EnableTerminationOnHeapCorruption(); |
38 | 38 |
39 // Turns on process termination if memory runs out. | 39 // Turns on process termination if memory runs out. |
40 BASE_EXPORT void EnableTerminationOnOutOfMemory(); | 40 BASE_EXPORT void EnableTerminationOnOutOfMemory(); |
41 | 41 |
| 42 // Terminates process. Should be called only for out of memory errors. |
| 43 // Crash reporting classifies such crashes as OOM. |
| 44 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); |
| 45 |
42 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
43 // Returns the module handle to which an address belongs. The reference count | 47 // Returns the module handle to which an address belongs. The reference count |
44 // of the module is not incremented. | 48 // of the module is not incremented. |
45 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); | 49 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); |
46 #endif | 50 #endif |
47 | 51 |
48 #if defined(OS_LINUX) || defined(OS_ANDROID) | 52 #if defined(OS_LINUX) || defined(OS_ANDROID) |
49 BASE_EXPORT extern size_t g_oom_size; | 53 BASE_EXPORT extern size_t g_oom_size; |
50 | 54 |
51 // The maximum allowed value for the OOM score. | 55 // The maximum allowed value for the OOM score. |
(...skipping 21 matching lines...) Expand all Loading... |
73 // set to NULL, otherwise it holds the memory address. | 77 // set to NULL, otherwise it holds the memory address. |
74 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, | 78 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, |
75 void** result); | 79 void** result); |
76 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, | 80 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, |
77 size_t size, | 81 size_t size, |
78 void** result); | 82 void** result); |
79 | 83 |
80 } // namespace base | 84 } // namespace base |
81 | 85 |
82 #endif // BASE_PROCESS_MEMORY_H_ | 86 #endif // BASE_PROCESS_MEMORY_H_ |
OLD | NEW |