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

Unified Diff: third_party/WebKit/Source/wtf/HashMap.h

Issue 2553673002: Disallow off-heap containers containing raw on-heap pointers. (Closed)
Patch Set: Created 4 years 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/wtf/HashCountedSet.h ('k') | third_party/WebKit/Source/wtf/HashSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/HashMap.h
diff --git a/third_party/WebKit/Source/wtf/HashMap.h b/third_party/WebKit/Source/wtf/HashMap.h
index b6f381d77f1bdaf378a7c0511654784c2a181664..b503ec6e142ec32a807e754517f3c687611cfb0f 100644
--- a/third_party/WebKit/Source/wtf/HashMap.h
+++ b/third_party/WebKit/Source/wtf/HashMap.h
@@ -78,12 +78,22 @@ class HashMap {
class HashMapValuesProxy;
public:
+ HashMap() {
+ static_assert(Allocator::isGarbageCollected ||
+ !IsPointerToGarbageCollectedType<KeyArg>::value,
+ "Cannot put raw pointers to garbage-collected classes into "
+ "an off-heap HashMap. Use HeapHashMap<> instead.");
+ static_assert(Allocator::isGarbageCollected ||
+ !IsPointerToGarbageCollectedType<MappedArg>::value,
+ "Cannot put raw pointers to garbage-collected classes into "
+ "an off-heap HashMap. Use HeapHashMap<> instead.");
+ }
+
typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator;
typedef HashTableConstIteratorAdapter<HashTableType, ValueType>
const_iterator;
typedef typename HashTableType::AddResult AddResult;
- public:
void swap(HashMap& ref) { m_impl.swap(ref.m_impl); }
unsigned size() const;
« no previous file with comments | « third_party/WebKit/Source/wtf/HashCountedSet.h ('k') | third_party/WebKit/Source/wtf/HashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698