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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.h

Issue 2436123002: Fix CFI errors in Oilpan (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef HeapAllocator_h 5 #ifndef HeapAllocator_h
6 #define HeapAllocator_h 6 #define HeapAllocator_h
7 7
8 #include "platform/heap/Heap.h" 8 #include "platform/heap/Heap.h"
9 #include "platform/heap/Persistent.h" 9 #include "platform/heap/Persistent.h"
10 #include "platform/heap/TraceTraits.h" 10 #include "platform/heap/TraceTraits.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // Use the payload size as recorded by the heap to determine how many 299 // Use the payload size as recorded by the heap to determine how many
300 // elements to finalize. 300 // elements to finalize.
301 size_t length = header->payloadSize() / sizeof(T); 301 size_t length = header->payloadSize() / sizeof(T);
302 T* buffer = reinterpret_cast<T*>(pointer); 302 T* buffer = reinterpret_cast<T*>(pointer);
303 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER 303 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER
304 // As commented above, HeapVectorBacking calls finalizers for unused slots 304 // As commented above, HeapVectorBacking calls finalizers for unused slots
305 // (which are already zeroed out). 305 // (which are already zeroed out).
306 ANNOTATE_CHANGE_SIZE(buffer, length, 0, length); 306 ANNOTATE_CHANGE_SIZE(buffer, length, 0, length);
307 #endif 307 #endif
308 if (std::is_polymorphic<T>::value) { 308 if (std::is_polymorphic<T>::value) {
309 char* pointer = reinterpret_cast<char*>(buffer);
309 for (unsigned i = 0; i < length; ++i) { 310 for (unsigned i = 0; i < length; ++i) {
310 if (blink::vTableInitialized(&buffer[i])) 311 char* element = pointer + i * sizeof(T);
311 buffer[i].~T(); 312 if (blink::vTableInitialized(element))
313 reinterpret_cast<T*>(element)->~T();
312 } 314 }
313 } else { 315 } else {
314 for (unsigned i = 0; i < length; ++i) { 316 for (unsigned i = 0; i < length; ++i) {
315 buffer[i].~T(); 317 buffer[i].~T();
316 } 318 }
317 } 319 }
318 } 320 }
319 321
320 template <typename Table> 322 template <typename Table>
321 void HeapHashTableBacking<Table>::finalize(void* pointer) { 323 void HeapHashTableBacking<Table>::finalize(void* pointer) {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 const blink::HeapHashCountedSet<Value, HashFunctions, Traits>& set, 771 const blink::HeapHashCountedSet<Value, HashFunctions, Traits>& set,
770 VectorType& vector) { 772 VectorType& vector) {
771 copyToVector(static_cast<const HashCountedSet<Value, HashFunctions, Traits, 773 copyToVector(static_cast<const HashCountedSet<Value, HashFunctions, Traits,
772 blink::HeapAllocator>&>(set), 774 blink::HeapAllocator>&>(set),
773 vector); 775 vector);
774 } 776 }
775 777
776 } // namespace WTF 778 } // namespace WTF
777 779
778 #endif 780 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698