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

Unified Diff: components/metrics/leak_detector/ranked_set.h

Issue 1870233003: Record call site history in LeakDetectorImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test coverage Created 4 years, 8 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: components/metrics/leak_detector/ranked_set.h
diff --git a/components/metrics/leak_detector/ranked_set.h b/components/metrics/leak_detector/ranked_set.h
index f91251593b046147d5ed2f7ac99f77886ee50235..016f0ff92f4dcb028e89d8b40e52181fa6138b58 100644
--- a/components/metrics/leak_detector/ranked_set.h
+++ b/components/metrics/leak_detector/ranked_set.h
@@ -72,7 +72,18 @@ class RankedSet {
Add(ValueType(call_stack), count);
}
+ // Helper functions to directly search for an element with |value| equal to a
+ // particular size or call stack.
+ const_iterator FindSize(size_t size) const { return Find(ValueType(size)); }
+ const_iterator FindCallStack(const CallStack* call_stack) const {
+ return Find(ValueType(call_stack));
+ }
+
private:
+ // Returns an iterator to the element in |entries_| with value=|value|, or to
+ // entries_.end() if it was not found.
+ const_iterator Find(const ValueType& value) const;
+
// Max and min counts. Returns 0 if the list is empty.
int max_count() const {
return entries_.empty() ? 0 : entries_.begin()->count;

Powered by Google App Engine
This is Rietveld 408576698