Chromium Code Reviews| Index: sync/sessions/nudge_tracker.cc |
| diff --git a/sync/sessions/nudge_tracker.cc b/sync/sessions/nudge_tracker.cc |
| index d109294a2170c34f52cf7af1d3b683e67758719d..25ee2bc932378dcca28e50d6fb38df4b86b07398 100644 |
| --- a/sync/sessions/nudge_tracker.cc |
| +++ b/sync/sessions/nudge_tracker.cc |
| @@ -15,8 +15,9 @@ namespace sessions { |
| size_t NudgeTracker::kDefaultMaxPayloadsPerType = 10; |
| -NudgeTracker::NudgeTracker() |
| - : updates_source_(sync_pb::GetUpdatesCallerInfo::UNKNOWN), |
| +NudgeTracker::NudgeTracker(base::Clock* clock) |
| + : clock_(clock), |
| + updates_source_(sync_pb::GetUpdatesCallerInfo::UNKNOWN), |
| invalidations_enabled_(false), |
| invalidations_out_of_sync_(true) { |
| ModelTypeSet protocol_types = ProtocolTypes(); |
| @@ -56,8 +57,16 @@ bool NudgeTracker::IsGetUpdatesRequired() const { |
| return false; |
| } |
| +bool NudgeTracker::IsRetryRequired() const { |
| + return !next_retry_time_.is_null() && next_retry_time_ < clock_->Now(); |
|
rlarocque
2014/01/06 23:00:33
I'd strongly prefer to have the base::Time value p
haitaol1
2014/01/07 19:03:37
I feel the other way. Using a clock member has the
rlarocque
2014/01/07 19:43:41
It's not quite the same, though.
One trick we can
|
| +} |
| + |
| void NudgeTracker::RecordSuccessfulSyncCycle() { |
| updates_source_ = sync_pb::GetUpdatesCallerInfo::UNKNOWN; |
| + last_successful_sync_time_ = clock_->Now(); |
| + |
| + if (next_retry_time_ < clock_->Now()) |
| + next_retry_time_ = base::Time(); |
| // A successful cycle while invalidations are enabled puts us back into sync. |
| invalidations_out_of_sync_ = !invalidations_enabled_; |