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

Unified Diff: base/test/histogram_tester.cc

Issue 1265403003: Fix HistogramTester::GetAllSamples when empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | base/test/histogram_tester_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/histogram_tester.cc
diff --git a/base/test/histogram_tester.cc b/base/test/histogram_tester.cc
index 051f599f45a360f7afc31f897c051260a34fecde..09b4ef30ee3aa6863014db96e136b11b7274ca30 100644
--- a/base/test/histogram_tester.cc
+++ b/base/test/histogram_tester.cc
@@ -79,11 +79,13 @@ std::vector<Bucket> HistogramTester::GetAllSamples(
std::vector<Bucket> samples;
scoped_ptr<HistogramSamples> snapshot =
GetHistogramSamplesSinceCreation(name);
- for (auto it = snapshot->Iterator(); !it->Done(); it->Next()) {
- HistogramBase::Sample sample;
- HistogramBase::Count count;
- it->Get(&sample, nullptr, &count);
- samples.push_back(Bucket(sample, count));
+ if (snapshot) {
Ilya Sherman 2015/08/07 17:20:12 optional nit: I'd write this as an early return, p
twifkak 2015/08/07 19:36:38 Hmm. Was going to do this, but on second thought,
+ for (auto it = snapshot->Iterator(); !it->Done(); it->Next()) {
+ HistogramBase::Sample sample;
+ HistogramBase::Count count;
+ it->Get(&sample, nullptr, &count);
+ samples.push_back(Bucket(sample, count));
+ }
}
return samples;
}
« no previous file with comments | « no previous file | base/test/histogram_tester_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698