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

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: fix sign mismatch comparison 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698