Chromium Code Reviews| Index: Source/wtf/PartitionAlloc.h |
| diff --git a/Source/wtf/PartitionAlloc.h b/Source/wtf/PartitionAlloc.h |
| index b1354777c6686b1566ab0a8cb56722ce9aedc7d8..1500bb5ac79da2f81f308de6dbc3eae07a415b30 100644 |
| --- a/Source/wtf/PartitionAlloc.h |
| +++ b/Source/wtf/PartitionAlloc.h |
| @@ -565,6 +565,24 @@ ALWAYS_INLINE void partitionFreeGeneric(PartitionRootGeneric* root, void* ptr) |
| #endif |
| } |
| +ALWAYS_INLINE size_t partitionAllocGetSize(PartitionRootGeneric* root, void* ptr) |
| +{ |
| +#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| + ASSERT_NOT_REACHED(); |
|
Chris Evans
2014/02/18 22:19:59
I think this definitely will be reached. We want t
|
| +#else |
| + ASSERT(root->initialized); |
| + if (UNLIKELY(!ptr)) |
| + return 0; |
|
Chris Evans
2014/02/18 22:19:59
For simplicity, maybe try not supporting passing i
|
| + ptr = partitionCookieFreePointerAdjust(ptr); |
| + ASSERT(partitionPointerIsValid(ptr)); |
| + PartitionPage* page = partitionPointerToPage(ptr); |
| + spinLockLock(&root->lock); |
|
Chris Evans
2014/02/18 22:19:59
No need for locking, as covered separately. But de
|
| + size_t size = page->bucket->slotSize; |
| + spinLockUnlock(&root->lock); |
| + return partitionCookieSizeAdjustSubtract(size); |
| +#endif |
| +} |
| + |
| // N (or more accurately, N - sizeof(void*)) represents the largest size in |
| // bytes that will be handled by a SizeSpecificPartitionAllocator. |
| // Attempts to partitionAlloc() more than this amount will fail. |