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

Unified Diff: chrome/common/metrics/metrics_log_manager.cc

Issue 10546044: [Metrics] Re-try failed protocol buffer uploads as well as failed XML uploads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Why do today what you can put off 'til tomorrow? Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/metrics/metrics_log_manager.cc
diff --git a/chrome/common/metrics/metrics_log_manager.cc b/chrome/common/metrics/metrics_log_manager.cc
index e78ce89e152419e09669e77c104c7ab8b9f9ad03..af1be0c7be6c777cc18b7d318acc18bcfcf92eea 100644
--- a/chrome/common/metrics/metrics_log_manager.cc
+++ b/chrome/common/metrics/metrics_log_manager.cc
@@ -87,21 +87,35 @@ void MetricsLogManager::StageNextLogForUpload() {
}
bool MetricsLogManager::has_staged_log() const {
- return !staged_log_text().empty();
+ return has_staged_log_proto() || has_staged_log_xml();
}
bool MetricsLogManager::has_staged_log_proto() const {
- return has_staged_log() && staged_log_text().proto != kDiscardedLog;
+ return
+ !staged_log_text().proto.empty() &&
+ staged_log_text().proto != kDiscardedLog;
}
-void MetricsLogManager::DiscardStagedLog() {
- staged_log_text_.xml.clear();
- staged_log_text_.proto.clear();
- staged_log_type_ = NO_LOG;
+bool MetricsLogManager::has_staged_log_xml() const {
+ return
+ !staged_log_text().xml.empty() &&
jar (doing other things) 2012/06/11 21:19:35 nit: don't bother to wrap line 100 this way, as it
Ilya Sherman 2012/06/11 22:22:25 Done.
+ staged_log_text().xml != kDiscardedLog;
}
void MetricsLogManager::DiscardStagedLogProto() {
staged_log_text_.proto = kDiscardedLog;
+
+ // If we're discarding the last piece of the log, reset the staged log state.
+ if (!has_staged_log())
+ DiscardStagedLog();
+}
+
+void MetricsLogManager::DiscardStagedLogXml() {
+ staged_log_text_.xml = kDiscardedLog;
+
+ // If we're discarding the last piece of the log, reset the staged log state.
+ if (!has_staged_log())
+ DiscardStagedLog();
}
void MetricsLogManager::DiscardCurrentLog() {
@@ -220,6 +234,12 @@ void MetricsLogManager::CompressCurrentLog(SerializedLog* compressed_log) {
}
}
+void MetricsLogManager::DiscardStagedLog() {
+ staged_log_text_.xml.clear();
+ staged_log_text_.proto.clear();
+ staged_log_type_ = NO_LOG;
+}
+
// static
// This implementation is based on the Firefox MetricsService implementation.
bool MetricsLogManager::Bzip2Compress(const std::string& input,

Powered by Google App Engine
This is Rietveld 408576698