Chromium Code Reviews| Index: chrome/browser/sync/engine/sync_scheduler.cc |
| diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc |
| index 990aecec7a09f6acc11068da4e038e22d9b8403e..88573a4d2784b47511dca399de938b66a9714bb5 100644 |
| --- a/chrome/browser/sync/engine/sync_scheduler.cc |
| +++ b/chrome/browser/sync/engine/sync_scheduler.cc |
| @@ -241,14 +241,17 @@ void SyncScheduler::StartImpl(Mode mode, ModeChangeCallback* callback) { |
| DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| DCHECK(!session_context_->account_name().empty()); |
| DCHECK(syncer_.get()); |
| + Mode old_mode = mode_; |
| mode_ = mode; |
| AdjustPolling(NULL); // Will kick start poll timer if needed. |
| if (scoped_callback.get()) |
| scoped_callback->Run(); |
| - // We just changed our mode. See if there are any pending jobs that we could |
| - // execute in the new mode. |
| - DoPendingJobIfPossible(false); |
| + if (old_mode != mode_) { |
| + // We just changed our mode. See if there are any pending jobs that we could |
| + // execute in the new mode. |
| + DoPendingJobIfPossible(false); |
| + } |
| } |
| SyncScheduler::JobProcessDecision SyncScheduler::DecideWhileInWaitInterval( |
| @@ -278,9 +281,11 @@ SyncScheduler::JobProcessDecision SyncScheduler::DecideWhileInWaitInterval( |
| // If we already had one nudge then just drop this nudge. We will retry |
| // later when the timer runs out. |
| - return wait_interval_->had_nudge ? DROP : CONTINUE; |
| + if (!job.is_canary_job) |
| + return wait_interval_->had_nudge ? DROP : CONTINUE; |
| + else // We are here because timer ran out. So retry. |
| + return CONTINUE; |
|
tim (not reviewing)
2011/08/04 00:24:40
so we always continue with canary_jobs? don't we
lipalani1
2011/08/04 01:14:33
We call that when network connection changes. We s
|
| } |
| - // This is a config job. |
| return job.is_canary_job ? CONTINUE : SAVE; |
| } |
| @@ -805,19 +810,22 @@ void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) { |
| return; |
| } |
| - if (old_job.session->source().updates_source == |
| - GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION) { |
| - SVLOG(2) << "Job failed with source continuation"; |
| - // We don't seem to have made forward progress. Start or extend backoff. |
| - HandleConsecutiveContinuationError(old_job); |
| - } else if (IsBackingOff()) { |
| + if (IsBackingOff() && wait_interval_->timer.IsRunning() && |
|
tim (not reviewing)
2011/08/04 00:24:40
comment
lipalani1
2011/08/04 01:14:33
Done.
|
| + mode_ == NORMAL_MODE) { |
| SVLOG(2) << "A nudge during backoff failed"; |
| // We weren't continuing but we're in backoff; must have been a nudge. |
| DCHECK_EQ(SyncSessionJob::NUDGE, old_job.purpose); |
| DCHECK(!wait_interval_->had_nudge); |
| wait_interval_->had_nudge = true; |
| + // Old job did not finish. So make it the pending job. |
| + InitOrCoalescePendingJob(old_job); |
| // Resume waiting. |
| RestartWaiting(); |
| + } else if (old_job.session->source().updates_source == |
| + GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION) { |
| + SVLOG(2) << "Job failed with source continuation"; |
| + // We don't seem to have made forward progress. Start or extend backoff. |
| + HandleConsecutiveContinuationError(old_job); |
| } else { |
| SVLOG(2) << "Failed. Schedule a job with continuation as source"; |
| // We weren't continuing and we aren't in backoff. Schedule a normal |