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

Side by Side Diff: third_party/WebKit/Source/wtf/HashSet.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
« no previous file with comments | « third_party/WebKit/Source/wtf/HashMap.h ('k') | third_party/WebKit/Source/wtf/LinkedHashSet.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 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ValueTraits, 56 ValueTraits,
57 Allocator> 57 Allocator>
58 HashTableType; 58 HashTableType;
59 59
60 public: 60 public:
61 typedef HashTableConstIteratorAdapter<HashTableType, ValueTraits> iterator; 61 typedef HashTableConstIteratorAdapter<HashTableType, ValueTraits> iterator;
62 typedef HashTableConstIteratorAdapter<HashTableType, ValueTraits> 62 typedef HashTableConstIteratorAdapter<HashTableType, ValueTraits>
63 const_iterator; 63 const_iterator;
64 typedef typename HashTableType::AddResult AddResult; 64 typedef typename HashTableType::AddResult AddResult;
65 65
66 HashSet() = default; 66 HashSet() {
67 static_assert(Allocator::isGarbageCollected ||
68 !IsPointerToGarbageCollectedType<ValueArg>::value,
69 "Cannot put raw pointers to garbage-collected classes into "
70 "an off-heap HashSet. Use HeapHashSet<Member<T>> instead.");
71 }
67 HashSet(const HashSet&) = default; 72 HashSet(const HashSet&) = default;
68 HashSet& operator=(const HashSet&) = default; 73 HashSet& operator=(const HashSet&) = default;
69 HashSet(HashSet&&) = default; 74 HashSet(HashSet&&) = default;
70 HashSet& operator=(HashSet&&) = default; 75 HashSet& operator=(HashSet&&) = default;
71 76
72 HashSet(std::initializer_list<ValueType> elements); 77 HashSet(std::initializer_list<ValueType> elements);
73 HashSet& operator=(std::initializer_list<ValueType> elements); 78 HashSet& operator=(std::initializer_list<ValueType> elements);
74 79
75 void swap(HashSet& ref) { m_impl.swap(ref.m_impl); } 80 void swap(HashSet& ref) { m_impl.swap(ref.m_impl); }
76 81
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 iterator end = collection.end(); 320 iterator end = collection.end();
316 for (unsigned i = 0; it != end; ++it, ++i) 321 for (unsigned i = 0; it != end; ++it, ++i)
317 vector[i] = *it; 322 vector[i] = *it;
318 } 323 }
319 324
320 } // namespace WTF 325 } // namespace WTF
321 326
322 using WTF::HashSet; 327 using WTF::HashSet;
323 328
324 #endif // WTF_HashSet_h 329 #endif // WTF_HashSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashMap.h ('k') | third_party/WebKit/Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698