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

Unified Diff: Source/wtf/DefaultAllocator.h

Issue 177213007: Simplify DefaultAllocator::Quantizer using partitionAllocActualSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased + adjusted PurgeableVector test Created 6 years, 10 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 | « Source/platform/PurgeableVectorTest.cpp ('k') | Source/wtf/QuantizedAllocation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/DefaultAllocator.h
diff --git a/Source/wtf/DefaultAllocator.h b/Source/wtf/DefaultAllocator.h
index 67071e06850334e00dd492fea8762698103b70d7..e4e8e7851cde73044f960983c97fa5b28afe339b 100644
--- a/Source/wtf/DefaultAllocator.h
+++ b/Source/wtf/DefaultAllocator.h
@@ -38,7 +38,6 @@
#include "wtf/Assertions.h"
#include "wtf/FastAllocBase.h"
#include "wtf/PartitionAlloc.h"
-#include "wtf/QuantizedAllocation.h"
#include "wtf/WTF.h"
#include <string.h>
@@ -47,9 +46,20 @@ namespace WTF {
class DefaultAllocatorDummyVisitor;
+class DefaultAllocatorQuantizer {
+public:
+ template<typename T>
+ static size_t quantizedSize(size_t count)
+ {
+ RELEASE_ASSERT(count <= kMaxUnquantizedAllocation / sizeof(T));
+ return partitionAllocActualSize(Partitions::getBufferPartition(), count * sizeof(T));
+ }
+ static const size_t kMaxUnquantizedAllocation = kGenericMaxDirectMapped;
+};
+
class DefaultAllocator {
public:
- typedef WTF::QuantizedAllocation Quantizer;
+ typedef DefaultAllocatorQuantizer Quantizer;
typedef DefaultAllocatorDummyVisitor Visitor;
static const bool isGarbageCollected = false;
template<typename T, typename Traits>
« no previous file with comments | « Source/platform/PurgeableVectorTest.cpp ('k') | Source/wtf/QuantizedAllocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698