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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.h

Issue 2657173002: Disallow sequences with lengths exceeding max allocation supported. (Closed)
Patch Set: re-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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Binding.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/HeapAllocator.h
diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
index ec391a18a4d308435f9fd96553bd01d8bbdaf2db..645e7761f7a0e7d14d532bf07ed497eb07884d6f 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -51,9 +51,14 @@ class PLATFORM_EXPORT HeapAllocator {
using Visitor = blink::Visitor;
static const bool isGarbageCollected = true;
+ template<typename T>
+ static size_t maxElementCountInBackingStore() {
+ return maxHeapObjectSize / sizeof(T);
+ }
+
template <typename T>
static size_t quantizedSize(size_t count) {
- RELEASE_ASSERT(count <= maxHeapObjectSize / sizeof(T));
+ CHECK(count <= maxElementCountInBackingStore<T>());
return ThreadHeap::allocationSizeFromSize(count * sizeof(T)) -
sizeof(HeapObjectHeader);
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Binding.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698