| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/engine/sync_scheduler.h" | 5 #include "sync/engine/sync_scheduler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 ScheduleNextSync(job); | 874 ScheduleNextSync(job); |
| 875 } | 875 } |
| 876 | 876 |
| 877 void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) { | 877 void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) { |
| 878 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 878 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 879 DCHECK(!old_job.session->HasMoreToSync()); | 879 DCHECK(!old_job.session->HasMoreToSync()); |
| 880 | 880 |
| 881 AdjustPolling(&old_job); | 881 AdjustPolling(&old_job); |
| 882 | 882 |
| 883 if (old_job.session->Succeeded()) { | 883 if (old_job.session->Succeeded()) { |
| 884 // Success implies backoff relief. Note that if this was a | 884 // Only reset backoff if we actually reached the server. |
| 885 // "one-off" job (i.e. purpose == | 885 if (old_job.session->SuccessfullyReachedServer()) |
| 886 // SyncSessionJob::{CLEAR_USER_DATA,CLEANUP_DISABLED_TYPES}), if | 886 wait_interval_.reset(); |
| 887 // there was work to do before it ran this wont have changed, as | |
| 888 // jobs like this don't run a full sync cycle. So we don't need | |
| 889 // special code here. | |
| 890 wait_interval_.reset(); | |
| 891 SDVLOG(2) << "Job succeeded so not scheduling more jobs"; | 887 SDVLOG(2) << "Job succeeded so not scheduling more jobs"; |
| 892 return; | 888 return; |
| 893 } | 889 } |
| 894 | 890 |
| 895 if (old_job.purpose == SyncSessionJob::POLL) { | 891 if (old_job.purpose == SyncSessionJob::POLL) { |
| 896 return; // We don't retry POLL jobs. | 892 return; // We don't retry POLL jobs. |
| 897 } | 893 } |
| 898 | 894 |
| 899 // TODO(rlarocque): There's no reason why we should blindly backoff and retry | 895 // TODO(rlarocque): There's no reason why we should blindly backoff and retry |
| 900 // if we don't succeed. Some types of errors are not likely to disappear on | 896 // if we don't succeed. Some types of errors are not likely to disappear on |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 | 1191 |
| 1196 #undef SDVLOG_LOC | 1192 #undef SDVLOG_LOC |
| 1197 | 1193 |
| 1198 #undef SDVLOG | 1194 #undef SDVLOG |
| 1199 | 1195 |
| 1200 #undef SLOG | 1196 #undef SLOG |
| 1201 | 1197 |
| 1202 #undef ENUM_CASE | 1198 #undef ENUM_CASE |
| 1203 | 1199 |
| 1204 } // browser_sync | 1200 } // browser_sync |
| OLD | NEW |