Commit 2c5ea4d8 authored by mukai's avatar mukai Committed by Commit bot

Cleanup of component/metrics for GN.

- Adds missing rules of BUILD.gn
- removes unnecessary const which causes warning for some compiler
  flag set on GN.

BUG=None
R=mpearson@chromium.org, cmasone@chromium.org
TEST=manually

Review URL: https://codereview.chromium.org/644603002

Cr-Commit-Position: refs/heads/master@{#299012}
parent c1207e6e
...@@ -52,6 +52,10 @@ source_set("metrics") { ...@@ -52,6 +52,10 @@ source_set("metrics") {
"//components/variations", "//components/variations",
"//third_party/zlib", "//third_party/zlib",
] ]
if (is_chromeos) {
deps += [ ":serialization" ]
}
} }
# GYP version: components/metrics.gypi:metrics_gpu # GYP version: components/metrics.gypi:metrics_gpu
...@@ -121,4 +125,17 @@ static_library("test_support") { ...@@ -121,4 +125,17 @@ static_library("test_support") {
] ]
} }
if (is_linux) {
# GYP version: components/metrics.gypi:metrics_serialization
source_set("serialization") {
sources = [
"serialization/serialization_utils.cc",
"serialization/serialization_utils.h",
"serialization/metric_sample.cc",
"serialization/metric_sample.h",
]
deps = [ "//base" ]
}
}
# TODO(GYP): metrics_chromeos # TODO(GYP): metrics_chromeos
...@@ -74,25 +74,25 @@ std::string MetricSample::ToString() const { ...@@ -74,25 +74,25 @@ std::string MetricSample::ToString() const {
} }
} }
const int MetricSample::sample() const { int MetricSample::sample() const {
CHECK_NE(type_, USER_ACTION); CHECK_NE(type_, USER_ACTION);
CHECK_NE(type_, CRASH); CHECK_NE(type_, CRASH);
return sample_; return sample_;
} }
const int MetricSample::min() const { int MetricSample::min() const {
CHECK_EQ(type_, HISTOGRAM); CHECK_EQ(type_, HISTOGRAM);
return min_; return min_;
} }
const int MetricSample::max() const { int MetricSample::max() const {
CHECK_NE(type_, CRASH); CHECK_NE(type_, CRASH);
CHECK_NE(type_, USER_ACTION); CHECK_NE(type_, USER_ACTION);
CHECK_NE(type_, SPARSE_HISTOGRAM); CHECK_NE(type_, SPARSE_HISTOGRAM);
return max_; return max_;
} }
const int MetricSample::bucket_count() const { int MetricSample::bucket_count() const {
CHECK_EQ(type_, HISTOGRAM); CHECK_EQ(type_, HISTOGRAM);
return bucket_count_; return bucket_count_;
} }
......
...@@ -43,10 +43,10 @@ class MetricSample { ...@@ -43,10 +43,10 @@ class MetricSample {
// Check the metric type to make sure the request make sense. (ex: a crash // Check the metric type to make sure the request make sense. (ex: a crash
// sample does not have a bucket_count so we crash if we call bucket_count() // sample does not have a bucket_count so we crash if we call bucket_count()
// on it.) // on it.)
const int sample() const; int sample() const;
const int min() const; int min() const;
const int max() const; int max() const;
const int bucket_count() const; int bucket_count() const;
// Returns a serialized version of the sample. // Returns a serialized version of the sample.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment