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

Unified Diff: sync/sessions/data_type_tracker.cc

Issue 387983004: sync: Support non-blocking initial sync in proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix comment Created 6 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
Index: sync/sessions/data_type_tracker.cc
diff --git a/sync/sessions/data_type_tracker.cc b/sync/sessions/data_type_tracker.cc
index ed7f07f45a1467eef9a82827d4a0e58456d422f2..12b53e9d03fd4b56d79577db35e2c15b7989e40b 100644
--- a/sync/sessions/data_type_tracker.cc
+++ b/sync/sessions/data_type_tracker.cc
@@ -14,7 +14,8 @@ namespace sessions {
DataTypeTracker::DataTypeTracker()
: local_nudge_count_(0),
local_refresh_request_count_(0),
- payload_buffer_size_(NudgeTracker::kDefaultMaxPayloadsPerType) {
+ payload_buffer_size_(NudgeTracker::kDefaultMaxPayloadsPerType),
+ initial_sync_required_(false) {
}
DataTypeTracker::~DataTypeTracker() { }
@@ -86,6 +87,10 @@ void DataTypeTracker::RecordRemoteInvalidation(
}
}
+void DataTypeTracker::RecordInitialSyncRequired() {
+ initial_sync_required_ = 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.
@@ -111,6 +116,8 @@ void DataTypeTracker::RecordSuccessfulSyncCycle() {
last_dropped_invalidation_->Acknowledge();
last_dropped_invalidation_.reset();
}
+
+ initial_sync_required_ = false;
}
// This limit will take effect on all future invalidations received.
@@ -124,7 +131,8 @@ bool DataTypeTracker::IsSyncRequired() const {
bool DataTypeTracker::IsGetUpdatesRequired() const {
return !IsThrottled() &&
- (HasRefreshRequestPending() || HasPendingInvalidation());
+ (HasRefreshRequestPending() || HasPendingInvalidation() ||
+ IsInitialSyncRequired());
}
bool DataTypeTracker::HasLocalChangePending() const {
@@ -139,6 +147,10 @@ bool DataTypeTracker::HasPendingInvalidation() const {
return !pending_invalidations_.empty() || last_dropped_invalidation_;
}
+bool DataTypeTracker::IsInitialSyncRequired() const {
+ return initial_sync_required_;
+}
+
void DataTypeTracker::SetLegacyNotificationHint(
sync_pb::DataTypeProgressMarker* progress) const {
DCHECK(!IsThrottled())
@@ -178,6 +190,7 @@ void DataTypeTracker::FillGetUpdatesTriggersMessage(
msg->set_client_dropped_hints(last_dropped_invalidation_);
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_);
}
bool DataTypeTracker::IsThrottled() const {

Powered by Google App Engine
This is Rietveld 408576698