Index: components/metrics/persisted_logs.h |
diff --git a/components/metrics/persisted_logs.h b/components/metrics/persisted_logs.h |
index 479924fd0fdab8fd717d6d1ad852c3d7624a04ec..2af474bb341964162a8a684cbf834a96e2c7ceeb 100644 |
--- a/components/metrics/persisted_logs.h |
+++ b/components/metrics/persisted_logs.h |
@@ -7,6 +7,7 @@ |
#include <stddef.h> |
+#include <memory> |
#include <string> |
#include <vector> |
@@ -18,6 +19,8 @@ class PrefService; |
namespace metrics { |
+class PersistedLogsMetrics; |
+ |
// Maintains a list of unsent logs that are written and restored from disk. |
class PersistedLogs { |
public: |
@@ -49,7 +52,8 @@ class PersistedLogs { |
// |
// If the optional |max_log_size| parameter is non-zero, all logs larger than |
// that limit will be skipped when writing to disk. |
- PersistedLogs(PrefService* local_state, |
+ PersistedLogs(std::unique_ptr<PersistedLogsMetrics> metrics, |
+ PrefService* local_state, |
const char* pref_name, |
const char* outdated_pref_name, |
size_t min_log_count, |
@@ -110,6 +114,9 @@ class PersistedLogs { |
// Reads the list from the ListValue in the old Log-hash pair format. |
LogReadStatus ReadLogsFromOldFormatPrefList(const base::ListValue& list); |
+ // An object for recording UMA metrics. |
+ std::unique_ptr<PersistedLogsMetrics> metrics_; |
+ |
// A weak pointer to the PrefService object to read and write the preference |
// from. Calling code should ensure this object continues to exist for the |
// lifetime of the PersistedLogs object. |
@@ -134,7 +141,10 @@ class PersistedLogs { |
struct LogInfo { |
// Initializes the members based on uncompressed |log_data| and |
// |log_timestamp|. |
- void Init(const std::string& log_data, const std::string& log_timestamp); |
+ // |metrics| is the parent's metrics_ object, and should not be held. |
+ void Init(PersistedLogsMetrics* metrics, |
+ const std::string& log_data, |
+ const std::string& log_timestamp); |
// Compressed log data - a serialized protobuf that's been gzipped. |
std::string compressed_log_data; |