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

Unified Diff: Source/platform/heap/Heap.h

Issue 1088973006: Oilpan: Correct static_asserts about VectorTraits::canInitializeWithMemset (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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/core/html/canvas/WebGLVertexArrayObjectOES.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 629efc43eba2132accc62c286262c5c21599c549..146691916d522d2c1617d5c3409f139e38d20bc6 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -1922,12 +1922,7 @@ struct TraceInCollectionTrait<NoWeakHandlingInCollections, strongify, blink::Hea
template<typename VisitorDispatcher>
static bool trace(VisitorDispatcher visitor, void* self)
{
- // The allocator can oversize the allocation a little, according to
- // the allocation granularity. The extra size is included in the
- // payloadSize call below, since there is nowhere to store the
- // originally allocated memory. This assert ensures that visiting the
- // last bit of memory can't cause trouble.
- static_assert(!ShouldBeTraced<Traits>::value || sizeof(T) > blink::allocationGranularity || Traits::canInitializeWithMemset, "heap overallocation can cause spurious visits");
+ static_assert(!ShouldBeTraced<Traits>::value || Traits::canInitializeWithMemset, "HeapVector doesn't support objects that cannot be initialized with memset.");
T* array = reinterpret_cast<T*>(self);
blink::HeapObjectHeader* header = blink::HeapObjectHeader::fromPayload(self);
@@ -2218,6 +2213,9 @@ struct TraceTrait<HeapHashTableBacking<Table>> {
template<typename T, typename Traits>
void HeapVectorBacking<T, Traits>::finalize(void* pointer)
{
+ static_assert(Traits::needsDestruction, "HeapVectors that don't require destructors should not reach here.");
sof 2015/04/24 12:26:09 "Only vector buffers with items requiring destruct
+ static_assert(Traits::canInitializeWithMemset, "HeapVector doesn't support objects that cannot be initialized with memset.");
+
ASSERT(!WTF::IsTriviallyDestructible<T>::value);
HeapObjectHeader* header = HeapObjectHeader::fromPayload(pointer);
// Use the payload size as recorded by the heap to determine how many
« no previous file with comments | « Source/core/html/canvas/WebGLVertexArrayObjectOES.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698