OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/sync/driver/glue/sync_backend_host_core.h" | 5 #include "components/sync/driver/glue/sync_backend_host_core.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 void SyncBackendHostCore::DoPurgeDisabledTypes(const ModelTypeSet& to_purge, | 503 void SyncBackendHostCore::DoPurgeDisabledTypes(const ModelTypeSet& to_purge, |
504 const ModelTypeSet& to_journal, | 504 const ModelTypeSet& to_journal, |
505 const ModelTypeSet& to_unapply) { | 505 const ModelTypeSet& to_unapply) { |
506 DCHECK(thread_checker_.CalledOnValidThread()); | 506 DCHECK(thread_checker_.CalledOnValidThread()); |
507 sync_manager_->PurgeDisabledTypes(to_purge, to_journal, to_unapply); | 507 sync_manager_->PurgeDisabledTypes(to_purge, to_journal, to_unapply); |
508 } | 508 } |
509 | 509 |
510 void SyncBackendHostCore::DoConfigureSyncer( | 510 void SyncBackendHostCore::DoConfigureSyncer( |
511 ConfigureReason reason, | 511 ModelTypeConfigurer::ConfigureParams params) { |
512 const ModelTypeSet& to_download, | |
513 const ModelSafeRoutingInfo routing_info, | |
514 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | |
515 const base::Closure& retry_callback) { | |
516 DCHECK(thread_checker_.CalledOnValidThread()); | 512 DCHECK(thread_checker_.CalledOnValidThread()); |
517 DCHECK(!ready_task.is_null()); | 513 DCHECK(!params.ready_task.is_null()); |
518 DCHECK(!retry_callback.is_null()); | 514 DCHECK(!params.retry_callback.is_null()); |
519 base::Closure chained_ready_task( | 515 |
520 base::Bind(&SyncBackendHostCore::DoFinishConfigureDataTypes, | 516 registrar_->ConfigureDataTypes(params.enabled_types, params.disabled_types); |
521 weak_ptr_factory_.GetWeakPtr(), to_download, ready_task)); | 517 |
| 518 ModelSafeRoutingInfo routing_info; |
| 519 registrar_->GetModelSafeRoutingInfo(&routing_info); |
| 520 |
| 521 base::Closure chained_ready_task(base::Bind( |
| 522 &SyncBackendHostCore::DoFinishConfigureDataTypes, |
| 523 weak_ptr_factory_.GetWeakPtr(), params.to_download, params.ready_task)); |
522 base::Closure chained_retry_task( | 524 base::Closure chained_retry_task( |
523 base::Bind(&SyncBackendHostCore::DoRetryConfiguration, | 525 base::Bind(&SyncBackendHostCore::DoRetryConfiguration, |
524 weak_ptr_factory_.GetWeakPtr(), retry_callback)); | 526 weak_ptr_factory_.GetWeakPtr(), params.retry_callback)); |
525 sync_manager_->ConfigureSyncer(reason, to_download, routing_info, | 527 |
526 chained_ready_task, chained_retry_task); | 528 sync_manager_->ConfigureSyncer(params.reason, params.to_download, |
| 529 routing_info, chained_ready_task, |
| 530 chained_retry_task); |
527 } | 531 } |
528 | 532 |
529 void SyncBackendHostCore::DoFinishConfigureDataTypes( | 533 void SyncBackendHostCore::DoFinishConfigureDataTypes( |
530 ModelTypeSet types_to_config, | 534 ModelTypeSet types_to_config, |
531 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { | 535 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { |
532 DCHECK(thread_checker_.CalledOnValidThread()); | 536 DCHECK(thread_checker_.CalledOnValidThread()); |
533 | 537 |
534 // Update the enabled types for the bridge and sync manager. | 538 // Update the enabled types for the bridge and sync manager. |
535 ModelSafeRoutingInfo routing_info; | 539 ModelSafeRoutingInfo routing_info; |
536 registrar_->GetModelSafeRoutingInfo(&routing_info); | 540 registrar_->GetModelSafeRoutingInfo(&routing_info); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 636 } |
633 | 637 |
634 void SyncBackendHostCore::ClearServerDataDone( | 638 void SyncBackendHostCore::ClearServerDataDone( |
635 const base::Closure& frontend_callback) { | 639 const base::Closure& frontend_callback) { |
636 DCHECK(thread_checker_.CalledOnValidThread()); | 640 DCHECK(thread_checker_.CalledOnValidThread()); |
637 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, | 641 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, |
638 frontend_callback); | 642 frontend_callback); |
639 } | 643 } |
640 | 644 |
641 } // namespace syncer | 645 } // namespace syncer |
OLD | NEW |