summaryrefslogtreecommitdiffstats
path: root/sync/sessions/data_type_tracker.cc
diff options
context:
space:
mode:
authorgangwu <gangwu@chromium.org>2015-02-11 12:44:08 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-11 20:44:45 +0000
commitf951166bde5650de692d30c542e320a1e6c0e75a (patch)
treee6f66df7bb1efb9976d5da8e2d8ceeac94e8115a /sync/sessions/data_type_tracker.cc
parentfddf37153bd228737419f53791489987938778a0 (diff)
downloadchromium_src-f951166bde5650de692d30c542e320a1e6c0e75a.zip
chromium_src-f951166bde5650de692d30c542e320a1e6c0e75a.tar.gz
chromium_src-f951166bde5650de692d30c542e320a1e6c0e75a.tar.bz2
Sync commit errors should temporarily re-enable
trigger pre-commit getupdates Add a boolean variable in class DataTypeTracker, so every time when a data type got conflict response from server during commit, will set that boolean variable to true, then next time sync, GetUpdate will check the boolean to see if need to GetUpdate to resolve conflict locally. BUG=324893 Committed: https://crrev.com/21f43c5af27e24c34565df26bb51fcc704c97597 Cr-Commit-Position: refs/heads/master@{#315339} Review URL: https://codereview.chromium.org/905853002 Cr-Commit-Position: refs/heads/master@{#315828}
Diffstat (limited to 'sync/sessions/data_type_tracker.cc')
-rw-r--r--sync/sessions/data_type_tracker.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/sync/sessions/data_type_tracker.cc b/sync/sessions/data_type_tracker.cc
index da50bbf..8103c00 100644
--- a/sync/sessions/data_type_tracker.cc
+++ b/sync/sessions/data_type_tracker.cc
@@ -15,7 +15,8 @@ DataTypeTracker::DataTypeTracker()
: local_nudge_count_(0),
local_refresh_request_count_(0),
payload_buffer_size_(NudgeTracker::kDefaultMaxPayloadsPerType),
- initial_sync_required_(false) {
+ initial_sync_required_(false),
+ sync_required_to_resolve_conflict_(false) {
}
DataTypeTracker::~DataTypeTracker() { }
@@ -92,6 +93,10 @@ void DataTypeTracker::RecordInitialSyncRequired() {
initial_sync_required_ = true;
}
+void DataTypeTracker::RecordCommitConflict() {
+ sync_required_to_resolve_conflict_ = true;
+}
+
void DataTypeTracker::RecordSuccessfulSyncCycle() {
// If we were throttled, then we would have been excluded from this cycle's
// GetUpdates and Commit actions. Our state remains unchanged.
@@ -119,6 +124,7 @@ void DataTypeTracker::RecordSuccessfulSyncCycle() {
}
initial_sync_required_ = false;
+ sync_required_to_resolve_conflict_ = false;
}
// This limit will take effect on all future invalidations received.
@@ -133,7 +139,7 @@ bool DataTypeTracker::IsSyncRequired() const {
bool DataTypeTracker::IsGetUpdatesRequired() const {
return !IsThrottled() &&
(HasRefreshRequestPending() || HasPendingInvalidation() ||
- IsInitialSyncRequired());
+ IsInitialSyncRequired() || IsSyncRequiredToResolveConflict());
}
bool DataTypeTracker::HasLocalChangePending() const {
@@ -152,6 +158,10 @@ bool DataTypeTracker::IsInitialSyncRequired() const {
return initial_sync_required_;
}
+bool DataTypeTracker::IsSyncRequiredToResolveConflict() const {
+ return sync_required_to_resolve_conflict_;
+}
+
void DataTypeTracker::SetLegacyNotificationHint(
sync_pb::DataTypeProgressMarker* progress) const {
DCHECK(!IsThrottled())
@@ -192,6 +202,8 @@ void DataTypeTracker::FillGetUpdatesTriggersMessage(
msg->set_local_modification_nudges(local_nudge_count_);
msg->set_datatype_refresh_nudges(local_refresh_request_count_);
msg->set_initial_sync_in_progress(initial_sync_required_);
+ msg->set_sync_for_resolve_conflict_in_progress(
+ sync_required_to_resolve_conflict_);
}
bool DataTypeTracker::IsThrottled() const {