Chromium Code Reviews| Index: components/ukm/ukm_recorder_impl.h |
| diff --git a/components/ukm/ukm_recorder_impl.h b/components/ukm/ukm_recorder_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0378fb70e715f138355c355f271a53285e63a05d |
| --- /dev/null |
| +++ b/components/ukm/ukm_recorder_impl.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_UKM_UKM_RECORDER_IMPL_H_ |
| +#define COMPONENTS_UKM_UKM_RECORDER_IMPL_H_ |
| + |
| +#include "components/ukm/public/ukm_recorder.h" |
| + |
| +namespace ukm { |
| + |
| +class UkmSource; |
| +class Report; |
| + |
| +namespace debug { |
| +class DebugPage; |
| +} |
| + |
| +class UkmRecorderImpl : public UkmRecorder { |
| + public: |
| + UkmRecorderImpl(); |
| + ~UkmRecorderImpl() override; |
| + |
| + // Enables/disables recording control if data is allowed to be collected. |
| + void EnableRecording(); |
| + void DisableRecording(); |
| + |
| + // Deletes stored recordings. |
| + void Purge(); |
| + |
| + protected: |
| + // Cache the list of whitelisted entries from the field trial parameter. |
| + void StoreWhitelistedEntries(); |
| + |
| + // Writes recordings into a report proto, and clears recordings. |
| + void StoreRecordingsInReport(Report* report); |
| + |
| + const std::map<ukm::SourceId, std::unique_ptr<UkmSource>>& sources() const { |
| + return sources_; |
| + } |
| + |
| + const std::vector<mojom::UkmEntryPtr>& entries() const { return entries_; } |
| + |
| + private: |
| + friend ::ukm::debug::DebugPage; |
| + // 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
|
| + void UpdateSourceURL(SourceId source_id, const GURL& url) override; |
| + void AddEntry(mojom::UkmEntryPtr entry) override; |
| + |
| + // Whether recording new data is currently allowed. |
| + bool recording_enabled_; |
| + |
| + // Contains newly added sources and entries of UKM metrics which periodically |
| + // get serialized and cleared by BuildAndStoreLog(). |
| + std::map<ukm::SourceId, std::unique_ptr<UkmSource>> sources_; |
| + std::vector<mojom::UkmEntryPtr> entries_; |
| + |
| + // Whitelisted Entry hashes, only the ones in this set will be recorded. |
| + std::set<uint64_t> whitelisted_entry_hashes_; |
| + |
| + 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.
|
| +}; |
| +} |
|
oystein (OOO til 10th of July)
2017/05/17 18:25:06
nit: // namespace ukm
Steven Holte
2017/05/17 20:44:31
Done.
|
| + |
| +#endif // COMPONENTS_UKM_UKM_RECORDER_IMPL_H_ |