OLD | NEW |
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 #include "base/metrics/histogram_base.h" | 5 #include "base/metrics/histogram_base.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <utility> | 10 #include <utility> |
10 | 11 |
11 #include "base/json/json_string_value_serializer.h" | 12 #include "base/json/json_string_value_serializer.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/metrics/histogram_samples.h" | 15 #include "base/metrics/histogram_samples.h" |
16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
17 #include "base/metrics/statistics_recorder.h" | 17 #include "base/metrics/statistics_recorder.h" |
18 #include "base/pickle.h" | 18 #include "base/pickle.h" |
19 #include "base/process/process_handle.h" | 19 #include "base/process/process_handle.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 | 22 |
23 namespace base { | 23 namespace base { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 uint32_t HistogramBase::FindCorruption(const HistogramSamples& samples) const { | 100 uint32_t HistogramBase::FindCorruption(const HistogramSamples& samples) const { |
101 // Not supported by default. | 101 // Not supported by default. |
102 return NO_INCONSISTENCIES; | 102 return NO_INCONSISTENCIES; |
103 } | 103 } |
104 | 104 |
105 void HistogramBase::WriteJSON(std::string* output) const { | 105 void HistogramBase::WriteJSON(std::string* output) const { |
106 Count count; | 106 Count count; |
107 int64_t sum; | 107 int64_t sum; |
108 scoped_ptr<ListValue> buckets(new ListValue()); | 108 std::unique_ptr<ListValue> buckets(new ListValue()); |
109 GetCountAndBucketData(&count, &sum, buckets.get()); | 109 GetCountAndBucketData(&count, &sum, buckets.get()); |
110 scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); | 110 std::unique_ptr<DictionaryValue> parameters(new DictionaryValue()); |
111 GetParameters(parameters.get()); | 111 GetParameters(parameters.get()); |
112 | 112 |
113 JSONStringValueSerializer serializer(output); | 113 JSONStringValueSerializer serializer(output); |
114 DictionaryValue root; | 114 DictionaryValue root; |
115 root.SetString("name", histogram_name()); | 115 root.SetString("name", histogram_name()); |
116 root.SetInteger("count", count); | 116 root.SetInteger("count", count); |
117 root.SetDouble("sum", static_cast<double>(sum)); | 117 root.SetDouble("sum", static_cast<double>(sum)); |
118 root.SetInteger("flags", flags()); | 118 root.SetInteger("flags", flags()); |
119 root.Set("params", std::move(parameters)); | 119 root.Set("params", std::move(parameters)); |
120 root.Set("buckets", std::move(buckets)); | 120 root.Set("buckets", std::move(buckets)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED); | 224 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED); |
225 break; | 225 break; |
226 | 226 |
227 case HISTOGRAM_LOOKUP: | 227 case HISTOGRAM_LOOKUP: |
228 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP); | 228 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP); |
229 break; | 229 break; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 } // namespace base | 233 } // namespace base |
OLD | NEW |