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