| 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 #if defined(USE_LINUX_BREAKPAD) | |
| 18 size_t g_oom_size = 0U; | 17 size_t g_oom_size = 0U; |
| 19 #endif | |
| 20 | 18 |
| 21 namespace { | 19 namespace { |
| 22 | 20 |
| 23 void OnNoMemorySize(size_t size) { | 21 void OnNoMemorySize(size_t size) { |
| 24 #if defined(USE_LINUX_BREAKPAD) | |
| 25 g_oom_size = size; | 22 g_oom_size = size; |
| 26 #endif | |
| 27 | 23 |
| 28 if (size != 0) | 24 if (size != 0) |
| 29 LOG(FATAL) << "Out of memory, size = " << size; | 25 LOG(FATAL) << "Out of memory, size = " << size; |
| 30 LOG(FATAL) << "Out of memory."; | 26 LOG(FATAL) << "Out of memory."; |
| 31 } | 27 } |
| 32 | 28 |
| 33 void OnNoMemory() { | 29 void OnNoMemory() { |
| 34 OnNoMemorySize(0); | 30 OnNoMemorySize(0); |
| 35 } | 31 } |
| 36 | 32 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 int score_len = static_cast<int>(score_str.length()); | 174 int score_len = static_cast<int>(score_str.length()); |
| 179 return (score_len == file_util::WriteFile(oom_file, | 175 return (score_len == file_util::WriteFile(oom_file, |
| 180 score_str.c_str(), | 176 score_str.c_str(), |
| 181 score_len)); | 177 score_len)); |
| 182 } | 178 } |
| 183 | 179 |
| 184 return false; | 180 return false; |
| 185 } | 181 } |
| 186 | 182 |
| 187 } // namespace base | 183 } // namespace base |
| OLD | NEW |