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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 10692059: Make metrics state machine more lenient about OLD vs. CURRENT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing return Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/common/metrics/metrics_log_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 42f2c02924f4ddd7f0c6f540980cf41ef871adf7..7e42ff86ddebe33188a5dae6ebdb1616f3b2a51e 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -755,8 +755,6 @@ void MetricsService::OnAppEnterBackground() {
// to continue logging and uploading if the process does return.
if (recording_active() && state_ >= INITIAL_LOG_READY) {
PushPendingLogsToPersistentStorage();
- if (state_ == SENDING_CURRENT_LOGS)
- state_ = SENDING_OLD_LOGS;
// Persisting logs stops recording, so start recording a new log immediately
// to capture any background work that might be done before the process is
// killed.
@@ -1153,6 +1151,17 @@ void MetricsService::StartScheduledUpload() {
return;
}
+ // If the callback was to upload an old log, but there no longer is one,
+ // just report success back to the scheduler to begin the ongoing log
+ // callbacks.
+ // TODO(stuartmorgan): Consider removing the distinction between
+ // SENDING_OLD_LOGS and SENDING_CURRENT_LOGS to simplify the state machine
+ // now that the log upload flow is the same for both modes.
+ if (state_ == SENDING_OLD_LOGS && !log_manager_.has_unsent_logs()) {
+ state_ = SENDING_CURRENT_LOGS;
+ scheduler_->UploadFinished(true /* healthy */, false /* no unsent logs */);
+ return;
+ }
// If there are unsent logs, send the next one. If not, start the asynchronous
// process of finalizing the current log for upload.
if (state_ == SENDING_OLD_LOGS) {
« no previous file with comments | « no previous file | chrome/common/metrics/metrics_log_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698