Chromium Code Reviews| Index: components/rappor/rappor_service.h |
| diff --git a/components/rappor/rappor_service.h b/components/rappor/rappor_service.h |
| index d50b91e9ca2edda4878a7314e5344b94e16e6c7d..eed6098587065d8e3bed740fe1943446b47176be 100644 |
| --- a/components/rappor/rappor_service.h |
| +++ b/components/rappor/rappor_service.h |
| @@ -15,6 +15,8 @@ |
| #include "base/timer/timer.h" |
| #include "components/metrics/daily_event.h" |
| #include "components/rappor/rappor_parameters.h" |
| +#include "components/rappor/sample.h" |
| +#include "components/rappor/sampler.h" |
| class PrefRegistrySimple; |
| class PrefService; |
| @@ -63,6 +65,20 @@ class RapporService { |
| // If |may_upload| is true, reports will be uploaded from the queue. |
| void Update(RecordingLevel recording_level, bool may_upload); |
| + // The constructs and returns a Sample object for the caller to record |
|
Alexei Svitkine (slow)
2015/04/24 18:10:01
Nit: Reword ("The constructs").
Steven Holte
2015/04/24 18:39:57
Done.
|
| + // fields in. |
| + scoped_ptr<Sample> CreateSample(RapporType); |
| + |
| + // Records a Sample of rappor metric specified by |metric_name|. |
| + // |
| + // example: |
| + // scoped_ptr<Sample> sample = rappor_service->CreateSample(MY_METRIC_TYPE); |
| + // sample->SetStringField("Field1", "some string"); |
| + // sample->SetFlagsValue("Field2", SOME|FLAGS); |
| + // rappor_service->RecordSample("MyMetric", sample.Pass()); |
|
Nathan Parker
2015/04/24 18:26:25
Can you add comment that this will lead to a repor
Steven Holte
2015/04/24 18:39:57
Done.
|
| + void RecordSampleObj(const std::string& metric_name, |
|
Alexei Svitkine (slow)
2015/04/24 18:10:01
Maybe add a TODO to rename?
Steven Holte
2015/04/24 18:39:57
Done.
|
| + scoped_ptr<Sample> sample); |
| + |
| // Records a sample of the rappor metric specified by |metric_name|. |
| // Creates and initializes the metric, if it doesn't yet exist. |
| virtual void RecordSample(const std::string& metric_name, |
| @@ -141,6 +157,8 @@ class RapporService { |
| // The map owns the metrics it contains. |
| std::map<std::string, RapporMetric*> metrics_map_; |
| + internal::Sampler sampler_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(RapporService); |
| }; |