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

Unified Diff: base/metrics/histogram_snapshot_manager.h

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: added a couple tests (and fixed related issues) Created 5 years, 1 month 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: base/metrics/histogram_snapshot_manager.h
diff --git a/base/metrics/histogram_snapshot_manager.h b/base/metrics/histogram_snapshot_manager.h
index 484287c2ab9f35b27ba53475a19e2beda9a39abb..0d2f05bf6819e15f071e87d00eda93bb7c31906a 100644
--- a/base/metrics/histogram_snapshot_manager.h
+++ b/base/metrics/histogram_snapshot_manager.h
@@ -34,8 +34,17 @@ class BASE_EXPORT HistogramSnapshotManager {
// Only histograms that have all the flags specified by the argument will be
// chosen. If all histograms should be recorded, set it to
// |Histogram::kNoFlags|.
- void PrepareDeltas(HistogramBase::Flags flags_to_set,
- HistogramBase::Flags required_flags);
+ template <class ForwardHistogramIterator>
+ void PrepareDeltas(ForwardHistogramIterator begin,
+ ForwardHistogramIterator end,
+ HistogramBase::Flags flags_to_set,
+ HistogramBase::Flags required_flags) {
+ for (ForwardHistogramIterator it = begin; it != end; ++it) {
+ (*it)->SetFlags(flags_to_set);
+ if (((*it)->flags() & required_flags) == required_flags)
+ PrepareDelta(**it);
+ }
+ }
private:
// Snapshot this histogram, and record the delta.

Powered by Google App Engine
This is Rietveld 408576698