| 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 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_BASE_H_ |
| 6 #define BASE_METRICS_HISTOGRAM_BASE_H_ | 6 #define BASE_METRICS_HISTOGRAM_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 11 #include "base/base_export.h" | 12 #include "base/base_export.h" |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 | 16 |
| 16 class Pickle; | 17 class Pickle; |
| 17 class PickleIterator; | 18 class PickleIterator; |
| 18 | 19 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 SPARSE_HISTOGRAM, | 37 SPARSE_HISTOGRAM, |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 std::string HistogramTypeToString(HistogramType type); | 40 std::string HistogramTypeToString(HistogramType type); |
| 40 | 41 |
| 41 // Create or find existing histogram that matches the pickled info. | 42 // Create or find existing histogram that matches the pickled info. |
| 42 // Returns NULL if the pickled data has problems. | 43 // Returns NULL if the pickled data has problems. |
| 43 BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( | 44 BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( |
| 44 PickleIterator* iter); | 45 PickleIterator* iter); |
| 45 | 46 |
| 46 // Create or find existing histogram and add the samples from pickle. | |
| 47 // Silently returns when seeing any data problem in the pickle. | |
| 48 BASE_EXPORT void DeserializeHistogramAndAddSamples(PickleIterator* iter); | |
| 49 | |
| 50 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
| 51 | 48 |
| 52 class BASE_EXPORT HistogramBase { | 49 class BASE_EXPORT HistogramBase { |
| 53 public: | 50 public: |
| 54 typedef int Sample; // Used for samples. | 51 typedef int Sample; // Used for samples. |
| 55 typedef subtle::Atomic32 Count; // Used to count samples. | 52 typedef subtle::Atomic32 Count; // Used to count samples. |
| 56 | 53 |
| 57 static const Sample kSampleType_MAX; // INT_MAX | 54 static const Sample kSampleType_MAX; // INT_MAX |
| 58 | 55 |
| 59 enum Flags { | 56 enum Flags { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 private: | 160 private: |
| 164 const std::string histogram_name_; | 161 const std::string histogram_name_; |
| 165 int32 flags_; | 162 int32 flags_; |
| 166 | 163 |
| 167 DISALLOW_COPY_AND_ASSIGN(HistogramBase); | 164 DISALLOW_COPY_AND_ASSIGN(HistogramBase); |
| 168 }; | 165 }; |
| 169 | 166 |
| 170 } // namespace base | 167 } // namespace base |
| 171 | 168 |
| 172 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ | 169 #endif // BASE_METRICS_HISTOGRAM_BASE_H_ |
| OLD | NEW |