OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/sync_scheduler.h" | 5 #include "chrome/browser/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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) { | 836 void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) { |
837 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 837 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
838 DCHECK(!old_job.session->HasMoreToSync()); | 838 DCHECK(!old_job.session->HasMoreToSync()); |
839 // Note: |num_server_changes_remaining| > 0 here implies that we received a | 839 // Note: |num_server_changes_remaining| > 0 here implies that we received a |
840 // broken response while trying to download all updates, because the Syncer | 840 // broken response while trying to download all updates, because the Syncer |
841 // will loop until this value is exhausted. Also, if unsynced_handles exist | 841 // will loop until this value is exhausted. Also, if unsynced_handles exist |
842 // but HasMoreToSync is false, this implies that the Syncer determined no | 842 // but HasMoreToSync is false, this implies that the Syncer determined no |
843 // forward progress was possible at this time (an error, such as an HTTP | 843 // forward progress was possible at this time (an error, such as an HTTP |
844 // 500, is likely to have occurred during commit). | 844 // 500, is likely to have occurred during commit). |
845 int num_server_changes_remaining = | 845 int num_server_changes_remaining = |
846 old_job.session->status_controller()->num_server_changes_remaining(); | 846 old_job.session->status_controller().num_server_changes_remaining(); |
847 size_t num_unsynced_handles = | 847 size_t num_unsynced_handles = |
848 old_job.session->status_controller()->unsynced_handles().size(); | 848 old_job.session->status_controller().unsynced_handles().size(); |
849 const bool work_to_do = | 849 const bool work_to_do = |
850 num_server_changes_remaining > 0 || num_unsynced_handles > 0; | 850 num_server_changes_remaining > 0 || num_unsynced_handles > 0; |
851 SVLOG(2) << "num server changes remaining: " << num_server_changes_remaining | 851 SVLOG(2) << "num server changes remaining: " << num_server_changes_remaining |
852 << ", num unsynced handles: " << num_unsynced_handles | 852 << ", num unsynced handles: " << num_unsynced_handles |
853 << ", syncer has work to do: " << work_to_do; | 853 << ", syncer has work to do: " << work_to_do; |
854 | 854 |
855 AdjustPolling(&old_job); | 855 AdjustPolling(&old_job); |
856 | 856 |
857 // TODO(tim): Old impl had special code if notifications disabled. Needed? | 857 // TODO(tim): Old impl had special code if notifications disabled. Needed? |
858 if (!work_to_do) { | 858 if (!work_to_do) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1187 |
1188 #undef SVLOG_LOC | 1188 #undef SVLOG_LOC |
1189 | 1189 |
1190 #undef SVLOG | 1190 #undef SVLOG |
1191 | 1191 |
1192 #undef SLOG | 1192 #undef SLOG |
1193 | 1193 |
1194 #undef ENUM_CASE | 1194 #undef ENUM_CASE |
1195 | 1195 |
1196 } // browser_sync | 1196 } // browser_sync |
OLD | NEW |