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

Side by Side Diff: components/rappor/public/sample.h

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Applying comments Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
ncarter (slow) 2016/12/05 19:50:50 2016
Navid Zolghadr 2016/12/06 19:10:33 Done.
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 #ifndef COMPONENTS_RAPPOR_SAMPLE_H_ 5 #ifndef COMPONENTS_RAPPOR_PUBLIC_SAMPLE_H_
6 #define COMPONENTS_RAPPOR_SAMPLE_H_ 6 #define COMPONENTS_RAPPOR_PUBLIC_SAMPLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "components/rappor/rappor_parameters.h" 15 #include "components/rappor/public/rappor_parameters.h"
16 16
17 namespace rappor { 17 namespace rappor {
18 18
19 class RapporReports; 19 class RapporReports;
20 class RapporService; 20 class RapporServiceImpl;
21 class TestSamplerFactory; 21 class TestSamplerFactory;
22 22
23 // Sample is a container for information about a single instance of some event 23 // Sample is a container for information about a single instance of some event
24 // we are sending Rappor data about. It may contain multiple different fields, 24 // we are sending Rappor data about. It may contain multiple different fields,
25 // which describe different details of the event, and they will be sent in the 25 // which describe different details of the event, and they will be sent in the
26 // same Rappor report, enabling analysis of correlations between those fields. 26 // same Rappor report, enabling analysis of correlations between those fields.
27 class Sample { 27 class Sample {
28 public: 28 public:
29 virtual ~Sample(); 29 virtual ~Sample();
30 30
(...skipping 22 matching lines...) Expand all
53 53
54 // Generate randomized reports and store them in |reports|. 54 // Generate randomized reports and store them in |reports|.
55 virtual void ExportMetrics(const std::string& secret, 55 virtual void ExportMetrics(const std::string& secret,
56 const std::string& metric_name, 56 const std::string& metric_name,
57 RapporReports* reports) const; 57 RapporReports* reports) const;
58 58
59 const RapporParameters& parameters() { return parameters_; } 59 const RapporParameters& parameters() { return parameters_; }
60 60
61 private: 61 private:
62 friend class TestSamplerFactory; 62 friend class TestSamplerFactory;
63 friend class RapporService; 63 friend class RapporServiceImpl;
64 friend class TestSample; 64 friend class TestSample;
65 65
66 // Constructs a sample. Instead of calling this directly, call 66 // Constructs a sample. Instead of calling this directly, call
67 // RapporService::MakeSampleObj to create a sample. 67 // RapporService::MakeSampleObj to create a sample.
68 Sample(int32_t cohort_seed, const RapporParameters& parameters); 68 Sample(int32_t cohort_seed, const RapporParameters& parameters);
69 69
70 const RapporParameters parameters_; 70 const RapporParameters parameters_;
71 71
72 // Offset used for bloom filter hash functions. 72 // Offset used for bloom filter hash functions.
73 uint32_t bloom_offset_; 73 uint32_t bloom_offset_;
74 74
75 struct FieldInfo { 75 struct FieldInfo {
76 // Size of the field, in bytes. 76 // Size of the field, in bytes.
77 size_t size; 77 size_t size;
78 // The non-randomized report value for the field. 78 // The non-randomized report value for the field.
79 uint64_t value; 79 uint64_t value;
80 // The noise level to use when creating a report for the field. 80 // The noise level to use when creating a report for the field.
81 NoiseLevel noise_level; 81 NoiseLevel noise_level;
82 }; 82 };
83 83
84 // Information about all recorded fields. 84 // Information about all recorded fields.
85 std::map<std::string, FieldInfo> field_info_; 85 std::map<std::string, FieldInfo> field_info_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(Sample); 87 DISALLOW_COPY_AND_ASSIGN(Sample);
88 }; 88 };
89 89
90 } // namespace rappor 90 } // namespace rappor
91 91
92 #endif // COMPONENTS_RAPPOR_SAMPLE_H_ 92 #endif // COMPONENTS_RAPPOR_PUBLIC_SAMPLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698