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

Side by Side Diff: third_party/WebKit/Source/wtf/HashCountedSet.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 HashTraits<unsigned>, 46 HashTraits<unsigned>,
47 Allocator> 47 Allocator>
48 ImplType; 48 ImplType;
49 49
50 public: 50 public:
51 typedef Value ValueType; 51 typedef Value ValueType;
52 typedef typename ImplType::iterator iterator; 52 typedef typename ImplType::iterator iterator;
53 typedef typename ImplType::const_iterator const_iterator; 53 typedef typename ImplType::const_iterator const_iterator;
54 typedef typename ImplType::AddResult AddResult; 54 typedef typename ImplType::AddResult AddResult;
55 55
56 HashCountedSet() {} 56 HashCountedSet() {
57 static_assert(Allocator::isGarbageCollected ||
58 !IsPointerToGarbageCollectedType<Value>::value,
59 "Cannot put raw pointers to garbage-collected classes into "
60 "an off-heap HashCountedSet. Use "
61 "HeapHashCountedSet<Member<T>> instead.");
62 }
57 63
58 void swap(HashCountedSet& other) { m_impl.swap(other.m_impl); } 64 void swap(HashCountedSet& other) { m_impl.swap(other.m_impl); }
59 65
60 unsigned size() const { return m_impl.size(); } 66 unsigned size() const { return m_impl.size(); }
61 unsigned capacity() const { return m_impl.capacity(); } 67 unsigned capacity() const { return m_impl.capacity(); }
62 bool isEmpty() const { return m_impl.isEmpty(); } 68 bool isEmpty() const { return m_impl.isEmpty(); }
63 69
64 // Iterators iterate over pairs of values (called key) and counts (called 70 // Iterators iterate over pairs of values (called key) and counts (called
65 // value). 71 // value).
66 iterator begin() { return m_impl.begin(); } 72 iterator begin() { return m_impl.begin(); }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 Vector<T> vector; 177 Vector<T> vector;
172 copyToVector(*this, vector); 178 copyToVector(*this, vector);
173 return vector; 179 return vector;
174 } 180 }
175 181
176 } // namespace WTF 182 } // namespace WTF
177 183
178 using WTF::HashCountedSet; 184 using WTF::HashCountedSet;
179 185
180 #endif // WTF_HashCountedSet_h 186 #endif // WTF_HashCountedSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp ('k') | third_party/WebKit/Source/wtf/HashMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698