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

Side by Side Diff: components/rappor/sample.cc

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « components/rappor/sample.h ('k') | components/rappor/test_rappor_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/rappor/sample.h" 5 #include "components/rappor/sample.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/metrics_hashes.h" 11 #include "base/metrics/metrics_hashes.h"
12 #include "components/rappor/bloom_filter.h" 12 #include "components/rappor/bloom_filter.h"
13 #include "components/rappor/byte_vector_utils.h" 13 #include "components/rappor/byte_vector_utils.h"
14 #include "components/rappor/proto/rappor_metric.pb.h" 14 #include "components/rappor/proto/rappor_metric.pb.h"
15 #include "components/rappor/reports.h" 15 #include "components/rappor/reports.h"
16 16
17 namespace rappor { 17 namespace rappor {
18 18
19 Sample::Sample(int32_t cohort_seed, const RapporParameters& parameters) 19 Sample::Sample(int32_t cohort_seed, const RapporParameters& parameters)
20 : parameters_(parameters), 20 : parameters_(parameters),
21 bloom_offset_((cohort_seed % parameters_.num_cohorts) * 21 bloom_offset_((cohort_seed % parameters_.num_cohorts) *
22 parameters_.bloom_filter_hash_function_count) { 22 parameters_.bloom_filter_hash_function_count) {
23 // Must use bloom filter size that fits in uint64. 23 // Must use bloom filter size that fits in uint64_t.
24 DCHECK_LE(parameters_.bloom_filter_size_bytes, 8); 24 DCHECK_LE(parameters_.bloom_filter_size_bytes, 8);
25 } 25 }
26 26
27 Sample::~Sample() { 27 Sample::~Sample() {
28 } 28 }
29 29
30 void Sample::SetStringField(const std::string& field_name, 30 void Sample::SetStringField(const std::string& field_name,
31 const std::string& value) { 31 const std::string& value) {
32 DVLOG(2) << "Recording sample \"" << value 32 DVLOG(2) << "Recording sample \"" << value
33 << "\" for sample metric field \"" << field_name << "\""; 33 << "\" for sample metric field \"" << field_name << "\"";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 RapporReports::Report* report = reports->add_report(); 69 RapporReports::Report* report = reports->add_report();
70 report->set_name_hash(base::HashMetricName( 70 report->set_name_hash(base::HashMetricName(
71 metric_name + "." + kv.first)); 71 metric_name + "." + kv.first));
72 report->set_bits(std::string(report_bytes.begin(), report_bytes.end())); 72 report->set_bits(std::string(report_bytes.begin(), report_bytes.end()));
73 DVLOG(2) << "Exporting sample " << metric_name << "." << kv.first; 73 DVLOG(2) << "Exporting sample " << metric_name << "." << kv.first;
74 } 74 }
75 } 75 }
76 76
77 } // namespace rappor 77 } // namespace rappor
OLDNEW
« no previous file with comments | « components/rappor/sample.h ('k') | components/rappor/test_rappor_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698