| 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/synchronization/spin_lock.h" | 8 #include "base/allocator/partition_allocator/spin_lock.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 #else | 13 #else |
| 14 #include <sys/time.h> | 14 #include <sys/time.h> |
| 15 #include <unistd.h> | 15 #include <unistd.h> |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // This is a good range on Windows, Linux and Mac. | 121 // This is a good range on Windows, Linux and Mac. |
| 122 // Allocates in the 0.5-1.5GB region. | 122 // Allocates in the 0.5-1.5GB region. |
| 123 random &= 0x3fffffff; | 123 random &= 0x3fffffff; |
| 124 random += 0x20000000; | 124 random += 0x20000000; |
| 125 #endif // defined(ARCH_CPU_X86_64) | 125 #endif // defined(ARCH_CPU_X86_64) |
| 126 random &= kPageAllocationGranularityBaseMask; | 126 random &= kPageAllocationGranularityBaseMask; |
| 127 return reinterpret_cast<void*>(random); | 127 return reinterpret_cast<void*>(random); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace base | 130 } // namespace base |
| OLD | NEW |