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..5cdde9b34d9fae47646c452a3f2baf19d64fa602 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)); } |
@@ -99,6 +102,15 @@ inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W> |
} |
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, unsigned count) |
+{ |
+ DCHECK_GT(count, 0); |
+ AddResult result = m_impl.add(value, 0); |
+ result.storedValue->value += count; |
+ return result; |
+} |
+ |
+template <typename T, typename U, typename V, typename W> |
inline bool HashCountedSet<T, U, V, W>::remove(iterator it) |
{ |
if (it == end()) |