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

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

Issue 1997153002: libchrome: Several upstreamable fixes from libchrome Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 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
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 <memory>
10 #include <utility> 10 #include <utility>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void HistogramBase::AddBoolean(bool value) { 90 void HistogramBase::AddBoolean(bool value) {
91 Add(value ? 1 : 0); 91 Add(value ? 1 : 0);
92 } 92 }
93 93
94 bool HistogramBase::SerializeInfo(Pickle* pickle) const { 94 bool HistogramBase::SerializeInfo(Pickle* pickle) const {
95 if (!pickle->WriteInt(GetHistogramType())) 95 if (!pickle->WriteInt(GetHistogramType()))
96 return false; 96 return false;
97 return SerializeInfoImpl(pickle); 97 return SerializeInfoImpl(pickle);
98 } 98 }
99 99
100 uint32_t HistogramBase::FindCorruption(const HistogramSamples& samples) const { 100 uint32_t HistogramBase::FindCorruption(
101 const HistogramSamples& /*samples*/) const {
101 // Not supported by default. 102 // Not supported by default.
102 return NO_INCONSISTENCIES; 103 return NO_INCONSISTENCIES;
103 } 104 }
104 105
105 void HistogramBase::WriteJSON(std::string* output) const { 106 void HistogramBase::WriteJSON(std::string* output) const {
106 Count count; 107 Count count;
107 int64_t sum; 108 int64_t sum;
108 std::unique_ptr<ListValue> buckets(new ListValue()); 109 std::unique_ptr<ListValue> buckets(new ListValue());
109 GetCountAndBucketData(&count, &sum, buckets.get()); 110 GetCountAndBucketData(&count, &sum, buckets.get());
110 std::unique_ptr<DictionaryValue> parameters(new DictionaryValue()); 111 std::unique_ptr<DictionaryValue> parameters(new DictionaryValue());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED); 225 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED);
225 break; 226 break;
226 227
227 case HISTOGRAM_LOOKUP: 228 case HISTOGRAM_LOOKUP:
228 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP); 229 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP);
229 break; 230 break;
230 } 231 }
231 } 232 }
232 233
233 } // namespace base 234 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698