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 "chrome/browser/sync/engine/syncer.h" | 5 #include "chrome/browser/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 "chrome/browser/sync/engine/apply_updates_command.h" | 12 #include "chrome/browser/sync/engine/apply_updates_command.h" |
13 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" | |
14 #include "chrome/browser/sync/engine/build_commit_command.h" | 13 #include "chrome/browser/sync/engine/build_commit_command.h" |
15 #include "chrome/browser/sync/engine/cleanup_disabled_types_command.h" | 14 #include "chrome/browser/sync/engine/cleanup_disabled_types_command.h" |
16 #include "chrome/browser/sync/engine/clear_data_command.h" | 15 #include "chrome/browser/sync/engine/clear_data_command.h" |
17 #include "chrome/browser/sync/engine/conflict_resolver.h" | 16 #include "chrome/browser/sync/engine/conflict_resolver.h" |
18 #include "chrome/browser/sync/engine/download_updates_command.h" | 17 #include "chrome/browser/sync/engine/download_updates_command.h" |
19 #include "chrome/browser/sync/engine/get_commit_ids_command.h" | 18 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
20 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 19 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
21 #include "chrome/browser/sync/engine/post_commit_message_command.h" | 20 #include "chrome/browser/sync/engine/post_commit_message_command.h" |
22 #include "chrome/browser/sync/engine/process_commit_response_command.h" | 21 #include "chrome/browser/sync/engine/process_commit_response_command.h" |
23 #include "chrome/browser/sync/engine/process_updates_command.h" | 22 #include "chrome/browser/sync/engine/process_updates_command.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ENUM_CASE(CLEANUP_DISABLED_TYPES); | 62 ENUM_CASE(CLEANUP_DISABLED_TYPES); |
64 ENUM_CASE(DOWNLOAD_UPDATES); | 63 ENUM_CASE(DOWNLOAD_UPDATES); |
65 ENUM_CASE(PROCESS_CLIENT_COMMAND); | 64 ENUM_CASE(PROCESS_CLIENT_COMMAND); |
66 ENUM_CASE(VERIFY_UPDATES); | 65 ENUM_CASE(VERIFY_UPDATES); |
67 ENUM_CASE(PROCESS_UPDATES); | 66 ENUM_CASE(PROCESS_UPDATES); |
68 ENUM_CASE(STORE_TIMESTAMPS); | 67 ENUM_CASE(STORE_TIMESTAMPS); |
69 ENUM_CASE(APPLY_UPDATES); | 68 ENUM_CASE(APPLY_UPDATES); |
70 ENUM_CASE(BUILD_COMMIT_REQUEST); | 69 ENUM_CASE(BUILD_COMMIT_REQUEST); |
71 ENUM_CASE(POST_COMMIT_MESSAGE); | 70 ENUM_CASE(POST_COMMIT_MESSAGE); |
72 ENUM_CASE(PROCESS_COMMIT_RESPONSE); | 71 ENUM_CASE(PROCESS_COMMIT_RESPONSE); |
73 ENUM_CASE(BUILD_AND_PROCESS_CONFLICT_SETS); | |
74 ENUM_CASE(RESOLVE_CONFLICTS); | 72 ENUM_CASE(RESOLVE_CONFLICTS); |
75 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); | 73 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); |
76 ENUM_CASE(CLEAR_PRIVATE_DATA); | 74 ENUM_CASE(CLEAR_PRIVATE_DATA); |
77 ENUM_CASE(SYNCER_END); | 75 ENUM_CASE(SYNCER_END); |
78 } | 76 } |
79 NOTREACHED(); | 77 NOTREACHED(); |
80 return ""; | 78 return ""; |
81 } | 79 } |
82 #undef ENUM_CASE | 80 #undef ENUM_CASE |
83 | 81 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 session->context()->max_commit_batch_size()); | 207 session->context()->max_commit_batch_size()); |
210 get_commit_ids_command.Execute(session); | 208 get_commit_ids_command.Execute(session); |
211 | 209 |
212 if (!session->status_controller().commit_ids().empty()) { | 210 if (!session->status_controller().commit_ids().empty()) { |
213 DVLOG(1) << "Building a commit message"; | 211 DVLOG(1) << "Building a commit message"; |
214 BuildCommitCommand build_commit_command; | 212 BuildCommitCommand build_commit_command; |
215 build_commit_command.Execute(session); | 213 build_commit_command.Execute(session); |
216 | 214 |
217 next_step = POST_COMMIT_MESSAGE; | 215 next_step = POST_COMMIT_MESSAGE; |
218 } else { | 216 } else { |
219 next_step = BUILD_AND_PROCESS_CONFLICT_SETS; | 217 next_step = RESOLVE_CONFLICTS; |
220 } | 218 } |
221 | 219 |
222 break; | 220 break; |
223 } | 221 } |
224 case POST_COMMIT_MESSAGE: { | 222 case POST_COMMIT_MESSAGE: { |
225 PostCommitMessageCommand post_commit_command; | 223 PostCommitMessageCommand post_commit_command; |
226 session->mutable_status_controller()->set_last_post_commit_result( | 224 session->mutable_status_controller()->set_last_post_commit_result( |
227 post_commit_command.Execute(session)); | 225 post_commit_command.Execute(session)); |
228 next_step = PROCESS_COMMIT_RESPONSE; | 226 next_step = PROCESS_COMMIT_RESPONSE; |
229 break; | 227 break; |
230 } | 228 } |
231 case PROCESS_COMMIT_RESPONSE: { | 229 case PROCESS_COMMIT_RESPONSE: { |
232 session->mutable_status_controller()->reset_num_conflicting_commits(); | 230 session->mutable_status_controller()->reset_num_conflicting_commits(); |
233 ProcessCommitResponseCommand process_response_command; | 231 ProcessCommitResponseCommand process_response_command; |
234 session->mutable_status_controller()-> | 232 session->mutable_status_controller()-> |
235 set_last_process_commit_response_result( | 233 set_last_process_commit_response_result( |
236 process_response_command.Execute(session)); | 234 process_response_command.Execute(session)); |
237 next_step = BUILD_AND_PROCESS_CONFLICT_SETS; | |
238 break; | |
239 } | |
240 case BUILD_AND_PROCESS_CONFLICT_SETS: { | |
241 BuildAndProcessConflictSetsCommand build_process_conflict_sets; | |
242 build_process_conflict_sets.Execute(session); | |
243 next_step = RESOLVE_CONFLICTS; | 235 next_step = RESOLVE_CONFLICTS; |
244 break; | 236 break; |
245 } | 237 } |
246 case RESOLVE_CONFLICTS: { | 238 case RESOLVE_CONFLICTS: { |
247 StatusController* status = session->mutable_status_controller(); | 239 StatusController* status = session->mutable_status_controller(); |
248 status->reset_conflicts_resolved(); | 240 status->reset_conflicts_resolved(); |
249 ResolveConflictsCommand resolve_conflicts_command; | 241 ResolveConflictsCommand resolve_conflicts_command; |
250 resolve_conflicts_command.Execute(session); | 242 resolve_conflicts_command.Execute(session); |
251 | 243 |
252 // Has ConflictingUpdates includes both blocking and non-blocking | 244 // Has ConflictingUpdates includes both blocking and non-blocking |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 entry->Put(SERVER_CTIME, Time()); | 344 entry->Put(SERVER_CTIME, Time()); |
353 entry->Put(SERVER_VERSION, 0); | 345 entry->Put(SERVER_VERSION, 0); |
354 entry->Put(SERVER_IS_DIR, false); | 346 entry->Put(SERVER_IS_DIR, false); |
355 entry->Put(SERVER_IS_DEL, false); | 347 entry->Put(SERVER_IS_DEL, false); |
356 entry->Put(IS_UNAPPLIED_UPDATE, false); | 348 entry->Put(IS_UNAPPLIED_UPDATE, false); |
357 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 349 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
358 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 350 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
359 } | 351 } |
360 | 352 |
361 } // namespace browser_sync | 353 } // namespace browser_sync |
OLD | NEW |