| 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/commit.h" | 16 #include "sync/engine/commit.h" |
| 16 #include "sync/engine/conflict_resolver.h" | 17 #include "sync/engine/conflict_resolver.h" |
| 17 #include "sync/engine/download_updates_command.h" | 18 #include "sync/engine/download_updates_command.h" |
| 18 #include "sync/engine/net/server_connection_manager.h" | 19 #include "sync/engine/net/server_connection_manager.h" |
| 19 #include "sync/engine/process_commit_response_command.h" | 20 #include "sync/engine/process_commit_response_command.h" |
| 20 #include "sync/engine/process_updates_command.h" | 21 #include "sync/engine/process_updates_command.h" |
| 21 #include "sync/engine/resolve_conflicts_command.h" | 22 #include "sync/engine/resolve_conflicts_command.h" |
| 22 #include "sync/engine/store_timestamps_command.h" | 23 #include "sync/engine/store_timestamps_command.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 DVLOG(1) << "Aborting sync cycle due to download updates failure"; | 152 DVLOG(1) << "Aborting sync cycle due to download updates failure"; |
| 152 } else if (!session->status_controller() | 153 } else if (!session->status_controller() |
| 153 .ServerSaysNothingMoreToDownload()) { | 154 .ServerSaysNothingMoreToDownload()) { |
| 154 next_step = DOWNLOAD_UPDATES; | 155 next_step = DOWNLOAD_UPDATES; |
| 155 } else { | 156 } else { |
| 156 next_step = APPLY_UPDATES; | 157 next_step = APPLY_UPDATES; |
| 157 } | 158 } |
| 158 break; | 159 break; |
| 159 } | 160 } |
| 160 case APPLY_UPDATES: { | 161 case APPLY_UPDATES: { |
| 162 // These include encryption updates that should be applied early. |
| 163 ApplyControlDataUpdates(session->context()->directory()); |
| 164 |
| 161 ApplyUpdatesCommand apply_updates; | 165 ApplyUpdatesCommand apply_updates; |
| 162 apply_updates.Execute(session); | 166 apply_updates.Execute(session); |
| 163 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); | 167 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); |
| 164 if (last_step == APPLY_UPDATES) { | 168 if (last_step == APPLY_UPDATES) { |
| 165 // We're in configuration mode, but we still need to run the | 169 // We're in configuration mode, but we still need to run the |
| 166 // SYNCER_END step. | 170 // SYNCER_END step. |
| 167 last_step = SYNCER_END; | 171 last_step = SYNCER_END; |
| 168 next_step = SYNCER_END; | 172 next_step = SYNCER_END; |
| 169 } else { | 173 } else { |
| 170 next_step = COMMIT; | 174 next_step = COMMIT; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 entry->Put(SERVER_CTIME, Time()); | 285 entry->Put(SERVER_CTIME, Time()); |
| 282 entry->Put(SERVER_VERSION, 0); | 286 entry->Put(SERVER_VERSION, 0); |
| 283 entry->Put(SERVER_IS_DIR, false); | 287 entry->Put(SERVER_IS_DIR, false); |
| 284 entry->Put(SERVER_IS_DEL, false); | 288 entry->Put(SERVER_IS_DEL, false); |
| 285 entry->Put(IS_UNAPPLIED_UPDATE, false); | 289 entry->Put(IS_UNAPPLIED_UPDATE, false); |
| 286 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 290 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
| 287 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 291 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
| 288 } | 292 } |
| 289 | 293 |
| 290 } // namespace syncer | 294 } // namespace syncer |
| OLD | NEW |