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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/TraceTraits.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 b60817ca43d88cc1c4c35b490e82b22667ef8c9c..765113be0132ce3988d7ebc4de497b3f6628254c 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -306,9 +306,11 @@ void HeapVectorBacking<T, Traits>::finalize(void* pointer) {
ANNOTATE_CHANGE_SIZE(buffer, length, 0, length);
#endif
if (std::is_polymorphic<T>::value) {
+ char* pointer = reinterpret_cast<char*>(buffer);
for (unsigned i = 0; i < length; ++i) {
- if (blink::vTableInitialized(&buffer[i]))
- buffer[i].~T();
+ char* element = pointer + i * sizeof(T);
+ if (blink::vTableInitialized(element))
+ reinterpret_cast<T*>(element)->~T();
}
} else {
for (unsigned i = 0; i < length; ++i) {
« 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