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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 : unsent_logs_loaded_(false), | 42 : unsent_logs_loaded_(false), |
43 initial_log_queue_(local_state, | 43 initial_log_queue_(local_state, |
44 prefs::kMetricsInitialLogs, | 44 prefs::kMetricsInitialLogs, |
45 kInitialLogsPersistLimit, | 45 kInitialLogsPersistLimit, |
46 kStorageByteLimitPerLogType, | 46 kStorageByteLimitPerLogType, |
47 0), | 47 0), |
48 ongoing_log_queue_(local_state, | 48 ongoing_log_queue_(local_state, |
49 prefs::kMetricsOngoingLogs, | 49 prefs::kMetricsOngoingLogs, |
50 kOngoingLogsPersistLimit, | 50 kOngoingLogsPersistLimit, |
51 kStorageByteLimitPerLogType, | 51 kStorageByteLimitPerLogType, |
52 max_ongoing_log_size) {} | 52 max_ongoing_log_size) { |
53 initial_log_queue_.MigrateFromOldFormat(prefs::kDeprecatedMetricsInitialLogs); | |
Alexei Svitkine (slow)
2016/09/28 18:50:30
I'm not sure we need an explicit migrate function.
| |
54 ongoing_log_queue_.MigrateFromOldFormat(prefs::kDeprecatedMetricsOngoingLogs); | |
55 } | |
53 | 56 |
54 MetricsLogManager::~MetricsLogManager() {} | 57 MetricsLogManager::~MetricsLogManager() {} |
55 | 58 |
56 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { | 59 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { |
57 DCHECK(!current_log_); | 60 DCHECK(!current_log_); |
58 current_log_ = std::move(log); | 61 current_log_ = std::move(log); |
59 } | 62 } |
60 | 63 |
61 void MetricsLogManager::FinishCurrentLog() { | 64 void MetricsLogManager::FinishCurrentLog() { |
62 DCHECK(current_log_.get()); | 65 DCHECK(current_log_.get()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 ongoing_log_queue_.SerializeLogs(); | 124 ongoing_log_queue_.SerializeLogs(); |
122 } | 125 } |
123 | 126 |
124 void MetricsLogManager::LoadPersistedUnsentLogs() { | 127 void MetricsLogManager::LoadPersistedUnsentLogs() { |
125 initial_log_queue_.DeserializeLogs(); | 128 initial_log_queue_.DeserializeLogs(); |
126 ongoing_log_queue_.DeserializeLogs(); | 129 ongoing_log_queue_.DeserializeLogs(); |
127 unsent_logs_loaded_ = true; | 130 unsent_logs_loaded_ = true; |
128 } | 131 } |
129 | 132 |
130 } // namespace metrics | 133 } // namespace metrics |
OLD | NEW |