| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/syncer.h" | 5 #include "chrome/browser/sync/engine/syncer.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/sync/engine/apply_updates_command.h" | 10 #include "chrome/browser/sync/engine/apply_updates_command.h" |
| 11 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" | 11 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" |
| 12 #include "chrome/browser/sync/engine/build_commit_command.h" | 12 #include "chrome/browser/sync/engine/build_commit_command.h" |
| 13 #include "chrome/browser/sync/engine/conflict_resolver.h" | 13 #include "chrome/browser/sync/engine/conflict_resolver.h" |
| 14 #include "chrome/browser/sync/engine/download_updates_command.h" | 14 #include "chrome/browser/sync/engine/download_updates_command.h" |
| 15 #include "chrome/browser/sync/engine/get_commit_ids_command.h" | 15 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
| 16 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 16 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 17 #include "chrome/browser/sync/engine/post_commit_message_command.h" | 17 #include "chrome/browser/sync/engine/post_commit_message_command.h" |
| 18 #include "chrome/browser/sync/engine/process_commit_response_command.h" | 18 #include "chrome/browser/sync/engine/process_commit_response_command.h" |
| 19 #include "chrome/browser/sync/engine/process_updates_command.h" | 19 #include "chrome/browser/sync/engine/process_updates_command.h" |
| 20 #include "chrome/browser/sync/engine/resolve_conflicts_command.h" | 20 #include "chrome/browser/sync/engine/resolve_conflicts_command.h" |
| 21 #include "chrome/browser/sync/engine/store_timestamps_command.h" |
| 21 #include "chrome/browser/sync/engine/syncer_end_command.h" | 22 #include "chrome/browser/sync/engine/syncer_end_command.h" |
| 22 #include "chrome/browser/sync/engine/syncer_types.h" | 23 #include "chrome/browser/sync/engine/syncer_types.h" |
| 23 #include "chrome/browser/sync/engine/syncer_util.h" | 24 #include "chrome/browser/sync/engine/syncer_util.h" |
| 24 #include "chrome/browser/sync/engine/syncproto.h" | 25 #include "chrome/browser/sync/engine/syncproto.h" |
| 25 #include "chrome/browser/sync/engine/verify_updates_command.h" | 26 #include "chrome/browser/sync/engine/verify_updates_command.h" |
| 26 #include "chrome/browser/sync/syncable/directory_manager.h" | 27 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 27 #include "chrome/browser/sync/syncable/syncable-inl.h" | 28 #include "chrome/browser/sync/syncable/syncable-inl.h" |
| 28 #include "chrome/browser/sync/syncable/syncable.h" | 29 #include "chrome/browser/sync/syncable/syncable.h" |
| 29 #include "chrome/browser/sync/util/closure.h" | 30 #include "chrome/browser/sync/util/closure.h" |
| 30 | 31 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 LOG(INFO) << "Verifying Updates"; | 133 LOG(INFO) << "Verifying Updates"; |
| 133 VerifyUpdatesCommand verify_updates; | 134 VerifyUpdatesCommand verify_updates; |
| 134 verify_updates.Execute(session); | 135 verify_updates.Execute(session); |
| 135 next_step = PROCESS_UPDATES; | 136 next_step = PROCESS_UPDATES; |
| 136 break; | 137 break; |
| 137 } | 138 } |
| 138 case PROCESS_UPDATES: { | 139 case PROCESS_UPDATES: { |
| 139 LOG(INFO) << "Processing Updates"; | 140 LOG(INFO) << "Processing Updates"; |
| 140 ProcessUpdatesCommand process_updates; | 141 ProcessUpdatesCommand process_updates; |
| 141 process_updates.Execute(session); | 142 process_updates.Execute(session); |
| 143 next_step = STORE_TIMESTAMPS; |
| 144 break; |
| 145 } |
| 146 case STORE_TIMESTAMPS: { |
| 147 LOG(INFO) << "Storing timestamps"; |
| 148 StoreTimestampsCommand store_timestamps; |
| 149 store_timestamps.Execute(session); |
| 142 // We should download all of the updates before attempting to process | 150 // We should download all of the updates before attempting to process |
| 143 // them. | 151 // them. |
| 144 if (session->status_controller()->CountUpdates() == 0) { | 152 if (session->status_controller()-> |
| 153 server_says_nothing_more_to_download() || |
| 154 !session->status_controller()->download_updates_succeeded()) { |
| 145 next_step = APPLY_UPDATES; | 155 next_step = APPLY_UPDATES; |
| 146 } else { | 156 } else { |
| 147 next_step = DOWNLOAD_UPDATES; | 157 next_step = DOWNLOAD_UPDATES; |
| 148 } | 158 } |
| 149 break; | 159 break; |
| 150 } | 160 } |
| 151 case APPLY_UPDATES: { | 161 case APPLY_UPDATES: { |
| 152 LOG(INFO) << "Applying Updates"; | 162 LOG(INFO) << "Applying Updates"; |
| 153 ApplyUpdatesCommand apply_updates; | 163 ApplyUpdatesCommand apply_updates; |
| 154 apply_updates.Execute(session); | 164 apply_updates.Execute(session); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 entry->Put(SERVER_CTIME, 0); | 313 entry->Put(SERVER_CTIME, 0); |
| 304 entry->Put(SERVER_VERSION, 0); | 314 entry->Put(SERVER_VERSION, 0); |
| 305 entry->Put(SERVER_IS_DIR, false); | 315 entry->Put(SERVER_IS_DIR, false); |
| 306 entry->Put(SERVER_IS_DEL, false); | 316 entry->Put(SERVER_IS_DEL, false); |
| 307 entry->Put(IS_UNAPPLIED_UPDATE, false); | 317 entry->Put(IS_UNAPPLIED_UPDATE, false); |
| 308 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 318 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
| 309 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 319 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
| 310 } | 320 } |
| 311 | 321 |
| 312 } // namespace browser_sync | 322 } // namespace browser_sync |
| OLD | NEW |