Index: sync/sessions/nudge_tracker.h |
diff --git a/sync/sessions/nudge_tracker.h b/sync/sessions/nudge_tracker.h |
index fcd015034101312d6e71822ee7a772bbbb0af278..35de311a33a82ec7d8a9e0695dbcd9506decadfe 100644 |
--- a/sync/sessions/nudge_tracker.h |
+++ b/sync/sessions/nudge_tracker.h |
@@ -11,6 +11,7 @@ |
#include <map> |
#include "base/compiler_specific.h" |
+#include "base/time/clock.h" |
#include "sync/base/sync_export.h" |
#include "sync/internal_api/public/base/model_type.h" |
#include "sync/protocol/sync.pb.h" |
@@ -26,7 +27,8 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
public: |
static size_t kDefaultMaxPayloadsPerType; |
- NudgeTracker(); |
+ // Takes the ownership of |clock|. |
+ explicit NudgeTracker(base::Clock* clock); |
~NudgeTracker(); |
// Returns true if there is a good reason for performing a sync cycle. |
@@ -38,6 +40,9 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
// request as part of the next sync cycle. |
bool IsGetUpdatesRequired() const; |
+ // Return true if should perform a sync cycle for GU retry. |
+ bool IsRetryRequired() const; |
+ |
// Tells this class that all required update fetching and committing has |
// completed successfully. |
void RecordSuccessfulSyncCycle(); |
@@ -105,9 +110,15 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
// Adjusts the number of hints that can be stored locally. |
void SetHintBufferSize(size_t size); |
+ void set_next_retry_time(base::Time next_retry_time) { |
+ next_retry_time_ = next_retry_time; |
+ } |
+ |
private: |
typedef std::map<ModelType, DataTypeTracker> TypeTrackerMap; |
+ scoped_ptr<base::Clock> clock_; |
+ |
TypeTrackerMap type_trackers_; |
// Merged updates source. This should be obsolete, but the server still |
@@ -130,6 +141,11 @@ class SYNC_EXPORT_PRIVATE NudgeTracker { |
size_t num_payloads_per_type_; |
+ base::Time last_successful_sync_time_; |
+ |
+ // A retry GU should be issued after this time. |
+ base::Time next_retry_time_; |
+ |
DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
}; |