Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: components/rappor/rappor_service.h

Issue 1090683003: Alternative Multi-dimensional Rappor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 64-bit shift Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | components/rappor/rappor_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « components/rappor/rappor_metric.cc ('k') | components/rappor/rappor_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698