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

Unified Diff: components/rappor/rappor.cc

Issue 49753002: RAPPOR implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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/rappor.cc
diff --git a/components/rappor/rappor.cc b/components/rappor/rappor.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b3f02acdb276cfcd13806fe8d9e6e92b2c256da5
--- /dev/null
+++ b/components/rappor/rappor.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 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.
+
+#include "components/rappor/rappor.h"
+
+namespace rappor {
+
+Rappor::Rappor(const std::string& name,
+ const uint32_t bytes_size,
+ const uint32_t hash_count,
+ const int fake_prob_index,
+ const int fake_one_prob_index,
+ const int one_honesty_prob_index,
+ const int zero_honesty_prob_index)
+ : rappor_name_(name),
+ bloom_(bytes_size, hash_count),
+ fake_prob_index_(fake_prob_index),
+ fake_one_prob_index_(fake_one_prob_index),
+ one_honesty_prob_index_(one_honesty_prob_index),
+ zero_honesty_prob_index_(zero_honesty_prob_index) {}
+
+void Rappor::AddSamples(const std::vector<std::string>& strings) {
+ bloom_.AddStrings(strings);
+}
+
+void Rappor::AddSample(const std::string& str) { bloom_.AddString(str); }
+
+const ByteVector& Rappor::GetBytes() const { return bloom_.bytes(); }
+
+const std::string& Rappor::rappor_name() const { return rappor_name_; }
+
+} // namespace rappor

Powered by Google App Engine
This is Rietveld 408576698