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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Turns on process termination if memory runs out. | 40 // Turns on process termination if memory runs out. |
41 BASE_EXPORT void EnableTerminationOnOutOfMemory(); | 41 BASE_EXPORT void EnableTerminationOnOutOfMemory(); |
42 | 42 |
43 // Terminates process. Should be called only for out of memory errors. | 43 // Terminates process. Should be called only for out of memory errors. |
44 // Crash reporting classifies such crashes as OOM. | 44 // Crash reporting classifies such crashes as OOM. |
45 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); | 45 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); |
46 | 46 |
47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
48 // Returns the module handle to which an address belongs. The reference count | 48 // Returns the module handle to which an address belongs. The reference count |
49 // of the module is not incremented. | 49 // of the module is not incremented. |
50 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); | 50 BASE_EXPORT HMODULE GetModuleFromAddress(const void* address); |
51 #endif | 51 #endif |
52 | 52 |
53 #if defined(OS_LINUX) || defined(OS_ANDROID) | 53 #if defined(OS_LINUX) || defined(OS_ANDROID) |
54 BASE_EXPORT extern size_t g_oom_size; | 54 BASE_EXPORT extern size_t g_oom_size; |
55 | 55 |
56 // The maximum allowed value for the OOM score. | 56 // The maximum allowed value for the OOM score. |
57 const int kMaxOomScore = 1000; | 57 const int kMaxOomScore = 1000; |
58 | 58 |
59 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will | 59 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will |
60 // prefer to kill certain process types over others. The range for the | 60 // prefer to kill certain process types over others. The range for the |
(...skipping 17 matching lines...) Expand all Loading... |
78 // set to NULL, otherwise it holds the memory address. | 78 // set to NULL, otherwise it holds the memory address. |
79 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, | 79 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, |
80 void** result); | 80 void** result); |
81 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, | 81 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, |
82 size_t size, | 82 size_t size, |
83 void** result); | 83 void** result); |
84 | 84 |
85 } // namespace base | 85 } // namespace base |
86 | 86 |
87 #endif // BASE_PROCESS_MEMORY_H_ | 87 #endif // BASE_PROCESS_MEMORY_H_ |
OLD | NEW |