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

Side by Side Diff: third_party/WebKit/Source/wtf/HashSet.h

Issue 2688893002: Migrate WTF::HashSet::add() to ::insert() [continued] (Closed)
Patch Set: fix HeapTest issues Created 3 years, 10 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 unified diff | Download patch
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // static bool equal(const ValueType&, const T&); 101 // static bool equal(const ValueType&, const T&);
102 template <typename HashTranslator, typename T> 102 template <typename HashTranslator, typename T>
103 iterator find(const T&) const; 103 iterator find(const T&) const;
104 template <typename HashTranslator, typename T> 104 template <typename HashTranslator, typename T>
105 bool contains(const T&) const; 105 bool contains(const T&) const;
106 106
107 // The return value is a pair of an iterator to the new value's location, 107 // The return value is a pair of an iterator to the new value's location,
108 // and a bool that is true if an new entry was added. 108 // and a bool that is true if an new entry was added.
109 template <typename IncomingValueType> 109 template <typename IncomingValueType>
110 AddResult insert(IncomingValueType&&); 110 AddResult insert(IncomingValueType&&);
111 template <typename IncomingValueType> 111 // TODO(pilgrim) remove this
112 AddResult add(IncomingValueType&&); 112 // template <typename IncomingValueType>
113 // AddResult add(IncomingValueType&&);
113 114
114 // An alternate version of add() that finds the object by hashing and 115 // An alternate version of add() that finds the object by hashing and
115 // comparing with some other type, to avoid the cost of type conversion if 116 // comparing with some other type, to avoid the cost of type conversion if
116 // the object is already in the table. HashTranslator must have the 117 // the object is already in the table. HashTranslator must have the
117 // following function members: 118 // following function members:
118 // static unsigned hash(const T&); 119 // static unsigned hash(const T&);
119 // static bool equal(const ValueType&, const T&); 120 // static bool equal(const ValueType&, const T&);
120 // static translate(ValueType&, T&&, unsigned hashCode); 121 // static translate(ValueType&, T&&, unsigned hashCode);
121 template <typename HashTranslator, typename T> 122 template <typename HashTranslator, typename T>
122 AddResult addWithTranslator(T&&); 123 AddResult addWithTranslator(T&&);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 255
255 template <typename T, typename U, typename V, typename W> 256 template <typename T, typename U, typename V, typename W>
256 template <typename IncomingValueType> 257 template <typename IncomingValueType>
257 inline typename HashSet<T, U, V, W>::AddResult HashSet<T, U, V, W>::insert( 258 inline typename HashSet<T, U, V, W>::AddResult HashSet<T, U, V, W>::insert(
258 IncomingValueType&& value) { 259 IncomingValueType&& value) {
259 return m_impl.add(std::forward<IncomingValueType>(value)); 260 return m_impl.add(std::forward<IncomingValueType>(value));
260 } 261 }
261 262
262 // TODO(pilgrim) remove this method once all references and subclasses 263 // TODO(pilgrim) remove this method once all references and subclasses
263 // have been migrated to insert() method 264 // have been migrated to insert() method
264 template <typename T, typename U, typename V, typename W> 265 // template <typename T, typename U, typename V, typename W>
265 template <typename IncomingValueType> 266 // template <typename IncomingValueType>
266 inline typename HashSet<T, U, V, W>::AddResult HashSet<T, U, V, W>::add( 267 // inline typename HashSet<T, U, V, W>::AddResult HashSet<T, U, V, W>::add(
267 IncomingValueType&& value) { 268 // IncomingValueType&& value) {
268 return m_impl.add(std::forward<IncomingValueType>(value)); 269 // return m_impl.add(std::forward<IncomingValueType>(value));
269 } 270 //}
haraken 2017/02/11 09:33:43 Can we remove this?
270 271
271 template <typename Value, 272 template <typename Value,
272 typename HashFunctions, 273 typename HashFunctions,
273 typename Traits, 274 typename Traits,
274 typename Allocator> 275 typename Allocator>
275 template <typename HashTranslator, typename T> 276 template <typename HashTranslator, typename T>
276 inline typename HashSet<Value, HashFunctions, Traits, Allocator>::AddResult 277 inline typename HashSet<Value, HashFunctions, Traits, Allocator>::AddResult
277 HashSet<Value, HashFunctions, Traits, Allocator>::addWithTranslator(T&& value) { 278 HashSet<Value, HashFunctions, Traits, Allocator>::addWithTranslator(T&& value) {
278 // Forward only the first argument, because the second argument isn't actually 279 // Forward only the first argument, because the second argument isn't actually
279 // used in HashSetTranslatorAdapter. 280 // used in HashSetTranslatorAdapter.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 iterator end = collection.end(); 333 iterator end = collection.end();
333 for (unsigned i = 0; it != end; ++it, ++i) 334 for (unsigned i = 0; it != end; ++it, ++i)
334 vector[i] = *it; 335 vector[i] = *it;
335 } 336 }
336 337
337 } // namespace WTF 338 } // namespace WTF
338 339
339 using WTF::HashSet; 340 using WTF::HashSet;
340 341
341 #endif // WTF_HashSet_h 342 #endif // WTF_HashSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/CompositorMutatorImpl.cpp ('k') | third_party/WebKit/Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698