| 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/syncer.h" | 5 #include "sync/engine/syncer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "sync/engine/apply_control_data_updates.h" |
| 13 #include "sync/engine/apply_updates_command.h" | 14 #include "sync/engine/apply_updates_command.h" |
| 14 #include "sync/engine/build_commit_command.h" | 15 #include "sync/engine/build_commit_command.h" |
| 15 #include "sync/engine/cleanup_disabled_types_command.h" | 16 #include "sync/engine/cleanup_disabled_types_command.h" |
| 16 #include "sync/engine/commit.h" | 17 #include "sync/engine/commit.h" |
| 17 #include "sync/engine/conflict_resolver.h" | 18 #include "sync/engine/conflict_resolver.h" |
| 18 #include "sync/engine/download_updates_command.h" | 19 #include "sync/engine/download_updates_command.h" |
| 19 #include "sync/engine/net/server_connection_manager.h" | 20 #include "sync/engine/net/server_connection_manager.h" |
| 20 #include "sync/engine/process_commit_response_command.h" | 21 #include "sync/engine/process_commit_response_command.h" |
| 21 #include "sync/engine/process_updates_command.h" | 22 #include "sync/engine/process_updates_command.h" |
| 22 #include "sync/engine/resolve_conflicts_command.h" | 23 #include "sync/engine/resolve_conflicts_command.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 DVLOG(1) << "Aborting sync cycle due to download updates failure"; | 160 DVLOG(1) << "Aborting sync cycle due to download updates failure"; |
| 160 } else if (!session->status_controller() | 161 } else if (!session->status_controller() |
| 161 .ServerSaysNothingMoreToDownload()) { | 162 .ServerSaysNothingMoreToDownload()) { |
| 162 next_step = DOWNLOAD_UPDATES; | 163 next_step = DOWNLOAD_UPDATES; |
| 163 } else { | 164 } else { |
| 164 next_step = APPLY_UPDATES; | 165 next_step = APPLY_UPDATES; |
| 165 } | 166 } |
| 166 break; | 167 break; |
| 167 } | 168 } |
| 168 case APPLY_UPDATES: { | 169 case APPLY_UPDATES: { |
| 170 // These include encryption updates that should be applied early. |
| 171 ApplyControlDataUpdates(session->context()->directory()); |
| 172 |
| 169 ApplyUpdatesCommand apply_updates; | 173 ApplyUpdatesCommand apply_updates; |
| 170 apply_updates.Execute(session); | 174 apply_updates.Execute(session); |
| 171 if (last_step == APPLY_UPDATES) { | 175 if (last_step == APPLY_UPDATES) { |
| 172 // We're in configuration mode, but we still need to run the | 176 // We're in configuration mode, but we still need to run the |
| 173 // SYNCER_END step. | 177 // SYNCER_END step. |
| 174 last_step = SYNCER_END; | 178 last_step = SYNCER_END; |
| 175 next_step = SYNCER_END; | 179 next_step = SYNCER_END; |
| 176 } else { | 180 } else { |
| 177 next_step = COMMIT; | 181 next_step = COMMIT; |
| 178 } | 182 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 entry->Put(SERVER_CTIME, Time()); | 292 entry->Put(SERVER_CTIME, Time()); |
| 289 entry->Put(SERVER_VERSION, 0); | 293 entry->Put(SERVER_VERSION, 0); |
| 290 entry->Put(SERVER_IS_DIR, false); | 294 entry->Put(SERVER_IS_DIR, false); |
| 291 entry->Put(SERVER_IS_DEL, false); | 295 entry->Put(SERVER_IS_DEL, false); |
| 292 entry->Put(IS_UNAPPLIED_UPDATE, false); | 296 entry->Put(IS_UNAPPLIED_UPDATE, false); |
| 293 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 297 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
| 294 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 298 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
| 295 } | 299 } |
| 296 | 300 |
| 297 } // namespace csync | 301 } // namespace csync |
| OLD | NEW |