Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/metrics/histogram_base.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/common/metrics.mojom.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class CONTENT_EXPORT OneShotMetricHost : public mojom::OneShotMetricHost { | |
|
Alexei Svitkine (slow)
2017/02/22 22:13:18
Hmm, I'm not a fan of the OneShot name. To me, tha
DaleCurtis
2017/02/22 22:41:12
Given rockot@'s recommendations on a provide class
| |
| 16 public: | |
| 17 static void Create(mojom::OneShotMetricHostRequest request); | |
|
bcwhite
2017/02/21 12:37:54
Pass by const-ref.
DaleCurtis
2017/02/21 17:54:29
These are movable types, so per latest advice (and
bcwhite
2017/02/21 19:06:01
You accomplish nothing by passing the parameter by
DaleCurtis
2017/02/22 22:41:12
Actually, this doesn't compile as const&, this met
bcwhite
2017/02/23 12:13:02
Ah, yes. You can can change the signature in the
| |
| 18 | |
| 19 OneShotMetricHost(); | |
| 20 ~OneShotMetricHost() override; | |
| 21 | |
| 22 private: | |
| 23 // mojom::OneShotMetricHost implementation. | |
| 24 void Initialize(const std::string& name, | |
| 25 base::HistogramBase::Sample min, | |
| 26 base::HistogramBase::Sample max, | |
| 27 uint32_t bucket_count) override; | |
| 28 void SetSample(base::HistogramBase::Sample sample) override; | |
| 29 | |
| 30 struct Metric { | |
| 31 std::string name_; | |
| 32 base::HistogramBase::Sample min_; | |
| 33 base::HistogramBase::Sample max_; | |
| 34 uint32_t bucket_count; | |
| 35 }; | |
| 36 std::unique_ptr<Metric> metric_; | |
|
bcwhite
2017/02/21 12:37:54
Can you make these inline member variables instead
DaleCurtis
2017/02/21 17:55:03
Could, but then I also need bool values for when t
bcwhite
2017/02/21 19:06:01
Yes. Better two booleans than two managed pointer
| |
| 37 std::unique_ptr<base::HistogramBase::Sample> sample_; | |
|
Alexei Svitkine (slow)
2017/02/22 22:13:18
Sample is a int32_t and for numeric histograms, w
| |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(OneShotMetricHost); | |
| 40 }; | |
| 41 | |
| 42 } // namespace content | |
| 43 | |
| 44 #endif // CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ | |
| OLD | NEW |