| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ | 5 #ifndef CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ |
| 6 #define CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ | 6 #define CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // |max_ongoing_log_store_size_|). | 168 // |max_ongoing_log_store_size_|). |
| 169 // NOTE: This clears the contents of |log_text| (to avoid an expensive | 169 // NOTE: This clears the contents of |log_text| (to avoid an expensive |
| 170 // string copy), so the log should be discarded after this call. | 170 // string copy), so the log should be discarded after this call. |
| 171 void StoreLog(SerializedLog* log_text, | 171 void StoreLog(SerializedLog* log_text, |
| 172 LogType log_type, | 172 LogType log_type, |
| 173 StoreType store_type); | 173 StoreType store_type); |
| 174 | 174 |
| 175 // Compresses current_log_ into compressed_log. | 175 // Compresses current_log_ into compressed_log. |
| 176 void CompressCurrentLog(SerializedLog* compressed_log); | 176 void CompressCurrentLog(SerializedLog* compressed_log); |
| 177 | 177 |
| 178 // Compresses the text in |input| using bzip2, store the result in |output|. | |
| 179 static bool Bzip2Compress(const std::string& input, std::string* output); | |
| 180 | |
| 181 // The log that we are still appending to. | 178 // The log that we are still appending to. |
| 182 scoped_ptr<MetricsLogBase> current_log_; | 179 scoped_ptr<MetricsLogBase> current_log_; |
| 183 LogType current_log_type_; | 180 LogType current_log_type_; |
| 184 | 181 |
| 185 // A paused, previously-current log. | 182 // A paused, previously-current log. |
| 186 scoped_ptr<MetricsLogBase> paused_log_; | 183 scoped_ptr<MetricsLogBase> paused_log_; |
| 187 LogType paused_log_type_; | 184 LogType paused_log_type_; |
| 188 | 185 |
| 189 // Helper class to handle serialization/deserialization of logs for persistent | 186 // Helper class to handle serialization/deserialization of logs for persistent |
| 190 // storage. May be NULL. | 187 // storage. May be NULL. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 212 // This is necessary because during an upload there are two logs (staged | 209 // This is necessary because during an upload there are two logs (staged |
| 213 // and current) and a client might store them in either order, so it's | 210 // and current) and a client might store them in either order, so it's |
| 214 // not necessarily the case that the provisional store is the last store. | 211 // not necessarily the case that the provisional store is the last store. |
| 215 int last_provisional_store_index_; | 212 int last_provisional_store_index_; |
| 216 LogType last_provisional_store_type_; | 213 LogType last_provisional_store_type_; |
| 217 | 214 |
| 218 DISALLOW_COPY_AND_ASSIGN(MetricsLogManager); | 215 DISALLOW_COPY_AND_ASSIGN(MetricsLogManager); |
| 219 }; | 216 }; |
| 220 | 217 |
| 221 #endif // CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ | 218 #endif // CHROME_COMMON_METRICS_METRICS_LOG_MANAGER_H_ |
| OLD | NEW |