Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: components/metrics/persisted_logs.h

Issue 2567263003: Basic UkmService implementation (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PERSISTED_LOGS_H_ 5 #ifndef COMPONENTS_METRICS_PERSISTED_LOGS_H_
6 #define COMPONENTS_METRICS_PERSISTED_LOGS_H_ 6 #define COMPONENTS_METRICS_PERSISTED_LOGS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Adds a log to the list. 69 // Adds a log to the list.
70 void StoreLog(const std::string& log_data); 70 void StoreLog(const std::string& log_data);
71 71
72 // Stages the most recent log. The staged_log will remain the same even if 72 // Stages the most recent log. The staged_log will remain the same even if
73 // additional logs are added. 73 // additional logs are added.
74 void StageLog(); 74 void StageLog();
75 75
76 // Remove the staged log. 76 // Remove the staged log.
77 void DiscardStagedLog(); 77 void DiscardStagedLog();
78 78
79 // Delete all logs, in memory and on disk.
80 void Purge();
81
79 // True if a log has been staged. 82 // True if a log has been staged.
80 bool has_staged_log() const { return staged_log_index_ != -1; } 83 bool has_staged_log() const { return staged_log_index_ != -1; }
81 84
82 // Returns the element in the front of the list. 85 // Returns the element in the front of the list.
83 const std::string& staged_log() const { 86 const std::string& staged_log() const {
84 DCHECK(has_staged_log()); 87 DCHECK(has_staged_log());
85 return list_[staged_log_index_].compressed_log_data; 88 return list_[staged_log_index_].compressed_log_data;
86 } 89 }
87 90
88 // Returns the element in the front of the list. 91 // Returns the element in the front of the list.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // The index and type of the log staged for upload. If nothing has been 157 // The index and type of the log staged for upload. If nothing has been
155 // staged, the index will be -1. 158 // staged, the index will be -1.
156 int staged_log_index_; 159 int staged_log_index_;
157 160
158 DISALLOW_COPY_AND_ASSIGN(PersistedLogs); 161 DISALLOW_COPY_AND_ASSIGN(PersistedLogs);
159 }; 162 };
160 163
161 } // namespace metrics 164 } // namespace metrics
162 165
163 #endif // COMPONENTS_METRICS_PERSISTED_LOGS_H_ 166 #endif // COMPONENTS_METRICS_PERSISTED_LOGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698