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

Side by Side Diff: third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp

Issue 1629693002: Add missing closing namespace comments to wtf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PR26274 Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 "wtf/AddressSpaceRandomization.h" 5 #include "wtf/AddressSpaceRandomization.h"
6 6
7 #include "wtf/PageAllocator.h" 7 #include "wtf/PageAllocator.h"
8 #include "wtf/SpinLock.h" 8 #include "wtf/SpinLock.h"
9 9
10 #if OS(WIN) 10 #if OS(WIN)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 for (int i = 0; i < 20; ++i) { 70 for (int i = 0; i < 20; ++i) {
71 (void) ranvalInternal(x); 71 (void) ranvalInternal(x);
72 } 72 }
73 } 73 }
74 uint32_t ret = ranvalInternal(x); 74 uint32_t ret = ranvalInternal(x);
75 return ret; 75 return ret;
76 } 76 }
77 77
78 static struct ranctx s_ranctx; 78 static struct ranctx s_ranctx;
79 79
80 } 80 } // namespace
81 81
82 // Calculates a random preferred mapping address. In calculating an 82 // Calculates a random preferred mapping address. In calculating an
83 // address, we balance good ASLR against not fragmenting the address 83 // address, we balance good ASLR against not fragmenting the address
84 // space too badly. 84 // space too badly.
85 void* getRandomPageBase() 85 void* getRandomPageBase()
86 { 86 {
87 uintptr_t random; 87 uintptr_t random;
88 random = static_cast<uintptr_t>(ranval(&s_ranctx)); 88 random = static_cast<uintptr_t>(ranval(&s_ranctx));
89 #if CPU(X86_64) 89 #if CPU(X86_64)
90 random <<= 32UL; 90 random <<= 32UL;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 #endif // OS(WIN) 123 #endif // OS(WIN)
124 // This is a good range on Windows, Linux and Mac. 124 // This is a good range on Windows, Linux and Mac.
125 // Allocates in the 0.5-1.5GB region. 125 // Allocates in the 0.5-1.5GB region.
126 random &= 0x3fffffff; 126 random &= 0x3fffffff;
127 random += 0x20000000; 127 random += 0x20000000;
128 #endif // CPU(X86_64) 128 #endif // CPU(X86_64)
129 random &= kPageAllocationGranularityBaseMask; 129 random &= kPageAllocationGranularityBaseMask;
130 return reinterpret_cast<void*>(random); 130 return reinterpret_cast<void*>(random);
131 } 131 }
132 132
133 } 133 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/ASCIICTypeTest.cpp ('k') | third_party/WebKit/Source/wtf/ArrayBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698