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 |
} |