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

Side by Side Diff: base/metrics/histogram.cc

Issue 2838893002: Remove base::ListValue::Set(size_t, base::Value*) (Closed)
Patch Set: Fix Compilation Error Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/values.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 11
12 #include <limits.h> 12 #include <limits.h>
13 #include <math.h> 13 #include <math.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 #include <string> 16 #include <string>
17 #include <utility>
17 18
18 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
19 #include "base/debug/alias.h" 20 #include "base/debug/alias.h"
20 #include "base/logging.h" 21 #include "base/logging.h"
21 #include "base/memory/ptr_util.h" 22 #include "base/memory/ptr_util.h"
22 #include "base/metrics/histogram_macros.h" 23 #include "base/metrics/histogram_macros.h"
23 #include "base/metrics/metrics_hashes.h" 24 #include "base/metrics/metrics_hashes.h"
24 #include "base/metrics/persistent_histogram_allocator.h" 25 #include "base/metrics/persistent_histogram_allocator.h"
25 #include "base/metrics/persistent_memory_allocator.h" 26 #include "base/metrics/persistent_memory_allocator.h"
26 #include "base/metrics/sample_vector.h" 27 #include "base/metrics/sample_vector.h"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 *sum = snapshot->sum(); 712 *sum = snapshot->sum();
712 uint32_t index = 0; 713 uint32_t index = 0;
713 for (uint32_t i = 0; i < bucket_count(); ++i) { 714 for (uint32_t i = 0; i < bucket_count(); ++i) {
714 Sample count_at_index = snapshot->GetCountAtIndex(i); 715 Sample count_at_index = snapshot->GetCountAtIndex(i);
715 if (count_at_index > 0) { 716 if (count_at_index > 0) {
716 std::unique_ptr<DictionaryValue> bucket_value(new DictionaryValue()); 717 std::unique_ptr<DictionaryValue> bucket_value(new DictionaryValue());
717 bucket_value->SetInteger("low", ranges(i)); 718 bucket_value->SetInteger("low", ranges(i));
718 if (i != bucket_count() - 1) 719 if (i != bucket_count() - 1)
719 bucket_value->SetInteger("high", ranges(i + 1)); 720 bucket_value->SetInteger("high", ranges(i + 1));
720 bucket_value->SetInteger("count", count_at_index); 721 bucket_value->SetInteger("count", count_at_index);
721 buckets->Set(index, bucket_value.release()); 722 buckets->Set(index, std::move(bucket_value));
722 ++index; 723 ++index;
723 } 724 }
724 } 725 }
725 } 726 }
726 727
727 //------------------------------------------------------------------------------ 728 //------------------------------------------------------------------------------
728 // LinearHistogram: This histogram uses a traditional set of evenly spaced 729 // LinearHistogram: This histogram uses a traditional set of evenly spaced
729 // buckets. 730 // buckets.
730 //------------------------------------------------------------------------------ 731 //------------------------------------------------------------------------------
731 732
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 Sample sample = custom_ranges[i]; 1179 Sample sample = custom_ranges[i];
1179 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) 1180 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1)
1180 return false; 1181 return false;
1181 if (sample != 0) 1182 if (sample != 0)
1182 has_valid_range = true; 1183 has_valid_range = true;
1183 } 1184 }
1184 return has_valid_range; 1185 return has_valid_range;
1185 } 1186 }
1186 1187
1187 } // namespace base 1188 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698