| 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/sparse_histogram.h" | 5 #include "base/metrics/sparse_histogram.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/metrics_hashes.h" | 10 #include "base/metrics/metrics_hashes.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 201 } |
| 202 | 202 |
| 203 HistogramBase* SparseHistogram::DeserializeInfoImpl(PickleIterator* iter) { | 203 HistogramBase* SparseHistogram::DeserializeInfoImpl(PickleIterator* iter) { |
| 204 std::string histogram_name; | 204 std::string histogram_name; |
| 205 int flags; | 205 int flags; |
| 206 if (!iter->ReadString(&histogram_name) || !iter->ReadInt(&flags)) { | 206 if (!iter->ReadString(&histogram_name) || !iter->ReadInt(&flags)) { |
| 207 DLOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name; | 207 DLOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name; |
| 208 return NULL; | 208 return NULL; |
| 209 } | 209 } |
| 210 | 210 |
| 211 DCHECK(flags & HistogramBase::kIPCSerializationSourceFlag); | |
| 212 flags &= ~HistogramBase::kIPCSerializationSourceFlag; | 211 flags &= ~HistogramBase::kIPCSerializationSourceFlag; |
| 213 | 212 |
| 214 return SparseHistogram::FactoryGet(histogram_name, flags); | 213 return SparseHistogram::FactoryGet(histogram_name, flags); |
| 215 } | 214 } |
| 216 | 215 |
| 217 void SparseHistogram::GetParameters(DictionaryValue* params) const { | 216 void SparseHistogram::GetParameters(DictionaryValue* params) const { |
| 218 // TODO(kaiwang): Implement. (See HistogramBase::WriteJSON.) | 217 // TODO(kaiwang): Implement. (See HistogramBase::WriteJSON.) |
| 219 } | 218 } |
| 220 | 219 |
| 221 void SparseHistogram::GetCountAndBucketData(Count* count, | 220 void SparseHistogram::GetCountAndBucketData(Count* count, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 std::string* output) const { | 280 std::string* output) const { |
| 282 StringAppendF(output, | 281 StringAppendF(output, |
| 283 "Histogram: %s recorded %d samples", | 282 "Histogram: %s recorded %d samples", |
| 284 histogram_name().c_str(), | 283 histogram_name().c_str(), |
| 285 total_count); | 284 total_count); |
| 286 if (flags() & ~kHexRangePrintingFlag) | 285 if (flags() & ~kHexRangePrintingFlag) |
| 287 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); | 286 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace base | 289 } // namespace base |
| OLD | NEW |