| 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_updates_command.h" | 13 #include "sync/engine/apply_updates_command.h" |
| 14 #include "sync/engine/build_commit_command.h" | 14 #include "sync/engine/build_commit_command.h" |
| 15 #include "sync/engine/cleanup_disabled_types_command.h" | 15 #include "sync/engine/cleanup_disabled_types_command.h" |
| 16 #include "sync/engine/clear_data_command.h" | |
| 17 #include "sync/engine/commit.h" | 16 #include "sync/engine/commit.h" |
| 18 #include "sync/engine/conflict_resolver.h" | 17 #include "sync/engine/conflict_resolver.h" |
| 19 #include "sync/engine/download_updates_command.h" | 18 #include "sync/engine/download_updates_command.h" |
| 20 #include "sync/engine/net/server_connection_manager.h" | 19 #include "sync/engine/net/server_connection_manager.h" |
| 21 #include "sync/engine/process_commit_response_command.h" | 20 #include "sync/engine/process_commit_response_command.h" |
| 22 #include "sync/engine/process_updates_command.h" | 21 #include "sync/engine/process_updates_command.h" |
| 23 #include "sync/engine/resolve_conflicts_command.h" | 22 #include "sync/engine/resolve_conflicts_command.h" |
| 24 #include "sync/engine/store_timestamps_command.h" | 23 #include "sync/engine/store_timestamps_command.h" |
| 25 #include "sync/engine/syncer_types.h" | 24 #include "sync/engine/syncer_types.h" |
| 26 #include "sync/engine/syncproto.h" | 25 #include "sync/engine/syncproto.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ENUM_CASE(CLEANUP_DISABLED_TYPES); | 60 ENUM_CASE(CLEANUP_DISABLED_TYPES); |
| 62 ENUM_CASE(DOWNLOAD_UPDATES); | 61 ENUM_CASE(DOWNLOAD_UPDATES); |
| 63 ENUM_CASE(PROCESS_CLIENT_COMMAND); | 62 ENUM_CASE(PROCESS_CLIENT_COMMAND); |
| 64 ENUM_CASE(VERIFY_UPDATES); | 63 ENUM_CASE(VERIFY_UPDATES); |
| 65 ENUM_CASE(PROCESS_UPDATES); | 64 ENUM_CASE(PROCESS_UPDATES); |
| 66 ENUM_CASE(STORE_TIMESTAMPS); | 65 ENUM_CASE(STORE_TIMESTAMPS); |
| 67 ENUM_CASE(APPLY_UPDATES); | 66 ENUM_CASE(APPLY_UPDATES); |
| 68 ENUM_CASE(COMMIT); | 67 ENUM_CASE(COMMIT); |
| 69 ENUM_CASE(RESOLVE_CONFLICTS); | 68 ENUM_CASE(RESOLVE_CONFLICTS); |
| 70 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); | 69 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); |
| 71 ENUM_CASE(CLEAR_PRIVATE_DATA); | |
| 72 ENUM_CASE(SYNCER_END); | 70 ENUM_CASE(SYNCER_END); |
| 73 } | 71 } |
| 74 NOTREACHED(); | 72 NOTREACHED(); |
| 75 return ""; | 73 return ""; |
| 76 } | 74 } |
| 77 #undef ENUM_CASE | 75 #undef ENUM_CASE |
| 78 | 76 |
| 79 Syncer::Syncer() | 77 Syncer::Syncer() |
| 80 : early_exit_requested_(false) { | 78 : early_exit_requested_(false) { |
| 81 } | 79 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // SyncSession::HasMoreToSync() will send us into another sync cycle | 217 // SyncSession::HasMoreToSync() will send us into another sync cycle |
| 220 // after this one completes. | 218 // after this one completes. |
| 221 // | 219 // |
| 222 // TODO(rlarocque, 109072): Make conflict resolution not require | 220 // TODO(rlarocque, 109072): Make conflict resolution not require |
| 223 // extra sync cycles/GetUpdates. | 221 // extra sync cycles/GetUpdates. |
| 224 status->update_conflicts_resolved(before_blocking_conflicting_updates > | 222 status->update_conflicts_resolved(before_blocking_conflicting_updates > |
| 225 after_blocking_conflicting_updates); | 223 after_blocking_conflicting_updates); |
| 226 next_step = SYNCER_END; | 224 next_step = SYNCER_END; |
| 227 break; | 225 break; |
| 228 } | 226 } |
| 229 case CLEAR_PRIVATE_DATA: { | |
| 230 ClearDataCommand clear_data_command; | |
| 231 clear_data_command.Execute(session); | |
| 232 next_step = SYNCER_END; | |
| 233 break; | |
| 234 } | |
| 235 case SYNCER_END: { | 227 case SYNCER_END: { |
| 236 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_ENDED); | 228 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_ENDED); |
| 237 next_step = SYNCER_END; | 229 next_step = SYNCER_END; |
| 238 break; | 230 break; |
| 239 } | 231 } |
| 240 default: | 232 default: |
| 241 LOG(ERROR) << "Unknown command: " << current_step; | 233 LOG(ERROR) << "Unknown command: " << current_step; |
| 242 } | 234 } |
| 243 DVLOG(2) << "last step: " << SyncerStepToString(last_step) << ", " | 235 DVLOG(2) << "last step: " << SyncerStepToString(last_step) << ", " |
| 244 << "current step: " << SyncerStepToString(current_step) << ", " | 236 << "current step: " << SyncerStepToString(current_step) << ", " |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 entry->Put(SERVER_CTIME, Time()); | 291 entry->Put(SERVER_CTIME, Time()); |
| 300 entry->Put(SERVER_VERSION, 0); | 292 entry->Put(SERVER_VERSION, 0); |
| 301 entry->Put(SERVER_IS_DIR, false); | 293 entry->Put(SERVER_IS_DIR, false); |
| 302 entry->Put(SERVER_IS_DEL, false); | 294 entry->Put(SERVER_IS_DEL, false); |
| 303 entry->Put(IS_UNAPPLIED_UPDATE, false); | 295 entry->Put(IS_UNAPPLIED_UPDATE, false); |
| 304 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 296 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
| 305 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 297 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
| 306 } | 298 } |
| 307 | 299 |
| 308 } // namespace browser_sync | 300 } // namespace browser_sync |
| OLD | NEW |