Index: third_party/WebKit/Source/wtf/HashCountedSet.h |
diff --git a/third_party/WebKit/Source/wtf/HashCountedSet.h b/third_party/WebKit/Source/wtf/HashCountedSet.h |
index d5e6e1c223a88e03db05ad20d6b3644df32d7024..495c478cc3291659230811173fada54d900d61ae 100644 |
--- a/third_party/WebKit/Source/wtf/HashCountedSet.h |
+++ b/third_party/WebKit/Source/wtf/HashCountedSet.h |
@@ -71,6 +71,9 @@ public: |
// true if an new entry was added. |
AddResult add(const ValueType&); |
+ // Generalized add(), adding the value N times. |
+ AddResult add(const ValueType&, unsigned); |
+ |
// Reduces the count of the value, and removes it if count goes down to |
// zero, returns true if the value is removed. |
bool remove(const ValueType& value) { return remove(find(value)); } |
@@ -91,14 +94,21 @@ private: |
}; |
template <typename T, typename U, typename V, typename W> |
-inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W>::add(const ValueType& value) |
+inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W>::add(const ValueType& value, unsigned count) |
{ |
+ DCHECK_GT(count, 0u); |
AddResult result = m_impl.add(value, 0); |
- ++result.storedValue->value; |
+ result.storedValue->value += count; |
return result; |
} |
template <typename T, typename U, typename V, typename W> |
+inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W>::add(const ValueType& value) |
+{ |
+ return add(value, 1u); |
+} |
+ |
+template <typename T, typename U, typename V, typename W> |
inline bool HashCountedSet<T, U, V, W>::remove(iterator it) |
{ |
if (it == end()) |