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 24 matching lines...) Expand all Loading... |
35 // is a long series of very small logs. | 35 // is a long series of very small logs. |
36 const size_t kStorageByteLimitPerLogType = 300000; | 36 const size_t kStorageByteLimitPerLogType = 300000; |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 MetricsLogManager::MetricsLogManager(PrefService* local_state, | 40 MetricsLogManager::MetricsLogManager(PrefService* local_state, |
41 size_t max_ongoing_log_size) | 41 size_t max_ongoing_log_size) |
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 prefs::kDeprecatedMetricsInitialLogs, |
45 kInitialLogsPersistLimit, | 46 kInitialLogsPersistLimit, |
46 kStorageByteLimitPerLogType, | 47 kStorageByteLimitPerLogType, |
47 0), | 48 0), |
48 ongoing_log_queue_(local_state, | 49 ongoing_log_queue_(local_state, |
49 prefs::kMetricsOngoingLogs, | 50 prefs::kMetricsOngoingLogs, |
| 51 prefs::kDeprecatedMetricsOngoingLogs, |
50 kOngoingLogsPersistLimit, | 52 kOngoingLogsPersistLimit, |
51 kStorageByteLimitPerLogType, | 53 kStorageByteLimitPerLogType, |
52 max_ongoing_log_size) {} | 54 max_ongoing_log_size) {} |
53 | 55 |
54 MetricsLogManager::~MetricsLogManager() {} | 56 MetricsLogManager::~MetricsLogManager() {} |
55 | 57 |
56 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { | 58 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { |
57 DCHECK(!current_log_); | 59 DCHECK(!current_log_); |
58 current_log_ = std::move(log); | 60 current_log_ = std::move(log); |
59 } | 61 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ongoing_log_queue_.SerializeLogs(); | 123 ongoing_log_queue_.SerializeLogs(); |
122 } | 124 } |
123 | 125 |
124 void MetricsLogManager::LoadPersistedUnsentLogs() { | 126 void MetricsLogManager::LoadPersistedUnsentLogs() { |
125 initial_log_queue_.DeserializeLogs(); | 127 initial_log_queue_.DeserializeLogs(); |
126 ongoing_log_queue_.DeserializeLogs(); | 128 ongoing_log_queue_.DeserializeLogs(); |
127 unsent_logs_loaded_ = true; | 129 unsent_logs_loaded_ = true; |
128 } | 130 } |
129 | 131 |
130 } // namespace metrics | 132 } // namespace metrics |
OLD | NEW |