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

Side by Side Diff: components/ukm/ukm_recorder_impl.h

Issue 2883563002: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Move interface to next CL Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_UKM_UKM_RECORDER_IMPL_H_
6 #define COMPONENTS_UKM_UKM_RECORDER_IMPL_H_
7
8 #include "components/ukm/public/ukm_recorder.h"
9
10 namespace ukm {
11
12 class UkmSource;
13 class Report;
14
15 namespace debug {
16 class DebugPage;
17 }
18
19 class UkmRecorderImpl : public UkmRecorder {
20 public:
21 UkmRecorderImpl();
22 ~UkmRecorderImpl() override;
23
24 // Enables/disables recording control if data is allowed to be collected.
25 void EnableRecording();
26 void DisableRecording();
27
28 // Deletes stored recordings.
29 void Purge();
30
31 protected:
32 // Cache the list of whitelisted entries from the field trial parameter.
33 void StoreWhitelistedEntries();
34
35 // Writes recordings into a report proto, and clears recordings.
36 void StoreRecordingsInReport(Report* report);
37
38 const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& sources() const {
39 return sources_;
40 }
41
42 const std::vector<mojom::UkmEntryPtr>& entries() const { return entries_; }
43
44 private:
45 friend ::ukm::debug::DebugPage;
46 // UkmRecorder:
oystein (OOO til 10th of July) 2017/05/17 18:25:06 nit: "UkmRecorder implementation:" for consistency
Steven Holte 2017/05/17 20:44:31 Not including the word implementation seems to be
47 void UpdateSourceURL(SourceId source_id, const GURL& url) override;
48 void AddEntry(mojom::UkmEntryPtr entry) override;
49
50 // Whether recording new data is currently allowed.
51 bool recording_enabled_;
52
53 // Contains newly added sources and entries of UKM metrics which periodically
54 // get serialized and cleared by BuildAndStoreLog().
55 std::map<ukm::SourceId, std::unique_ptr<UkmSource>> sources_;
56 std::vector<mojom::UkmEntryPtr> entries_;
57
58 // Whitelisted Entry hashes, only the ones in this set will be recorded.
59 std::set<uint64_t> whitelisted_entry_hashes_;
60
61 THREAD_CHECKER(thread_checker_);
oystein (OOO til 10th of July) 2017/05/17 18:25:06 nit: missing some includes for this (and the STL s
Steven Holte 2017/05/17 20:44:31 Done.
62 };
63 }
oystein (OOO til 10th of July) 2017/05/17 18:25:06 nit: // namespace ukm
Steven Holte 2017/05/17 20:44:31 Done.
64
65 #endif // COMPONENTS_UKM_UKM_RECORDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698