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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 53 |
54 MetricsLogManager::~MetricsLogManager() {} | 54 MetricsLogManager::~MetricsLogManager() {} |
55 | 55 |
56 void MetricsLogManager::BeginLoggingWithLog(scoped_ptr<MetricsLog> log) { | 56 void MetricsLogManager::BeginLoggingWithLog(std::unique_ptr<MetricsLog> log) { |
57 DCHECK(!current_log_); | 57 DCHECK(!current_log_); |
58 current_log_ = std::move(log); | 58 current_log_ = std::move(log); |
59 } | 59 } |
60 | 60 |
61 void MetricsLogManager::FinishCurrentLog() { | 61 void MetricsLogManager::FinishCurrentLog() { |
62 DCHECK(current_log_.get()); | 62 DCHECK(current_log_.get()); |
63 current_log_->CloseLog(); | 63 current_log_->CloseLog(); |
64 std::string log_data; | 64 std::string log_data; |
65 current_log_->GetEncodedLog(&log_data); | 65 current_log_->GetEncodedLog(&log_data); |
66 if (!log_data.empty()) | 66 if (!log_data.empty()) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ongoing_log_queue_.SerializeLogs(); | 121 ongoing_log_queue_.SerializeLogs(); |
122 } | 122 } |
123 | 123 |
124 void MetricsLogManager::LoadPersistedUnsentLogs() { | 124 void MetricsLogManager::LoadPersistedUnsentLogs() { |
125 initial_log_queue_.DeserializeLogs(); | 125 initial_log_queue_.DeserializeLogs(); |
126 ongoing_log_queue_.DeserializeLogs(); | 126 ongoing_log_queue_.DeserializeLogs(); |
127 unsent_logs_loaded_ = true; | 127 unsent_logs_loaded_ = true; |
128 } | 128 } |
129 | 129 |
130 } // namespace metrics | 130 } // namespace metrics |
OLD | NEW |