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 #include "base/process/memory.h" | 5 #include "base/process/memory.h" |
6 | 6 |
7 #include <new> | 7 #include <new> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/process/internal_linux.h" | 12 #include "base/process/internal_linux.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 void OnNoMemorySize(size_t size) { | 19 void OnNoMemorySize(size_t size) { |
20 #if defined(USE_LINUX_BREAKPAD) | |
21 g_oom_size = size; | 20 g_oom_size = size; |
22 #endif | |
23 | 21 |
24 if (size != 0) | 22 if (size != 0) |
25 LOG(FATAL) << "Out of memory, size = " << size; | 23 LOG(FATAL) << "Out of memory, size = " << size; |
26 LOG(FATAL) << "Out of memory."; | 24 LOG(FATAL) << "Out of memory."; |
27 } | 25 } |
28 | 26 |
29 void OnNoMemory() { | 27 void OnNoMemory() { |
30 OnNoMemorySize(0); | 28 OnNoMemorySize(0); |
31 } | 29 } |
32 | 30 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 int score_len = static_cast<int>(score_str.length()); | 172 int score_len = static_cast<int>(score_str.length()); |
175 return (score_len == file_util::WriteFile(oom_file, | 173 return (score_len == file_util::WriteFile(oom_file, |
176 score_str.c_str(), | 174 score_str.c_str(), |
177 score_len)); | 175 score_len)); |
178 } | 176 } |
179 | 177 |
180 return false; | 178 return false; |
181 } | 179 } |
182 | 180 |
183 } // namespace base | 181 } // namespace base |
OLD | NEW |