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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 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 | « base/metrics/histogram_base.h ('k') | base/metrics/histogram_base_unittest.cc » ('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 #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
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
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
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/histogram_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698