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

Unified Diff: third_party/WebKit/Source/wtf/PartitionAlloc.h

Issue 1502023002: Revert of Switch wtf/SpinLock to std::atomic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
Index: third_party/WebKit/Source/wtf/PartitionAlloc.h
diff --git a/third_party/WebKit/Source/wtf/PartitionAlloc.h b/third_party/WebKit/Source/wtf/PartitionAlloc.h
index 2f2d82158f772d7b3c948ec822f8eed05d08a492..1dba60909682ef2c1f909a73711c935398236f57 100644
--- a/third_party/WebKit/Source/wtf/PartitionAlloc.h
+++ b/third_party/WebKit/Source/wtf/PartitionAlloc.h
@@ -309,7 +309,7 @@
int16_t globalEmptyPageRingIndex;
uintptr_t invertedSelf;
- static SpinLock gInitializedLock;
+ static int gInitializedLock;
static bool gInitialized;
// gSeedPage is used as a sentinel to indicate that there is no page
// in the active page list. We can use nullptr, but in that case we need
@@ -330,7 +330,7 @@
// Never instantiate a PartitionRootGeneric directly, instead use PartitionAllocatorGeneric.
struct PartitionRootGeneric : public PartitionRootBase {
- SpinLock lock;
+ int lock;
// Some pre-computed constants.
size_t orderIndexShifts[kBitsPerSizet + 1];
size_t orderSubIndexMasks[kBitsPerSizet + 1];
@@ -752,18 +752,16 @@
size_t requestedSize = size;
size = partitionCookieSizeAdjustAdd(size);
PartitionBucket* bucket = partitionGenericSizeToBucket(root, size);
- void* ret = nullptr;
- {
- SpinLock::Guard guard(root->lock);
- // TODO(bashi): Remove following RELEAE_ASSERT()s once we find the cause of
- // http://crbug.com/514141
+ spinLockLock(&root->lock);
+ // TODO(bashi): Remove following RELEAE_ASSERT()s once we find the cause of
+ // http://crbug.com/514141
#if OS(ANDROID)
- RELEASE_ASSERT(bucket >= &root->buckets[0] || bucket == &PartitionRootGeneric::gPagedBucket);
- RELEASE_ASSERT(bucket <= &root->buckets[kGenericNumBuckets - 1] || bucket == &PartitionRootGeneric::gPagedBucket);
- RELEASE_ASSERT(root->initialized);
-#endif
- ret = partitionBucketAlloc(root, flags, size, bucket);
- }
+ RELEASE_ASSERT(bucket >= &root->buckets[0] || bucket == &PartitionRootGeneric::gPagedBucket);
+ RELEASE_ASSERT(bucket <= &root->buckets[kGenericNumBuckets - 1] || bucket == &PartitionRootGeneric::gPagedBucket);
+ RELEASE_ASSERT(root->initialized);
+#endif
+ void* ret = partitionBucketAlloc(root, flags, size, bucket);
+ spinLockUnlock(&root->lock);
PartitionAllocHooks::allocationHookIfEnabled(ret, requestedSize, typeName);
return ret;
#endif
@@ -788,10 +786,9 @@
ptr = partitionCookieFreePointerAdjust(ptr);
ASSERT(partitionPointerIsValid(ptr));
PartitionPage* page = partitionPointerToPage(ptr);
- {
- SpinLock::Guard guard(root->lock);
- partitionFreeWithPage(ptr, page);
- }
+ spinLockLock(&root->lock);
+ partitionFreeWithPage(ptr, page);
+ spinLockUnlock(&root->lock);
#endif
}
« no previous file with comments | « third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp ('k') | third_party/WebKit/Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698