| Index: components/metrics/leak_detector/ranked_set.cc
|
| diff --git a/components/metrics/leak_detector/ranked_set.cc b/components/metrics/leak_detector/ranked_set.cc
|
| index 5725fb5c01c83cb6f2a0c456096402375c032355..d2cbd64e15d50deb17c60c60d96789f6330682c6 100644
|
| --- a/components/metrics/leak_detector/ranked_set.cc
|
| +++ b/components/metrics/leak_detector/ranked_set.cc
|
| @@ -48,5 +48,17 @@ void RankedSet::Add(const ValueType& value, int count) {
|
| entries_.erase(--entries_.end());
|
| }
|
|
|
| +RankedSet::const_iterator RankedSet::Find(const ValueType& value) const {
|
| + // Due to the unusual way the entries are stored, it is best to manually
|
| + // iterate through them until an entry with a matching value is found.
|
| + // e.g. std::find() would not work because it depends on exact matching by the
|
| + // whole Entry struct.
|
| + for (const_iterator iter = begin(); iter != end(); ++iter) {
|
| + if (iter->value == value)
|
| + return iter;
|
| + }
|
| + return end();
|
| +}
|
| +
|
| } // namespace leak_detector
|
| } // namespace metrics
|
|
|