OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H |
| 6 #define BASE_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/base_export.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/metrics/metric_sample_chromeos.h" |
| 13 |
| 14 namespace base { |
| 15 // Represents a linear histogram sample (called Enum too). |
| 16 // This class is meant to be used to serialize and deserialize samples to send |
| 17 // them from chrome os to chrome. |
| 18 class BASE_EXPORT LinearHistogramSample : public MetricSample { |
| 19 public: |
| 20 LinearHistogramSample(const std::string& histname, int sample, int max); |
| 21 virtual ~LinearHistogramSample(); |
| 22 |
| 23 int sample() const; |
| 24 int max() const; |
| 25 // Returns the serialized version of the sample in the format: |
| 26 // linearhistogram\0|name_| |sample_| |max_|\0 |
| 27 virtual string ToString() const OVERRIDE; |
| 28 |
| 29 // static |
| 30 // Deserialize a sample passed as a string. |
| 31 // Returns a LinearHistogram if the deserialization is successful. |
| 32 // Returns NULL if the deserialization fails. |
| 33 static LinearHistogramSample* ReadLinearHistogram( |
| 34 const std::string& serialized_histogram); |
| 35 |
| 36 private: |
| 37 int sample_, max_; |
| 38 }; |
| 39 } // namespace base |
| 40 #endif // BASE_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H |
OLD | NEW |