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_control_data_updates.h" |
14 #include "sync/engine/apply_updates_command.h" | 14 #include "sync/engine/apply_updates_command.h" |
15 #include "sync/engine/build_commit_command.h" | 15 #include "sync/engine/build_commit_command.h" |
16 #include "sync/engine/commit.h" | 16 #include "sync/engine/commit.h" |
17 #include "sync/engine/conflict_resolver.h" | 17 #include "sync/engine/conflict_resolver.h" |
18 #include "sync/engine/download_updates_command.h" | 18 #include "sync/engine/download_updates_command.h" |
19 #include "sync/engine/net/server_connection_manager.h" | 19 #include "sync/engine/net/server_connection_manager.h" |
20 #include "sync/engine/process_commit_response_command.h" | 20 #include "sync/engine/process_commit_response_command.h" |
21 #include "sync/engine/process_updates_command.h" | 21 #include "sync/engine/process_updates_command.h" |
22 #include "sync/engine/resolve_conflicts_command.h" | 22 #include "sync/engine/resolve_conflicts_command.h" |
23 #include "sync/engine/store_timestamps_command.h" | 23 #include "sync/engine/store_timestamps_command.h" |
24 #include "sync/engine/syncer_types.h" | 24 #include "sync/engine/syncer_types.h" |
25 #include "sync/engine/throttled_data_type_tracker.h" | 25 #include "sync/engine/throttled_data_type_tracker.h" |
26 #include "sync/engine/verify_updates_command.h" | |
27 #include "sync/syncable/mutable_entry.h" | 26 #include "sync/syncable/mutable_entry.h" |
28 #include "sync/syncable/syncable-inl.h" | 27 #include "sync/syncable/syncable-inl.h" |
29 | 28 |
30 using base::Time; | 29 using base::Time; |
31 using base::TimeDelta; | 30 using base::TimeDelta; |
32 using sync_pb::ClientCommand; | 31 using sync_pb::ClientCommand; |
33 | 32 |
34 namespace syncer { | 33 namespace syncer { |
35 | 34 |
36 using sessions::ScopedSessionContextConflictResolver; | 35 using sessions::ScopedSessionContextConflictResolver; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // TODO(akalin): We may want to propagate this switch up | 108 // TODO(akalin): We may want to propagate this switch up |
110 // eventually. | 109 // eventually. |
111 #if defined(OS_ANDROID) || defined(OS_IOS) | 110 #if defined(OS_ANDROID) || defined(OS_IOS) |
112 const bool kCreateMobileBookmarksFolder = true; | 111 const bool kCreateMobileBookmarksFolder = true; |
113 #else | 112 #else |
114 const bool kCreateMobileBookmarksFolder = false; | 113 const bool kCreateMobileBookmarksFolder = false; |
115 #endif | 114 #endif |
116 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder); | 115 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder); |
117 session->mutable_status_controller()->set_last_download_updates_result( | 116 session->mutable_status_controller()->set_last_download_updates_result( |
118 download_updates.Execute(session)); | 117 download_updates.Execute(session)); |
119 next_step = VERIFY_UPDATES; | |
120 break; | |
121 } | |
122 case VERIFY_UPDATES: { | |
123 VerifyUpdatesCommand verify_updates; | |
124 verify_updates.Execute(session); | |
125 next_step = PROCESS_UPDATES; | 118 next_step = PROCESS_UPDATES; |
126 break; | 119 break; |
127 } | 120 } |
128 case PROCESS_UPDATES: { | 121 case PROCESS_UPDATES: { |
129 ProcessUpdatesCommand process_updates; | 122 ProcessUpdatesCommand process_updates; |
130 process_updates.Execute(session); | 123 process_updates.Execute(session); |
131 next_step = STORE_TIMESTAMPS; | 124 next_step = STORE_TIMESTAMPS; |
132 break; | 125 break; |
133 } | 126 } |
134 case STORE_TIMESTAMPS: { | 127 case STORE_TIMESTAMPS: { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 entry->Put(SERVER_CTIME, Time()); | 244 entry->Put(SERVER_CTIME, Time()); |
252 entry->Put(SERVER_VERSION, 0); | 245 entry->Put(SERVER_VERSION, 0); |
253 entry->Put(SERVER_IS_DIR, false); | 246 entry->Put(SERVER_IS_DIR, false); |
254 entry->Put(SERVER_IS_DEL, false); | 247 entry->Put(SERVER_IS_DEL, false); |
255 entry->Put(IS_UNAPPLIED_UPDATE, false); | 248 entry->Put(IS_UNAPPLIED_UPDATE, false); |
256 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 249 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
257 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 250 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
258 } | 251 } |
259 | 252 |
260 } // namespace syncer | 253 } // namespace syncer |
OLD | NEW |