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

Unified Diff: components/rappor/sampler.h

Issue 1090683003: Alternative Multi-dimensional Rappor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: components/rappor/sampler.h
diff --git a/components/rappor/sampler.h b/components/rappor/sampler.h
new file mode 100644
index 0000000000000000000000000000000000000000..6ceb3ada6cad15f5f75595ffc5fafdaaa59b11d5
--- /dev/null
+++ b/components/rappor/sampler.h
@@ -0,0 +1,39 @@
+// Copyright 2014 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 COMPONENTS_RAPPOR_SAMPLER_H_
+#define COMPONENTS_RAPPOR_SAMPLER_H_
+
+#include <map>
+#include <string>
+
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/rappor/rappor_parameters.h"
+#include "components/rappor/sample.h"
+
+namespace rappor {
+
+class RapporReports;
+
+class Sampler {
Alexei Svitkine (slow) 2015/04/16 15:09:44 Comment.
Steven Holte 2015/04/22 19:24:28 Done.
+ public:
+ Sampler();
+ ~Sampler();
+
+ void AddSample(const std::string& metric_name, scoped_ptr<Sample> sample);
+ void ExportMetrics(const std::string& secret, RapporReports* reports);
+ private:
+ std::map<std::string, int> sample_counts_;
+
+ // We keep all registered metrics in a map, from name to metric.
+ // The map owns the metrics it contains.
+ base::ScopedPtrHashMap<std::string, Sample> samples_;
+ DISALLOW_COPY_AND_ASSIGN(Sampler);
Alexei Svitkine (slow) 2015/04/16 15:09:43 Blank line above.
Steven Holte 2015/04/22 19:24:28 Done.
+};
+
+} // namespace rappor
+
+#endif // COMPONENTS_RAPPOR_SAMPLER_H_

Powered by Google App Engine
This is Rietveld 408576698