Index: components/rappor/rappor_service.h |
diff --git a/components/rappor/rappor_service.h b/components/rappor/rappor_service.h |
index d50b91e9ca2edda4878a7314e5344b94e16e6c7d..564c7f52df8343e2955b29a60968eb98711013e0 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,26 @@ class RapporService { |
// If |may_upload| is true, reports will be uploaded from the queue. |
void Update(RecordingLevel recording_level, bool may_upload); |
+ // Constructs a Sample object for the caller to record fields in. |
+ scoped_ptr<Sample> CreateSample(RapporType); |
+ |
+ // Records a Sample of rappor metric specified by |metric_name|. |
+ // |
+ // TODO(holte): Rename RecordSample to RecordString and then rename this |
+ // to RecordSample. |
+ // |
+ // 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()); |
+ // |
+ // This will result in a report setting two metrics "MyMetric.Field1" and |
+ // "MyMetric.Field2", and they will both be generated from the same sample, |
+ // to allow for correllations to be computed. |
+ void RecordSampleObj(const std::string& metric_name, |
+ 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 +163,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); |
}; |