Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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 COMPONENTS_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H | |
|
Ben Chan
2014/04/18 20:27:08
ditto
| |
| 6 #define COMPONENTS_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "components/metrics/metric_sample_chromeos.h" | |
| 13 | |
| 14 namespace metrics { | |
| 15 | |
| 16 // Represents a linear histogram sample (called Enum too). | |
| 17 // This class is meant to be used to serialize and deserialize samples to send | |
| 18 // them from chrome os to chrome. | |
| 19 class BASE_EXPORT LinearHistogramSample : public MetricSample { | |
| 20 public: | |
| 21 LinearHistogramSample(const std::string& name, int sample, int max); | |
| 22 virtual ~LinearHistogramSample(); | |
| 23 | |
| 24 int sample() const { return sample_; } | |
| 25 int max() const { return max_; } | |
| 26 | |
| 27 // Returns the serialized version of the sample in the format: | |
| 28 // linearhistogram\0|name_| |sample_| |max_|\0 | |
| 29 virtual std::string ToString() const OVERRIDE; | |
| 30 | |
| 31 // Deserialize a sample passed as a string. | |
| 32 // Returns a LinearHistogram if the deserialization is successful. | |
| 33 // Returns NULL if the deserialization fails. | |
| 34 static LinearHistogramSample* ReadLinearHistogram( | |
| 35 const std::string& serialized_histogram); | |
| 36 | |
| 37 private: | |
| 38 const int sample_, max_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(LinearHistogramSample); | |
| 41 }; | |
| 42 | |
| 43 } // namespace metrics | |
| 44 | |
| 45 #endif // COMPONENTS_METRICS_LINEARHISTOGRAM_SAMPLE_CHROMEOS_H | |
| OLD | NEW |