OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
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 #include "components/metrics/metrics_log_manager.h" | 5 #include "components/metrics/metrics_log_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 MetricsLogManager::MetricsLogManager(PrefService* local_state, | 41 MetricsLogManager::MetricsLogManager(PrefService* local_state, |
42 size_t max_ongoing_log_size) | 42 size_t max_ongoing_log_size) |
43 : unsent_logs_loaded_(false), | 43 : unsent_logs_loaded_(false), |
44 initial_log_queue_(std::unique_ptr<PersistedLogsMetricsImpl>( | 44 initial_log_queue_(std::unique_ptr<PersistedLogsMetricsImpl>( |
45 new PersistedLogsMetricsImpl()), | 45 new PersistedLogsMetricsImpl()), |
46 local_state, | 46 local_state, |
47 prefs::kMetricsInitialLogs, | 47 prefs::kMetricsInitialLogs, |
48 prefs::kDeprecatedMetricsInitialLogs, | |
49 kInitialLogsPersistLimit, | 48 kInitialLogsPersistLimit, |
50 kStorageByteLimitPerLogType, | 49 kStorageByteLimitPerLogType, |
51 0), | 50 0), |
52 ongoing_log_queue_(std::unique_ptr<PersistedLogsMetricsImpl>( | 51 ongoing_log_queue_(std::unique_ptr<PersistedLogsMetricsImpl>( |
53 new PersistedLogsMetricsImpl()), | 52 new PersistedLogsMetricsImpl()), |
54 local_state, | 53 local_state, |
55 prefs::kMetricsOngoingLogs, | 54 prefs::kMetricsOngoingLogs, |
56 prefs::kDeprecatedMetricsOngoingLogs, | |
57 kOngoingLogsPersistLimit, | 55 kOngoingLogsPersistLimit, |
58 kStorageByteLimitPerLogType, | 56 kStorageByteLimitPerLogType, |
59 max_ongoing_log_size) {} | 57 max_ongoing_log_size) {} |
60 | 58 |
61 MetricsLogManager::~MetricsLogManager() {} | 59 MetricsLogManager::~MetricsLogManager() {} |
62 | 60 |
63 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { | 61 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { |
64 DCHECK(!current_log_); | 62 DCHECK(!current_log_); |
65 current_log_ = std::move(log); | 63 current_log_ = std::move(log); |
66 } | 64 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ongoing_log_queue_.SerializeLogs(); | 126 ongoing_log_queue_.SerializeLogs(); |
129 } | 127 } |
130 | 128 |
131 void MetricsLogManager::LoadPersistedUnsentLogs() { | 129 void MetricsLogManager::LoadPersistedUnsentLogs() { |
132 initial_log_queue_.DeserializeLogs(); | 130 initial_log_queue_.DeserializeLogs(); |
133 ongoing_log_queue_.DeserializeLogs(); | 131 ongoing_log_queue_.DeserializeLogs(); |
134 unsent_logs_loaded_ = true; | 132 unsent_logs_loaded_ = true; |
135 } | 133 } |
136 | 134 |
137 } // namespace metrics | 135 } // namespace metrics |
OLD | NEW |