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

Unified Diff: components/rappor/byte_vector_utils.cc

Issue 264123004: Modify rappor parameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert platform/os part, modify metric names. Created 6 years, 7 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/byte_vector_utils.cc
diff --git a/components/rappor/byte_vector_utils.cc b/components/rappor/byte_vector_utils.cc
index 57f25744566d19056f3b1cd511789f467a773e2a..23d925c2e31af126d4498f7d9b5be14445f4f6cc 100644
--- a/components/rappor/byte_vector_utils.cc
+++ b/components/rappor/byte_vector_utils.cc
@@ -78,6 +78,14 @@ bool HMAC_DRBG_Update(const std::string& provided_data,
} // namespace
+ByteVector* ByteVectorAnd(const ByteVector& lhs, ByteVector* rhs) {
+ DCHECK_EQ(lhs.size(), rhs->size());
+ for (size_t i = 0, len = lhs.size(); i < len; ++i) {
Alexei Svitkine (slow) 2014/05/20 06:59:49 Nit: Remove len and just do i < lhs.size(). (Compi
Steven Holte 2014/05/20 22:53:53 Done.
+ (*rhs)[i] = lhs[i] & (*rhs)[i];
+ }
+ return rhs;
+}
+
ByteVector* ByteVectorOr(const ByteVector& lhs, ByteVector* rhs) {
DCHECK_EQ(lhs.size(), rhs->size());
for (size_t i = 0, len = lhs.size(); i < len; ++i) {
@@ -127,6 +135,8 @@ ByteVector ByteVectorGenerator::GetWeightedRandomByteVector(
return *ByteVectorOr(GetRandomByteVector(), &bytes);
case PROBABILITY_50:
return bytes;
+ case PROBABILITY_25:
+ return *ByteVectorAnd(GetRandomByteVector(), &bytes);
}
NOTREACHED();
return bytes;

Powered by Google App Engine
This is Rietveld 408576698