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

Unified Diff: third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h

Issue 2657173002: Disallow sequences with lengths exceeding max allocation supported. (Closed)
Patch Set: add expected output Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h
diff --git a/third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h b/third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h
index 1408aa16499e695bf02771ec0cb159fca97d9e4f..4699fe902cad8587045305f7e0e3643245d1acfc 100644
--- a/third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h
+++ b/third_party/WebKit/Source/wtf/allocator/PartitionAllocator.h
@@ -27,9 +27,14 @@ class WTF_EXPORT PartitionAllocator {
typedef PartitionAllocatorDummyVisitor Visitor;
static const bool isGarbageCollected = false;
+ template<typename T>
+ static size_t maxElementCountInBackingStore() {
+ return base::kGenericMaxDirectMapped / sizeof(T);
+ }
+
template <typename T>
static size_t quantizedSize(size_t count) {
- RELEASE_ASSERT(count <= base::kGenericMaxDirectMapped / sizeof(T));
+ CHECK(count <= maxElementCountInBackingStore<T>());
Yuta Kitamura 2017/01/30 07:19:42 nit+optional: Use CHECK_LE?
sof 2017/01/31 21:01:43 Done.
return PartitionAllocActualSize(WTF::Partitions::bufferPartition(),
count * sizeof(T));
}
« third_party/WebKit/Source/wtf/Vector.h ('K') | « third_party/WebKit/Source/wtf/Vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698