| 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 <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <limits> | 14 #include <limits> |
| 15 | 15 |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/free_deleter.h" |
| 18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 #if defined(OS_POSIX) | 23 #if defined(OS_POSIX) |
| 23 #include <sys/mman.h> | 24 #include <sys/mman.h> |
| 24 #include <unistd.h> | 25 #include <unistd.h> |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 using std::nothrow; | 28 using std::nothrow; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // kRandomMask, so we use it as an additional detection mechanism. | 179 // kRandomMask, so we use it as an additional detection mechanism. |
| 179 const uintptr_t kRandomMask = 0x3fffffffffffULL; | 180 const uintptr_t kRandomMask = 0x3fffffffffffULL; |
| 180 bool impossible_random_address = | 181 bool impossible_random_address = |
| 181 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask; | 182 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask; |
| 182 EXPECT_FALSE(impossible_random_address); | 183 EXPECT_FALSE(impossible_random_address); |
| 183 } | 184 } |
| 184 | 185 |
| 185 #endif // defined(OS_LINUX) && defined(__x86_64__) | 186 #endif // defined(OS_LINUX) && defined(__x86_64__) |
| 186 | 187 |
| 187 } // namespace | 188 } // namespace |
| OLD | NEW |