Index: sync/sessions/nudge_tracker.h |
diff --git a/sync/sessions/nudge_tracker.h b/sync/sessions/nudge_tracker.h |
index 1663f0ccad82b4d60af4626bb18a289a90c64bc7..276e8fa8f479c6f6bcc8968bb7f902ee4c58c8b2 100644 |
--- a/sync/sessions/nudge_tracker.h |
+++ b/sync/sessions/nudge_tracker.h |
@@ -36,14 +36,17 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
// Returns true if there is a good reason for performing a get updates |
// request as part of the next sync cycle. |
- bool IsGetUpdatesRequired(base::TimeTicks now) const; |
+ bool IsGetUpdatesRequired() const; |
// Return true if should perform a sync cycle for GU retry. |
- bool IsRetryRequired(base::TimeTicks now) const; |
+ // |
+ // This is sensitive to changes in 'current time'. Make sure you're aware of |
+ // any nearby calls to ToggleRetryFlagIfRequired(). |
+ bool IsRetryRequired() const; |
// Tells this class that all required update fetching or committing has |
// completed successfully. |
- void RecordSuccessfulSyncCycle(base::TimeTicks now); |
+ void RecordSuccessfulSyncCycle(); |
// Takes note of a local change. |
void RecordLocalChange(ModelTypeSet types); |
@@ -105,12 +108,18 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
ModelType type, |
sync_pb::DataTypeProgressMarker* progress) const; |
+ // Flips the flag if we're due for a retry. |
+ void ToggleRetryFlagIfRequired(base::TimeTicks now); |
+ |
// Adjusts the number of hints that can be stored locally. |
void SetHintBufferSize(size_t size); |
- void set_next_retry_time(base::TimeTicks next_retry_time) { |
- next_retry_time_ = next_retry_time; |
- } |
+ // Schedules a retry GetUpdate request for some time in the future. |
+ // |
+ // The effects of this change are not guaranteed to take effect until |
+ // ToggleRetryFlagIfRequired() is called. That function should be called |
+ // rarely (ie. only before a sync cycle, never during). |
+ void SetNextRetryTime(base::TimeTicks next_retry_time); |
private: |
typedef std::map<ModelType, DataTypeTracker> TypeTrackerMap; |
@@ -139,9 +148,13 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
base::TimeTicks last_successful_sync_time_; |
- // A retry GU should be issued after this time. |
+ // Time when the next retry is scheduled to execute. Will be null if no |
+ // retry is currently pending, or the is_retry_required flag is set. |
base::TimeTicks next_retry_time_; |
+ // Set to true when the nudge tracker believes we're due for a GU retry. |
+ bool is_retry_required_; |
+ |
DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
}; |