| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/allocator/partition_allocator/address_space_randomization.h" | 5 #include "base/allocator/partition_allocator/address_space_randomization.h" |
| 6 | 6 |
| 7 #include "base/allocator/partition_allocator/page_allocator.h" | 7 #include "base/allocator/partition_allocator/page_allocator.h" |
| 8 #include "base/allocator/partition_allocator/spin_lock.h" | 8 #include "base/allocator/partition_allocator/spin_lock.h" |
| 9 #include "base/win/windows_version.h" | |
| 10 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 11 | 10 |
| 12 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 13 #include <windows.h> | 12 #include <windows.h> |
| 13 #include "base/win/windows_version.h" |
| 14 #else | 14 #else |
| 15 #include <sys/time.h> | 15 #include <sys/time.h> |
| 16 #include <unistd.h> | 16 #include <unistd.h> |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 // VersionHelpers.h must be included after windows.h. | 19 // VersionHelpers.h must be included after windows.h. |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include <VersionHelpers.h> | 21 #include <VersionHelpers.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // This is a good range on Windows, Linux and Mac. | 133 // This is a good range on Windows, Linux and Mac. |
| 134 // Allocates in the 0.5-1.5GB region. | 134 // Allocates in the 0.5-1.5GB region. |
| 135 random &= 0x3fffffff; | 135 random &= 0x3fffffff; |
| 136 random += 0x20000000; | 136 random += 0x20000000; |
| 137 #endif // defined(ARCH_CPU_X86_64) | 137 #endif // defined(ARCH_CPU_X86_64) |
| 138 random &= kPageAllocationGranularityBaseMask; | 138 random &= kPageAllocationGranularityBaseMask; |
| 139 return reinterpret_cast<void*>(random); | 139 return reinterpret_cast<void*>(random); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace base | 142 } // namespace base |
| OLD | NEW |