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

Unified Diff: components/ukm/ukm_service.h

Issue 2749433002: Create Field Trial param for whitelisting UKM Entries. (Closed)
Patch Set: add comment Created 3 years, 9 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/ukm/ukm_service.h
diff --git a/components/ukm/ukm_service.h b/components/ukm/ukm_service.h
index 3431b672bbc360c1fc6ea357e246cf4166ffb53c..b071f8c85ec9329eddbbed227d29220a855d1732 100644
--- a/components/ukm/ukm_service.h
+++ b/components/ukm/ukm_service.h
@@ -111,6 +111,7 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
LogsUploadedOnlyWhenHavingSourcesOrEntries);
FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, MetricsProviderTest);
FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, PersistAndPurge);
+ FRIEND_TEST_ALL_PREFIXES(UkmServiceTest, WhitelistEntryTest);
// Get a new UkmEntryBuilder object for the specified source ID and event,
// which can get metrics added to.
@@ -149,6 +150,9 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
// Add an entry to the UkmEntry list.
void AddEntry(std::unique_ptr<UkmEntry> entry);
+ // Cache the list of whitelisted entries from the field trial parameter.
+ void StoreWhitelistedEntries();
+
// A weak pointer to the PrefService used to read and write preferences.
PrefService* pref_service_;
@@ -189,6 +193,9 @@ class UkmService : public base::SupportsWeakPtr<UkmService> {
std::vector<std::unique_ptr<UkmSource>> sources_;
std::vector<std::unique_ptr<UkmEntry>> entries_;
+ // Whitelisted Entry hashes, only the ones in this set will be recorded.
+ std::set<uint64_t> whitelisted_entry_hashes_;
+
// Weak pointers factory used to post task on different threads. All weak
// pointers managed by this factory have the same lifetime as UkmService.
base::WeakPtrFactory<UkmService> self_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698