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 #ifndef COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ | 5 #ifndef COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ |
6 #define COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ | 6 #define COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Restores the previously paused log (if any) to current_log(). | 83 // Restores the previously paused log (if any) to current_log(). |
84 // This should only be called if there is not a current log. | 84 // This should only be called if there is not a current log. |
85 void ResumePausedLog(); | 85 void ResumePausedLog(); |
86 | 86 |
87 // Saves any unsent logs to persistent storage. | 87 // Saves any unsent logs to persistent storage. |
88 void PersistUnsentLogs(); | 88 void PersistUnsentLogs(); |
89 | 89 |
90 // Loads any unsent logs from persistent storage. | 90 // Loads any unsent logs from persistent storage. |
91 void LoadPersistedUnsentLogs(); | 91 void LoadPersistedUnsentLogs(); |
92 | 92 |
93 private: | 93 // Saves |log_data| as the given type. Public to allow to push log created by |
94 // Saves |log_data| as the given type. | 94 // external components. |
95 void StoreLog(const std::string& log_data, MetricsLog::LogType log_type); | 95 void StoreLog(const std::string& log_data, MetricsLog::LogType log_type); |
96 | 96 |
| 97 private: |
97 // Tracks whether unsent logs (if any) have been loaded from the serializer. | 98 // Tracks whether unsent logs (if any) have been loaded from the serializer. |
98 bool unsent_logs_loaded_; | 99 bool unsent_logs_loaded_; |
99 | 100 |
100 // The log that we are still appending to. | 101 // The log that we are still appending to. |
101 scoped_ptr<MetricsLog> current_log_; | 102 scoped_ptr<MetricsLog> current_log_; |
102 | 103 |
103 // A paused, previously-current log. | 104 // A paused, previously-current log. |
104 scoped_ptr<MetricsLog> paused_log_; | 105 scoped_ptr<MetricsLog> paused_log_; |
105 | 106 |
106 // Logs that have not yet been sent. | 107 // Logs that have not yet been sent. |
107 PersistedLogs initial_log_queue_; | 108 PersistedLogs initial_log_queue_; |
108 PersistedLogs ongoing_log_queue_; | 109 PersistedLogs ongoing_log_queue_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(MetricsLogManager); | 111 DISALLOW_COPY_AND_ASSIGN(MetricsLogManager); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace metrics | 114 } // namespace metrics |
114 | 115 |
115 #endif // COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ | 116 #endif // COMPONENTS_METRICS_METRICS_LOG_MANAGER_H_ |
OLD | NEW |