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

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

Issue 2021103002: Statically disallow delete' over heap collection objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment improved Created 4 years, 7 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 | no next file » | 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 2c1cf3547e56e0c45d3a4a3d72f893d7db83e322..c1c9f1419c149ac9f63539ffa976332120492627 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -106,7 +106,20 @@ public:
{
return reinterpret_cast<Return>(ThreadHeap::allocate<Metadata>(size, IsEagerlyFinalizedType<Metadata>::value));
}
- static void free(void* address) { }
+
+#if OS(WIN) && COMPILER(MSVC)
+ // MSVC eagerly instantiates the unused 'operator delete',
+ // provide a version that asserts and fails at run-time if
+ // used.
+ // Elsewhere we expect compilation to fail if 'delete' is
+ // attempted used and instantiated with a HeapAllocator-based
+ // object, as HeapAllocator::free is not provided.
+ static void free(void*)
+ {
+ NOTREACHED();
+ }
+#endif
+
template<typename T>
static void* newArray(size_t bytes)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698