| 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_impl.h" | 5 #include "components/sync/driver/glue/sync_backend_host_impl.h" | 
| 6 | 6 | 
| 7 #include <utility> | 7 #include <utility> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" | 
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 359   // - Types which have just been added to the routing info (types_to_download): | 359   // - Types which have just been added to the routing info (types_to_download): | 
| 360   //   are downloaded. | 360   //   are downloaded. | 
| 361   // - Types which have encountered a fatal error (fatal_types) are deleted | 361   // - Types which have encountered a fatal error (fatal_types) are deleted | 
| 362   //   from the directory and journaled in the delete journal. | 362   //   from the directory and journaled in the delete journal. | 
| 363   // - Types which have encountered a cryptographer error (crypto_types) are | 363   // - Types which have encountered a cryptographer error (crypto_types) are | 
| 364   //   unapplied (local state is purged but sync state is not). | 364   //   unapplied (local state is purged but sync state is not). | 
| 365   // - All other types not in the routing info (types just disabled) are deleted | 365   // - All other types not in the routing info (types just disabled) are deleted | 
| 366   //   from the directory. | 366   //   from the directory. | 
| 367   // - Everything else (enabled types and already disabled types) is not | 367   // - Everything else (enabled types and already disabled types) is not | 
| 368   //   touched. | 368   //   touched. | 
| 369   RequestConfigureSyncer(reason, types_to_download, types_to_purge, fatal_types, | 369   sync_task_runner_->PostTask( | 
| 370                          unapply_types, inactive_types, routing_info, | 370       FROM_HERE, base::Bind(&SyncBackendHostCore::DoPurgeDisabledTypes, core_, | 
| 371                          ready_task, retry_callback); | 371                             types_to_purge, fatal_types, unapply_types)); | 
|  | 372   RequestConfigureSyncer(reason, types_to_download, routing_info, ready_task, | 
|  | 373                          retry_callback); | 
| 372 | 374 | 
| 373   DCHECK(Intersection(active_types, types_to_purge).Empty()); | 375   DCHECK(Intersection(active_types, types_to_purge).Empty()); | 
| 374   DCHECK(Intersection(active_types, fatal_types).Empty()); | 376   DCHECK(Intersection(active_types, fatal_types).Empty()); | 
| 375   DCHECK(Intersection(active_types, unapply_types).Empty()); | 377   DCHECK(Intersection(active_types, unapply_types).Empty()); | 
| 376   DCHECK(Intersection(active_types, inactive_types).Empty()); | 378   DCHECK(Intersection(active_types, inactive_types).Empty()); | 
| 377   return Difference(active_types, types_to_download); | 379   return Difference(active_types, types_to_download); | 
| 378 } | 380 } | 
| 379 | 381 | 
| 380 void SyncBackendHostImpl::EnableEncryptEverything() { | 382 void SyncBackendHostImpl::EnableEncryptEverything() { | 
| 381   sync_task_runner_->PostTask( | 383   sync_task_runner_->PostTask( | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 492 void SyncBackendHostImpl::InitCore( | 494 void SyncBackendHostImpl::InitCore( | 
| 493     std::unique_ptr<DoInitializeOptions> options) { | 495     std::unique_ptr<DoInitializeOptions> options) { | 
| 494   sync_task_runner_->PostTask( | 496   sync_task_runner_->PostTask( | 
| 495       FROM_HERE, base::Bind(&SyncBackendHostCore::DoInitialize, core_, | 497       FROM_HERE, base::Bind(&SyncBackendHostCore::DoInitialize, core_, | 
| 496                             base::Passed(&options))); | 498                             base::Passed(&options))); | 
| 497 } | 499 } | 
| 498 | 500 | 
| 499 void SyncBackendHostImpl::RequestConfigureSyncer( | 501 void SyncBackendHostImpl::RequestConfigureSyncer( | 
| 500     ConfigureReason reason, | 502     ConfigureReason reason, | 
| 501     ModelTypeSet to_download, | 503     ModelTypeSet to_download, | 
| 502     ModelTypeSet to_purge, |  | 
| 503     ModelTypeSet to_journal, |  | 
| 504     ModelTypeSet to_unapply, |  | 
| 505     ModelTypeSet to_ignore, |  | 
| 506     const ModelSafeRoutingInfo& routing_info, | 504     const ModelSafeRoutingInfo& routing_info, | 
| 507     const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 505     const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 
| 508     const base::Closure& retry_callback) { | 506     const base::Closure& retry_callback) { | 
| 509   DoConfigureSyncerTypes config_types; |  | 
| 510   config_types.to_download = to_download; |  | 
| 511   config_types.to_purge = to_purge; |  | 
| 512   config_types.to_journal = to_journal; |  | 
| 513   config_types.to_unapply = to_unapply; |  | 
| 514   sync_task_runner_->PostTask( | 507   sync_task_runner_->PostTask( | 
| 515       FROM_HERE, | 508       FROM_HERE, | 
| 516       base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_, reason, | 509       base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_, reason, | 
| 517                  config_types, routing_info, ready_task, retry_callback)); | 510                  to_download, routing_info, ready_task, retry_callback)); | 
| 518 } | 511 } | 
| 519 | 512 | 
| 520 void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop( | 513 void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop( | 
| 521     const ModelTypeSet enabled_types, | 514     const ModelTypeSet enabled_types, | 
| 522     const ModelTypeSet succeeded_configuration_types, | 515     const ModelTypeSet succeeded_configuration_types, | 
| 523     const ModelTypeSet failed_configuration_types, | 516     const ModelTypeSet failed_configuration_types, | 
| 524     const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { | 517     const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { | 
| 525   if (invalidator_) { | 518   if (invalidator_) { | 
| 526     CHECK(invalidator_->UpdateRegisteredInvalidationIds( | 519     CHECK(invalidator_->UpdateRegisteredInvalidationIds( | 
| 527         this, ModelTypeSetToObjectIdSet(enabled_types))); | 520         this, ModelTypeSetToObjectIdSet(enabled_types))); | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 763     const SyncManager::ClearServerDataCallback& frontend_callback) { | 756     const SyncManager::ClearServerDataCallback& frontend_callback) { | 
| 764   DCHECK(thread_checker_.CalledOnValidThread()); | 757   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 765   frontend_callback.Run(); | 758   frontend_callback.Run(); | 
| 766 } | 759 } | 
| 767 | 760 | 
| 768 }  // namespace syncer | 761 }  // namespace syncer | 
| 769 | 762 | 
| 770 #undef SDVLOG | 763 #undef SDVLOG | 
| 771 | 764 | 
| 772 #undef SLOG | 765 #undef SLOG | 
| OLD | NEW | 
|---|