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/apply_updates_command.h" | 5 #include "sync/engine/apply_updates_command.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "sync/engine/update_applicator.h" | 8 #include "sync/engine/update_applicator.h" |
9 #include "sync/sessions/sync_session.h" | 9 #include "sync/sessions/sync_session.h" |
10 #include "sync/syncable/syncable.h" | 10 #include "sync/syncable/syncable.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 handles.begin(), handles.end(), session->routing_info(), | 65 handles.begin(), handles.end(), session->routing_info(), |
66 session->status_controller().group_restriction()); | 66 session->status_controller().group_restriction()); |
67 while (applicator.AttemptOneApplication(&trans)) {} | 67 while (applicator.AttemptOneApplication(&trans)) {} |
68 applicator.SaveProgressIntoSessionState( | 68 applicator.SaveProgressIntoSessionState( |
69 session->mutable_status_controller()->mutable_conflict_progress(), | 69 session->mutable_status_controller()->mutable_conflict_progress(), |
70 session->mutable_status_controller()->mutable_update_progress()); | 70 session->mutable_status_controller()->mutable_update_progress()); |
71 | 71 |
72 // This might be the first time we've fully completed a sync cycle, for | 72 // This might be the first time we've fully completed a sync cycle, for |
73 // some subset of the currently synced datatypes. | 73 // some subset of the currently synced datatypes. |
74 const sessions::StatusController& status(session->status_controller()); | 74 const sessions::StatusController& status(session->status_controller()); |
75 if (status.ServerSaysNothingMoreToDownload()) { | 75 if (status.error().last_download_updates_result == SYNCER_OK |
| 76 && status.updates_response().get_updates().changes_remaining() == 0) { |
76 for (syncable::ModelTypeSet::Iterator it = | 77 for (syncable::ModelTypeSet::Iterator it = |
77 status.updates_request_types().First(); it.Good(); it.Inc()) { | 78 status.updates_request_types().First(); it.Good(); it.Inc()) { |
78 // This gets persisted to the directory's backing store. | 79 // This gets persisted to the directory's backing store. |
79 dir->set_initial_sync_ended_for_type(it.Get(), true); | 80 dir->set_initial_sync_ended_for_type(it.Get(), true); |
80 } | 81 } |
81 } | 82 } |
82 | 83 |
83 return SYNCER_OK; | 84 return SYNCER_OK; |
84 } | 85 } |
85 | 86 |
86 } // namespace browser_sync | 87 } // namespace browser_sync |
OLD | NEW |