Chromium Code Reviews| Index: content/browser/renderer_host/one_shot_metric_host.h |
| diff --git a/content/browser/renderer_host/one_shot_metric_host.h b/content/browser/renderer_host/one_shot_metric_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf7287b7bfba6179cb130144b1fd254a74b6eb1d |
| --- /dev/null |
| +++ b/content/browser/renderer_host/one_shot_metric_host.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/metrics/histogram_base.h" |
| +#include "content/common/content_export.h" |
| +#include "content/common/metrics.mojom.h" |
| + |
| +namespace content { |
| + |
| +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
|
| + public: |
| + 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
|
| + |
| + OneShotMetricHost(); |
| + ~OneShotMetricHost() override; |
| + |
| + private: |
| + // mojom::OneShotMetricHost implementation. |
| + void Initialize(const std::string& name, |
| + base::HistogramBase::Sample min, |
| + base::HistogramBase::Sample max, |
| + uint32_t bucket_count) override; |
| + void SetSample(base::HistogramBase::Sample sample) override; |
| + |
| + struct Metric { |
| + std::string name_; |
| + base::HistogramBase::Sample min_; |
| + base::HistogramBase::Sample max_; |
| + uint32_t bucket_count; |
| + }; |
| + 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
|
| + 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
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(OneShotMetricHost); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_ONE_SHOT_METRIC_HOST_H_ |