| 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" | 16 #include "sync/engine/clear_data_command.h" |
| 17 #include "sync/engine/commit.h" | 17 #include "sync/engine/commit.h" |
| 18 #include "sync/engine/conflict_resolver.h" | 18 #include "sync/engine/conflict_resolver.h" |
| 19 #include "sync/engine/download_updates_command.h" | 19 #include "sync/engine/download_updates_command.h" |
| 20 #include "sync/engine/net/server_connection_manager.h" | 20 #include "sync/engine/net/server_connection_manager.h" |
| 21 #include "sync/engine/process_commit_response_command.h" | 21 #include "sync/engine/process_commit_response_command.h" |
| 22 #include "sync/engine/process_updates_command.h" | 22 #include "sync/engine/process_updates_command.h" |
| 23 #include "sync/engine/resolve_conflicts_command.h" | 23 #include "sync/engine/resolve_conflicts_command.h" |
| 24 #include "sync/engine/store_timestamps_command.h" | 24 #include "sync/engine/store_timestamps_command.h" |
| 25 #include "sync/engine/syncer_types.h" | 25 #include "sync/engine/syncer_types.h" |
| 26 #include "sync/engine/syncproto.h" | 26 #include "sync/engine/syncproto.h" |
| 27 #include "sync/engine/throttled_data_type_tracker.h" |
| 27 #include "sync/engine/verify_updates_command.h" | 28 #include "sync/engine/verify_updates_command.h" |
| 28 #include "sync/syncable/syncable-inl.h" | 29 #include "sync/syncable/syncable-inl.h" |
| 29 #include "sync/syncable/syncable.h" | 30 #include "sync/syncable/syncable.h" |
| 30 | 31 |
| 31 using base::Time; | 32 using base::Time; |
| 32 using base::TimeDelta; | 33 using base::TimeDelta; |
| 33 using sync_pb::ClientCommand; | 34 using sync_pb::ClientCommand; |
| 34 using syncable::Blob; | 35 using syncable::Blob; |
| 35 using syncable::IS_UNAPPLIED_UPDATE; | 36 using syncable::IS_UNAPPLIED_UPDATE; |
| 36 using syncable::SERVER_CTIME; | 37 using syncable::SERVER_CTIME; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SyncerStep current_step = first_step; | 101 SyncerStep current_step = first_step; |
| 101 | 102 |
| 102 SyncerStep next_step = current_step; | 103 SyncerStep next_step = current_step; |
| 103 while (!ExitRequested()) { | 104 while (!ExitRequested()) { |
| 104 TRACE_EVENT1("sync", "SyncerStateMachine", | 105 TRACE_EVENT1("sync", "SyncerStateMachine", |
| 105 "state", SyncerStepToString(current_step)); | 106 "state", SyncerStepToString(current_step)); |
| 106 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step); | 107 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step); |
| 107 | 108 |
| 108 switch (current_step) { | 109 switch (current_step) { |
| 109 case SYNCER_BEGIN: | 110 case SYNCER_BEGIN: |
| 110 session->context()->PruneUnthrottledTypes(base::TimeTicks::Now()); | 111 session->context()->throttled_data_type_tracker()-> |
| 112 PruneUnthrottledTypes(base::TimeTicks::Now()); |
| 111 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN); | 113 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN); |
| 112 | 114 |
| 113 next_step = CLEANUP_DISABLED_TYPES; | 115 next_step = CLEANUP_DISABLED_TYPES; |
| 114 break; | 116 break; |
| 115 case CLEANUP_DISABLED_TYPES: { | 117 case CLEANUP_DISABLED_TYPES: { |
| 116 CleanupDisabledTypesCommand cleanup; | 118 CleanupDisabledTypesCommand cleanup; |
| 117 cleanup.Execute(session); | 119 cleanup.Execute(session); |
| 118 next_step = DOWNLOAD_UPDATES; | 120 next_step = DOWNLOAD_UPDATES; |
| 119 break; | 121 break; |
| 120 } | 122 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 entry->Put(SERVER_CTIME, Time()); | 299 entry->Put(SERVER_CTIME, Time()); |
| 298 entry->Put(SERVER_VERSION, 0); | 300 entry->Put(SERVER_VERSION, 0); |
| 299 entry->Put(SERVER_IS_DIR, false); | 301 entry->Put(SERVER_IS_DIR, false); |
| 300 entry->Put(SERVER_IS_DEL, false); | 302 entry->Put(SERVER_IS_DEL, false); |
| 301 entry->Put(IS_UNAPPLIED_UPDATE, false); | 303 entry->Put(IS_UNAPPLIED_UPDATE, false); |
| 302 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 304 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
| 303 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 305 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
| 304 } | 306 } |
| 305 | 307 |
| 306 } // namespace browser_sync | 308 } // namespace browser_sync |
| OLD | NEW |