Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: base/allocator/partition_allocator/address_space_randomization.cc

Issue 2811903003: Don't depend on base::win in PartitionAlloc. (Closed)
Patch Set: Fix the #including ordering. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/partition_allocator/address_space_randomization.cc
diff --git a/base/allocator/partition_allocator/address_space_randomization.cc b/base/allocator/partition_allocator/address_space_randomization.cc
index ca9efdd8be49e527e901358d2db0b1ed43cd0ae3..d54fb4434e3104c8c7b90aedfcc767887cfef5be 100644
--- a/base/allocator/partition_allocator/address_space_randomization.cc
+++ b/base/allocator/partition_allocator/address_space_randomization.cc
@@ -16,6 +16,11 @@
#include <unistd.h>
#endif
+// VersionHelpers.h must be included after windows.h.
+#if defined(OS_WIN)
+#include <VersionHelpers.h>
+#endif
+
namespace base {
namespace {
@@ -92,7 +97,13 @@ void* GetRandomPageBase() {
#if defined(OS_WIN)
random &= 0x3ffffffffffUL;
// Windows >= 8.1 has the full 47 bits. Use them where available.
- if (base::win::GetVersion() < base::win::Version::VERSION_WIN8_1) {
+ static bool windows_81 = false;
+ static bool windows_81_initialized = false;
+ if (!windows_81_initialized) {
+ windows_81 = IsWindows8Point1OrGreater();
+ windows_81_initialized = true;
+ }
+ if (!windows_81) {
random += 0x10000000000UL;
}
#elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698