| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
| 6 | 6 |
| 7 #include "base/process/memory.h" | 7 #include "base/process/memory.h" |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 "was not malloc\\(\\)-ed"); | 121 "was not malloc\\(\\)-ed"); |
| 122 #else | 122 #else |
| 123 ADD_FAILURE() << "This test is not supported in this build configuration."; | 123 ADD_FAILURE() << "This test is not supported in this build configuration."; |
| 124 #endif | 124 #endif |
| 125 } | 125 } |
| 126 | 126 |
| 127 #endif // defined(OS_MACOSX) | 127 #endif // defined(OS_MACOSX) |
| 128 | 128 |
| 129 // Android doesn't implement set_new_handler, so we can't use the | 129 // Android doesn't implement set_new_handler, so we can't use the |
| 130 // OutOfMemoryTest cases. OpenBSD does not support these tests either. | 130 // OutOfMemoryTest cases. OpenBSD does not support these tests either. |
| 131 // Don't test these on ASAN configurations: only test the real allocator. | 131 // Don't test these on ASan/TSan/MSan configurations: only test the real |
| 132 // allocator. |
| 132 // TODO(vandebo) make this work on Windows too. | 133 // TODO(vandebo) make this work on Windows too. |
| 133 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && \ | 134 #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && \ |
| 134 !defined(ADDRESS_SANITIZER) | 135 !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| 135 | 136 |
| 136 #if defined(USE_TCMALLOC) | 137 #if defined(USE_TCMALLOC) |
| 137 extern "C" { | 138 extern "C" { |
| 138 int tc_set_new_mode(int mode); | 139 int tc_set_new_mode(int mode); |
| 139 } | 140 } |
| 140 #endif // defined(USE_TCMALLOC) | 141 #endif // defined(USE_TCMALLOC) |
| 141 | 142 |
| 142 namespace { | 143 namespace { |
| 143 const char *kOomRegex = "Out of memory"; | 144 const char *kOomRegex = "Out of memory"; |
| 144 } // namespace | 145 } // namespace |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) | 410 for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i) |
| 410 EXPECT_EQ(0, bytes[i]); | 411 EXPECT_EQ(0, bytes[i]); |
| 411 free(value_); | 412 free(value_); |
| 412 | 413 |
| 413 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); | 414 EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); |
| 414 EXPECT_TRUE(value_ == NULL); | 415 EXPECT_TRUE(value_ == NULL); |
| 415 } | 416 } |
| 416 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 417 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| 417 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && | 418 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && |
| 418 // !defined(ADDRESS_SANITIZER) | 419 // !defined(ADDRESS_SANITIZER) |
| OLD | NEW |