| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_store.h" | 5 #include "components/metrics/metrics_log_store.h" |
| 6 | 6 |
| 7 #include "components/metrics/metrics_pref_names.h" | 7 #include "components/metrics/metrics_pref_names.h" |
| 8 #include "components/metrics/persisted_logs_metrics_impl.h" | 8 #include "components/metrics/persisted_logs_metrics_impl.h" |
| 9 #include "components/prefs/pref_registry_simple.h" | 9 #include "components/prefs/pref_registry_simple.h" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 unsent_logs_loaded_ = true; | 66 unsent_logs_loaded_ = true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void MetricsLogStore::StoreLog(const std::string& log_data, | 69 void MetricsLogStore::StoreLog(const std::string& log_data, |
| 70 MetricsLog::LogType log_type) { | 70 MetricsLog::LogType log_type) { |
| 71 switch (log_type) { | 71 switch (log_type) { |
| 72 case MetricsLog::INITIAL_STABILITY_LOG: | 72 case MetricsLog::INITIAL_STABILITY_LOG: |
| 73 initial_log_queue_.StoreLog(log_data); | 73 initial_log_queue_.StoreLog(log_data); |
| 74 break; | 74 break; |
| 75 case MetricsLog::ONGOING_LOG: | 75 case MetricsLog::ONGOING_LOG: |
| 76 case MetricsLog::INDEPENDENT_LOG: |
| 76 ongoing_log_queue_.StoreLog(log_data); | 77 ongoing_log_queue_.StoreLog(log_data); |
| 77 break; | 78 break; |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool MetricsLogStore::has_unsent_logs() const { | 82 bool MetricsLogStore::has_unsent_logs() const { |
| 82 return initial_log_queue_.has_unsent_logs() || | 83 return initial_log_queue_.has_unsent_logs() || |
| 83 ongoing_log_queue_.has_unsent_logs(); | 84 ongoing_log_queue_.has_unsent_logs(); |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void MetricsLogStore::PersistUnsentLogs() const { | 120 void MetricsLogStore::PersistUnsentLogs() const { |
| 120 DCHECK(unsent_logs_loaded_); | 121 DCHECK(unsent_logs_loaded_); |
| 121 if (!unsent_logs_loaded_) | 122 if (!unsent_logs_loaded_) |
| 122 return; | 123 return; |
| 123 | 124 |
| 124 initial_log_queue_.PersistUnsentLogs(); | 125 initial_log_queue_.PersistUnsentLogs(); |
| 125 ongoing_log_queue_.PersistUnsentLogs(); | 126 ongoing_log_queue_.PersistUnsentLogs(); |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace metrics | 129 } // namespace metrics |
| OLD | NEW |