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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // Terminates process. Should be called only for out of memory errors. | 42 // Terminates process. Should be called only for out of memory errors. |
43 // Crash reporting classifies such crashes as OOM. | 43 // Crash reporting classifies such crashes as OOM. |
44 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); | 44 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); |
45 | 45 |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
47 // 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 |
48 // of the module is not incremented. | 48 // of the module is not incremented. |
49 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); | 49 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); |
50 #endif | 50 #endif |
51 | 51 |
52 #if defined(OS_LINUX) || defined(OS_ANDROID) | 52 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) |
Mark Seaborn
2015/12/15 18:51:35
Hmm, AdjustOOMScore() is a Linuxism. We don't hav
Sean Klein
2015/12/15 19:29:26
I think this was a leftover from a linking error,
| |
53 BASE_EXPORT extern size_t g_oom_size; | 53 BASE_EXPORT extern size_t g_oom_size; |
54 | 54 |
55 // The maximum allowed value for the OOM score. | 55 // The maximum allowed value for the OOM score. |
56 const int kMaxOomScore = 1000; | 56 const int kMaxOomScore = 1000; |
57 | 57 |
58 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will | 58 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will |
59 // prefer to kill certain process types over others. The range for the | 59 // prefer to kill certain process types over others. The range for the |
60 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. | 60 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. |
61 // If the Linux system doesn't support the newer oom_score_adj range | 61 // If the Linux system doesn't support the newer oom_score_adj range |
62 // of [0, 1000], then we revert to using the older oom_adj, and | 62 // of [0, 1000], then we revert to using the older oom_adj, and |
(...skipping 14 matching lines...) Expand all Loading... | |
77 // set to NULL, otherwise it holds the memory address. | 77 // set to NULL, otherwise it holds the memory address. |
78 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, | 78 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, |
79 void** result); | 79 void** result); |
80 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, | 80 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, |
81 size_t size, | 81 size_t size, |
82 void** result); | 82 void** result); |
83 | 83 |
84 } // namespace base | 84 } // namespace base |
85 | 85 |
86 #endif // BASE_PROCESS_MEMORY_H_ | 86 #endif // BASE_PROCESS_MEMORY_H_ |
OLD | NEW |