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

Unified Diff: chrome/browser/sync/sessions/sync_session.cc

Issue 9036003: Avoid useless SYNC_CYCLE_CONTINUATION sync cycle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « chrome/browser/sync/sessions/sync_session.h ('k') | chrome/browser/sync/sessions/test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sessions/sync_session.cc
diff --git a/chrome/browser/sync/sessions/sync_session.cc b/chrome/browser/sync/sessions/sync_session.cc
index 064fef6744e9d753fbb4b2e58975646e16ab9190..fe164e468120a702326ee7aa0d06f462e7f71678 100644
--- a/chrome/browser/sync/sessions/sync_session.cc
+++ b/chrome/browser/sync/sessions/sync_session.cc
@@ -233,6 +233,83 @@ std::set<ModelSafeGroup>
return enabled_groups_with_verified_updates;
}
+namespace {
+// Returns true if the result indicates an error that might go away on its own.
+// In other words, it wouldn't be a bad idea to retry with exponential backoff
+// if we detect one of these errors.
+bool IsTransientError(SyncerError error) {
+ switch (error) {
+ // No operation was not attempted.
+ case UNINITIALIZED:
+ return false;
+
+ // Client-side error.
+ case DIRECTORY_LOOKUP_FAILED:
+ return false;
+
+ // Probably temporary network issues.
+ case NETWORK_CONNECTION_UNAVAILABLE:
+ case NETWORK_IO_ERROR:
+ return true;
+
+ // Error cause is ambiguous. It's best not to retry in these cases.
+ case SYNC_SERVER_ERROR:
+ case SERVER_RETURN_UNKNOWN_ERROR:
+ return false;
+
+ // These require user intervention
+ case SYNC_AUTH_ERROR:
+ case SERVER_RETURN_INVALID_CREDENTIAL:
+ return false;
+
+ // We have special logic to handle backoff in this case.
+ case SERVER_RETURN_THROTTLED:
+ return false;
+
+ // The server wants us to retry.
+ case SERVER_RETURN_TRANSIENT_ERROR:
+ return true;
+
+ // Handled separately.
+ case SERVER_RETURN_MIGRATION_DONE:
+ case SERVER_RETURN_CLEAR_PENDING:
+ case SERVER_RETURN_NOT_MY_BIRTHDAY:
+ case SERVER_RESPONSE_VALIDATION_FAILED:
+ return false;
+
+ case NO_ERROR:
+ return false;
+ }
+}
+} // namespace
+
+bool SyncSession::ExperiencedTransientError() const {
+ return IsTransientError(status_controller_->error().download_updates_result)
+ || IsTransientError(status_controller_->error().post_commit_result)
+ || IsTransientError(
+ status_controller_->error().process_commit_response_result);
+}
+
+namespace {
+// Return true if the command in question was attempted and did not complete
+// successfully.
+//
+bool IsError(SyncerError error) {
+ return error != UNINITIALIZED && error != NO_ERROR;
+}
+} // namespace
+
+bool SyncSession::Succeeded() const {
+ bool download_updates_error =
+ IsError(status_controller_->error().download_updates_result);
+ bool post_commit_error =
+ IsError(status_controller_->error().post_commit_result);
+ bool process_commit_response_error =
+ IsError(status_controller_->error().process_commit_response_result);
+ return !download_updates_error
+ && !post_commit_error
+ && !process_commit_response_error;
+}
} // namespace sessions
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/sessions/sync_session.h ('k') | chrome/browser/sync/sessions/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698