OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/engine/apply_updates_command.h" | 9 #include "chrome/browser/sync/engine/apply_updates_command.h" |
10 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" | 10 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 break; | 264 break; |
265 } | 265 } |
266 case CLEAR_PRIVATE_DATA: { | 266 case CLEAR_PRIVATE_DATA: { |
267 VLOG(1) << "Clear Private Data"; | 267 VLOG(1) << "Clear Private Data"; |
268 ClearDataCommand clear_data_command; | 268 ClearDataCommand clear_data_command; |
269 clear_data_command.Execute(session); | 269 clear_data_command.Execute(session); |
270 next_step = SYNCER_END; | 270 next_step = SYNCER_END; |
271 break; | 271 break; |
272 } | 272 } |
273 case SYNCER_END: { | 273 case SYNCER_END: { |
274 VLOG(1) << "Syncer End"; | |
275 SyncerEndCommand syncer_end_command; | |
276 syncer_end_command.Execute(session); | |
277 break; | 274 break; |
278 } | 275 } |
279 default: | 276 default: |
280 LOG(ERROR) << "Unknown command: " << current_step; | 277 LOG(ERROR) << "Unknown command: " << current_step; |
281 } | 278 } |
282 if (last_step == current_step) | 279 if (last_step == current_step) |
283 break; | 280 break; |
284 current_step = next_step; | 281 current_step = next_step; |
285 } | 282 } |
286 | 283 |
287 // Always send out a cycle ended notification, regardless of end-state. | 284 VLOG(1) << "Syncer End"; |
288 SyncEngineEvent event(SyncEngineEvent::SYNC_CYCLE_ENDED); | 285 SyncerEndCommand syncer_end_command; |
289 sessions::SyncSessionSnapshot snapshot(session->TakeSnapshot()); | 286 syncer_end_command.Execute(session); |
290 event.snapshot = &snapshot; | |
291 session->context()->NotifyListeners(event); | |
292 return; | 287 return; |
293 } | 288 } |
294 | 289 |
295 void Syncer::ProcessClientCommand(sessions::SyncSession* session) { | 290 void Syncer::ProcessClientCommand(sessions::SyncSession* session) { |
296 const ClientToServerResponse& response = | 291 const ClientToServerResponse& response = |
297 session->status_controller()->updates_response(); | 292 session->status_controller()->updates_response(); |
298 if (!response.has_client_command()) | 293 if (!response.has_client_command()) |
299 return; | 294 return; |
300 const ClientCommand& command = response.client_command(); | 295 const ClientCommand& command = response.client_command(); |
301 | 296 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 entry->Put(SERVER_CTIME, 0); | 329 entry->Put(SERVER_CTIME, 0); |
335 entry->Put(SERVER_VERSION, 0); | 330 entry->Put(SERVER_VERSION, 0); |
336 entry->Put(SERVER_IS_DIR, false); | 331 entry->Put(SERVER_IS_DIR, false); |
337 entry->Put(SERVER_IS_DEL, false); | 332 entry->Put(SERVER_IS_DEL, false); |
338 entry->Put(IS_UNAPPLIED_UPDATE, false); | 333 entry->Put(IS_UNAPPLIED_UPDATE, false); |
339 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 334 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
340 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 335 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
341 } | 336 } |
342 | 337 |
343 } // namespace browser_sync | 338 } // namespace browser_sync |
OLD | NEW |