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

Unified Diff: third_party/WebKit/Source/wtf/HashCountedSet.h

Issue 2045883002: Clean up markClientsAndObserversFinished(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698