Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10804039: Make SyncBackendRegistrar aware of loaded data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Inline SignIn and UpdateCredentials Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sync/glue/sync_backend_host.h" 7 #include "chrome/browser/sync/glue/sync_backend_host.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const FilePath& sync_data_folder_path, 84 const FilePath& sync_data_folder_path,
85 const base::WeakPtr<SyncBackendHost>& backend); 85 const base::WeakPtr<SyncBackendHost>& backend);
86 86
87 // SyncManager::Observer implementation. The Core just acts like an air 87 // SyncManager::Observer implementation. The Core just acts like an air
88 // traffic controller here, forwarding incoming messages to appropriate 88 // traffic controller here, forwarding incoming messages to appropriate
89 // landing threads. 89 // landing threads.
90 virtual void OnSyncCycleCompleted( 90 virtual void OnSyncCycleCompleted(
91 const syncer::sessions::SyncSessionSnapshot& snapshot) OVERRIDE; 91 const syncer::sessions::SyncSessionSnapshot& snapshot) OVERRIDE;
92 virtual void OnInitializationComplete( 92 virtual void OnInitializationComplete(
93 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 93 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
94 bool success) OVERRIDE; 94 bool success,
95 syncer::ModelTypeSet restored_types) OVERRIDE;
95 virtual void OnConnectionStatusChange( 96 virtual void OnConnectionStatusChange(
96 syncer::ConnectionStatus status) OVERRIDE; 97 syncer::ConnectionStatus status) OVERRIDE;
97 virtual void OnPassphraseRequired( 98 virtual void OnPassphraseRequired(
98 syncer::PassphraseRequiredReason reason, 99 syncer::PassphraseRequiredReason reason,
99 const sync_pb::EncryptedData& pending_keys) OVERRIDE; 100 const sync_pb::EncryptedData& pending_keys) OVERRIDE;
100 virtual void OnPassphraseAccepted() OVERRIDE; 101 virtual void OnPassphraseAccepted() OVERRIDE;
101 virtual void OnBootstrapTokenUpdated( 102 virtual void OnBootstrapTokenUpdated(
102 const std::string& bootstrap_token) OVERRIDE; 103 const std::string& bootstrap_token) OVERRIDE;
103 virtual void OnStopSyncingPermanently() OVERRIDE; 104 virtual void OnStopSyncingPermanently() OVERRIDE;
104 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; 105 virtual void OnUpdatedToken(const std::string& token) OVERRIDE;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return scoped_ptr<syncer::HttpPostProviderFactory>( 361 return scoped_ptr<syncer::HttpPostProviderFactory>(
361 new syncer::HttpBridgeFactory(getter, MakeUserAgentForSyncApi())); 362 new syncer::HttpBridgeFactory(getter, MakeUserAgentForSyncApi()));
362 } 363 }
363 364
364 } // namespace 365 } // namespace
365 366
366 void SyncBackendHost::Initialize( 367 void SyncBackendHost::Initialize(
367 SyncFrontend* frontend, 368 SyncFrontend* frontend,
368 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 369 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
369 const GURL& sync_service_url, 370 const GURL& sync_service_url,
370 syncer::ModelTypeSet initial_types,
371 const SyncCredentials& credentials, 371 const SyncCredentials& credentials,
372 bool delete_sync_data_folder, 372 bool delete_sync_data_folder,
373 syncer::SyncManagerFactory* sync_manager_factory, 373 syncer::SyncManagerFactory* sync_manager_factory,
374 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 374 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
375 syncer::ReportUnrecoverableErrorFunction 375 syncer::ReportUnrecoverableErrorFunction
376 report_unrecoverable_error_function) { 376 report_unrecoverable_error_function) {
377 if (!sync_thread_.Start()) 377 if (!sync_thread_.Start())
378 return; 378 return;
379 379
380 chrome_sync_notification_bridge_.reset( 380 chrome_sync_notification_bridge_.reset(
381 new ChromeSyncNotificationBridge( 381 new ChromeSyncNotificationBridge(
382 profile_, sync_thread_.message_loop_proxy())); 382 profile_, sync_thread_.message_loop_proxy()));
383 383
384 frontend_ = frontend; 384 frontend_ = frontend;
385 DCHECK(frontend); 385 DCHECK(frontend);
386 386
387 syncer::ModelTypeSet initial_types_with_nigori(initial_types); 387 registrar_.reset(new SyncBackendRegistrar(name_,
388 CHECK(sync_prefs_.get());
389 if (sync_prefs_->HasSyncSetupCompleted()) {
390 initial_types_with_nigori.Put(syncer::NIGORI);
391 }
392
393 registrar_.reset(new SyncBackendRegistrar(initial_types_with_nigori,
394 name_,
395 profile_, 388 profile_,
396 sync_thread_.message_loop())); 389 sync_thread_.message_loop()));
397 syncer::ModelSafeRoutingInfo routing_info; 390 syncer::ModelSafeRoutingInfo routing_info;
398 std::vector<syncer::ModelSafeWorker*> workers; 391 std::vector<syncer::ModelSafeWorker*> workers;
399 registrar_->GetModelSafeRoutingInfo(&routing_info); 392 registrar_->GetModelSafeRoutingInfo(&routing_info);
400 registrar_->GetWorkers(&workers); 393 registrar_->GetWorkers(&workers);
401 394
402 initialization_state_ = CREATING_SYNC_MANAGER; 395 initialization_state_ = CREATING_SYNC_MANAGER;
403 InitCore(DoInitializeOptions( 396 InitCore(DoInitializeOptions(
404 sync_thread_.message_loop(), 397 sync_thread_.message_loop(),
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 core_ = NULL; // Releases reference to core_. 585 core_ = NULL; // Releases reference to core_.
593 } 586 }
594 587
595 void SyncBackendHost::ConfigureDataTypes( 588 void SyncBackendHost::ConfigureDataTypes(
596 syncer::ConfigureReason reason, 589 syncer::ConfigureReason reason,
597 syncer::ModelTypeSet types_to_add, 590 syncer::ModelTypeSet types_to_add,
598 syncer::ModelTypeSet types_to_remove, 591 syncer::ModelTypeSet types_to_remove,
599 NigoriState nigori_state, 592 NigoriState nigori_state,
600 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, 593 const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
601 const base::Callback<void()>& retry_callback) { 594 const base::Callback<void()>& retry_callback) {
595 // Only one configure is allowed at a time. This is guaranteed by our
596 // callers. The SyncBackendHost requests one configure as the backend is
597 // initializing and waits for it to complete. After initialization, all
598 // configurations will pass through the DataTypeManager, which is careful to
599 // never send a new configure request until the current request succeeds.
600
601 DCHECK_GT(initialization_state_, NOT_INITIALIZED);
602
602 syncer::ModelTypeSet types_to_add_with_nigori = types_to_add; 603 syncer::ModelTypeSet types_to_add_with_nigori = types_to_add;
603 syncer::ModelTypeSet types_to_remove_with_nigori = types_to_remove; 604 syncer::ModelTypeSet types_to_remove_with_nigori = types_to_remove;
604 if (nigori_state == WITH_NIGORI) { 605 if (nigori_state == WITH_NIGORI) {
605 types_to_add_with_nigori.Put(syncer::NIGORI); 606 types_to_add_with_nigori.Put(syncer::NIGORI);
606 types_to_remove_with_nigori.Remove(syncer::NIGORI); 607 types_to_remove_with_nigori.Remove(syncer::NIGORI);
607 } else { 608 } else {
608 types_to_add_with_nigori.Remove(syncer::NIGORI); 609 types_to_add_with_nigori.Remove(syncer::NIGORI);
609 types_to_remove_with_nigori.Put(syncer::NIGORI); 610 types_to_remove_with_nigori.Put(syncer::NIGORI);
610 } 611 }
611 // Only one configure is allowed at a time (DataTypeManager handles user
612 // changes that happen while the syncer is reconfiguring, and will only
613 // trigger another call to ConfigureDataTypes once the current reconfiguration
614 // completes).
615 DCHECK_GT(initialization_state_, NOT_INITIALIZED);
616 612
617 // The new set of enabled types is types_to_add_with_nigori + the 613 // The SyncBackendRegistrar's routing info will be updated by adding the
618 // previously enabled types (on restart, the preferred types are already 614 // types_to_add_with_nigori to the list then removing
619 // enabled) - types_to_remove_with_nigori. After reconfiguring the registrar, 615 // types_to_remove_with_nigori. Any types which are not in either of those
620 // the new routing info will reflect the set of enabled types. 616 // sets will remain untouched.
617 //
618 // Types which were not in the list previously are not fully downloaded, so we
619 // must ask the syncer to download them. Any newly supported datatypes will
620 // not have been in that routing info list, so they will be among the types
621 // downloaded if they are enabled.
622 //
623 // The SyncBackendRegistrar's state was initially derived from the types
624 // marked initial_sync_ended when the sync database was loaded. Afterwards it
625 // is modified only by this function. We expect it to remain in sync with the
626 // backend because configuration requests are never aborted; they are retried
627 // until they succeed or the browser is closed.
628
629 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes(
630 types_to_add_with_nigori, types_to_remove_with_nigori);
631 if (!types_to_download.Empty())
632 types_to_download.Put(syncer::NIGORI);
633
634 // TODO(sync): crbug.com/137550.
635 // It's dangerous to configure types that have progress markers. Types with
636 // progress markers can trigger a MIGRATION_DONE response. We are not
637 // prepared to handle a migration during a configure, so we must ensure that
638 // all our types_to_download actually contain no data before we sync them.
639 //
640 // The most common way to end up in this situation used to be types which had
641 // !initial_sync_ended, but did have some progress markers. We avoid problems
642 // with those types by purging the data of any such partially synced types
643 // soon after we load the directory.
644 //
645 // Another possible scenario is that we have newly supported or newly enabled
646 // data types being downloaded here but the nigori type, which is always
647 // included in any GetUpdates request, requires migration. The server has
648 // code to detect this scenario based on the configure reason, the fact that
649 // the nigori type is the only requested type which requires migration, and
650 // that the requested types list includes at least one non-nigori type. It
651 // will not send a MIGRATION_DONE response in that case. We still need to be
652 // careful to not send progress markers for non-nigori types, though. If a
653 // non-nigori type in the request requires migration, a MIGRATION_DONE
654 // response will be sent.
655
621 syncer::ModelSafeRoutingInfo routing_info; 656 syncer::ModelSafeRoutingInfo routing_info;
622 registrar_->ConfigureDataTypes(types_to_add_with_nigori,
623 types_to_remove_with_nigori);
624 registrar_->GetModelSafeRoutingInfo(&routing_info); 657 registrar_->GetModelSafeRoutingInfo(&routing_info);
625 const syncer::ModelTypeSet enabled_types =
626 GetRoutingInfoTypes(routing_info);
627
628 // Figure out which types need to actually be downloaded. We pass those on
629 // to the syncer while it's in configuration mode so that they can be
630 // downloaded before we perform association. Once we switch to normal mode
631 // downloads will get applied normally and hit the datatype's change
632 // processor.
633 // A datatype is in need of downloading if any of the following are true:
634 // 1. it's enabled and initial_sync_ended is false (initial_sync_ended is
635 // set after applying updates, and hence is a more conservative measure
636 // than having a non-empty progress marker, which is set during
637 // StoreTimestamps).
638 // 2. the type is NIGORI, and any other datatype is being downloaded (nigori
639 // is always included if we download a datatype).
640 // TODO(sync): consider moving this logic onto the sync thread (perhaps
641 // as part of SyncManager::ConfigureSyncer).
642 syncer::ModelTypeSet initial_sync_ended_types =
643 core_->sync_manager()->InitialSyncEndedTypes();
644 initial_sync_ended_types.RetainAll(enabled_types);
645 syncer::ModelTypeSet types_to_config =
646 Difference(enabled_types, initial_sync_ended_types);
647 if (!types_to_config.Empty() && enabled_types.Has(syncer::NIGORI))
648 types_to_config.Put(syncer::NIGORI);
649 658
650 SDVLOG(1) << "Types " 659 SDVLOG(1) << "Types "
651 << syncer::ModelTypeSetToString(types_to_config) 660 << syncer::ModelTypeSetToString(types_to_download)
652 << " added; calling DoConfigureSyncer"; 661 << " added; calling DoConfigureSyncer";
653 // TODO(zea): figure out how to bypass this call if no types are being 662 // TODO(zea): figure out how to bypass this call if no types are being
654 // configured and GetKey is not needed. For now we rely on determining the 663 // configured and GetKey is not needed. For now we rely on determining the
655 // need for GetKey as part of the SyncManager::ConfigureSyncer logic. 664 // need for GetKey as part of the SyncManager::ConfigureSyncer logic.
656 RequestConfigureSyncer(reason, 665 RequestConfigureSyncer(reason,
657 types_to_config, 666 types_to_download,
658 routing_info, 667 routing_info,
659 ready_task, 668 ready_task,
660 retry_callback); 669 retry_callback);
661 } 670 }
662 671
663 void SyncBackendHost::EnableEncryptEverything() { 672 void SyncBackendHost::EnableEncryptEverything() {
664 sync_thread_.message_loop()->PostTask(FROM_HERE, 673 sync_thread_.message_loop()->PostTask(FROM_HERE,
665 base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything, 674 base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything,
666 core_.get())); 675 core_.get()));
667 } 676 }
668 677
669 void SyncBackendHost::ActivateDataType( 678 void SyncBackendHost::ActivateDataType(
670 syncer::ModelType type, syncer::ModelSafeGroup group, 679 syncer::ModelType type, syncer::ModelSafeGroup group,
671 ChangeProcessor* change_processor) { 680 ChangeProcessor* change_processor) {
672 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); 681 registrar_->ActivateDataType(type, group, change_processor, GetUserShare());
673 } 682 }
674 683
675 void SyncBackendHost::DeactivateDataType(syncer::ModelType type) { 684 void SyncBackendHost::DeactivateDataType(syncer::ModelType type) {
676 registrar_->DeactivateDataType(type); 685 registrar_->DeactivateDataType(type);
677 } 686 }
678 687
679 syncer::UserShare* SyncBackendHost::GetUserShare() const { 688 syncer::UserShare* SyncBackendHost::GetUserShare() const {
680 DCHECK(initialized());
681 return core_->sync_manager()->GetUserShare(); 689 return core_->sync_manager()->GetUserShare();
682 } 690 }
683 691
684 SyncBackendHost::Status SyncBackendHost::GetDetailedStatus() { 692 SyncBackendHost::Status SyncBackendHost::GetDetailedStatus() {
685 DCHECK(initialized()); 693 DCHECK(initialized());
686 return core_->sync_manager()->GetDetailedStatus(); 694 return core_->sync_manager()->GetDetailedStatus();
687 } 695 }
688 696
689 SyncSessionSnapshot SyncBackendHost::GetLastSessionSnapshot() const { 697 SyncSessionSnapshot SyncBackendHost::GetLastSessionSnapshot() const {
690 return last_snapshot_; 698 return last_snapshot_;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 772
765 // Notify SyncManager (especially the notification listener) about new types. 773 // Notify SyncManager (especially the notification listener) about new types.
766 sync_thread_.message_loop()->PostTask(FROM_HERE, 774 sync_thread_.message_loop()->PostTask(FROM_HERE,
767 base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get(), 775 base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get(),
768 configured_types)); 776 configured_types));
769 777
770 if (!ready_task.is_null()) 778 if (!ready_task.is_null())
771 ready_task.Run(failed_configuration_types); 779 ready_task.Run(failed_configuration_types);
772 } 780 }
773 781
782 void SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop(
783 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success,
784 syncer::ModelTypeSet restored_types) {
785 registrar_->SetInitialTypes(restored_types);
786 HandleInitializationCompletedOnFrontendLoop(js_backend, success);
787 }
788
774 SyncBackendHost::DoInitializeOptions::DoInitializeOptions( 789 SyncBackendHost::DoInitializeOptions::DoInitializeOptions(
775 MessageLoop* sync_loop, 790 MessageLoop* sync_loop,
776 SyncBackendRegistrar* registrar, 791 SyncBackendRegistrar* registrar,
777 const syncer::ModelSafeRoutingInfo& routing_info, 792 const syncer::ModelSafeRoutingInfo& routing_info,
778 const std::vector<syncer::ModelSafeWorker*>& workers, 793 const std::vector<syncer::ModelSafeWorker*>& workers,
779 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, 794 syncer::ExtensionsActivityMonitor* extensions_activity_monitor,
780 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 795 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
781 const GURL& service_url, 796 const GURL& service_url,
782 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, 797 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn,
783 const syncer::SyncCredentials& credentials, 798 const syncer::SyncCredentials& credentials,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 DCHECK_EQ(MessageLoop::current(), sync_loop_); 850 DCHECK_EQ(MessageLoop::current(), sync_loop_);
836 host_.Call( 851 host_.Call(
837 FROM_HERE, 852 FROM_HERE,
838 &SyncBackendHost::HandleSyncCycleCompletedOnFrontendLoop, 853 &SyncBackendHost::HandleSyncCycleCompletedOnFrontendLoop,
839 snapshot); 854 snapshot);
840 } 855 }
841 856
842 857
843 void SyncBackendHost::Core::OnInitializationComplete( 858 void SyncBackendHost::Core::OnInitializationComplete(
844 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 859 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
845 bool success) { 860 bool success,
861 const syncer::ModelTypeSet restored_types) {
846 DCHECK_EQ(MessageLoop::current(), sync_loop_); 862 DCHECK_EQ(MessageLoop::current(), sync_loop_);
847 host_.Call( 863 host_.Call(
848 FROM_HERE, 864 FROM_HERE,
849 &SyncBackendHost::HandleInitializationCompletedOnFrontendLoop, 865 &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop,
850 js_backend, success); 866 js_backend, success, restored_types);
851 867
852 if (success) { 868 if (success) {
853 // Initialization is complete, so we can schedule recurring SaveChanges. 869 // Initialization is complete, so we can schedule recurring SaveChanges.
854 sync_loop_->PostTask(FROM_HERE, 870 sync_loop_->PostTask(FROM_HERE,
855 base::Bind(&Core::StartSavingChanges, this)); 871 base::Bind(&Core::StartSavingChanges, this));
856 } 872 }
857 } 873 }
858 874
859 void SyncBackendHost::Core::OnConnectionStatusChange( 875 void SyncBackendHost::Core::OnConnectionStatusChange(
860 syncer::ConnectionStatus status) { 876 syncer::ConnectionStatus status) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); 987 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_);
972 sync_manager_->AddObserver(this); 988 sync_manager_->AddObserver(this);
973 success = sync_manager_->Init( 989 success = sync_manager_->Init(
974 sync_data_folder_path_, 990 sync_data_folder_path_,
975 options.event_handler, 991 options.event_handler,
976 options.service_url.host() + options.service_url.path(), 992 options.service_url.host() + options.service_url.path(),
977 options.service_url.EffectiveIntPort(), 993 options.service_url.EffectiveIntPort(),
978 options.service_url.SchemeIsSecure(), 994 options.service_url.SchemeIsSecure(),
979 BrowserThread::GetBlockingPool(), 995 BrowserThread::GetBlockingPool(),
980 options.make_http_bridge_factory_fn.Run().Pass(), 996 options.make_http_bridge_factory_fn.Run().Pass(),
981 options.routing_info,
982 options.workers, 997 options.workers,
983 options.extensions_activity_monitor, 998 options.extensions_activity_monitor,
984 options.registrar /* as SyncManager::ChangeDelegate */, 999 options.registrar /* as SyncManager::ChangeDelegate */,
985 options.credentials, 1000 options.credentials,
986 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier( 1001 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier(
987 options.chrome_sync_notification_bridge, 1002 options.chrome_sync_notification_bridge,
988 options.sync_notifier_factory->CreateSyncNotifier())), 1003 options.sync_notifier_factory->CreateSyncNotifier())),
989 options.restored_key_for_bootstrapping, 1004 options.restored_key_for_bootstrapping,
990 scoped_ptr<InternalComponentsFactory>( 1005 scoped_ptr<InternalComponentsFactory>(
991 options.internal_components_factory), 1006 options.internal_components_factory),
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 initialization_state_ = NOT_INITIALIZED; 1184 initialization_state_ = NOT_INITIALIZED;
1170 1185
1171 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 1186 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
1172 if (!success) { 1187 if (!success) {
1173 initialization_state_ = NOT_INITIALIZED; 1188 initialization_state_ = NOT_INITIALIZED;
1174 frontend_->OnBackendInitialized( 1189 frontend_->OnBackendInitialized(
1175 syncer::WeakHandle<syncer::JsBackend>(), false); 1190 syncer::WeakHandle<syncer::JsBackend>(), false);
1176 return; 1191 return;
1177 } 1192 }
1178 1193
1179 // If setup has completed, start off in DOWNLOADING_NIGORI so that
1180 // we start off by refreshing nigori.
1181 CHECK(sync_prefs_.get());
1182 if (sync_prefs_->HasSyncSetupCompleted() &&
1183 initialization_state_ < DOWNLOADING_NIGORI) {
1184 initialization_state_ = DOWNLOADING_NIGORI;
1185 }
1186
1187 // Run initialization state machine. 1194 // Run initialization state machine.
1188 switch (initialization_state_) { 1195 switch (initialization_state_) {
1189 case NOT_INITIALIZED: 1196 case NOT_INITIALIZED:
1197 // This configuration should result in a download request if the nigori
1198 // type's initial_sync_ended bit is unset. If the download request
1199 // contains progress markers, there is a risk that the server will try to
1200 // trigger migration. That would be disastrous, so we must rely on the
1201 // sync manager to ensure that this type never has both progress markers
1202 // and !initial_sync_ended.
1190 initialization_state_ = DOWNLOADING_NIGORI; 1203 initialization_state_ = DOWNLOADING_NIGORI;
1191 ConfigureDataTypes( 1204 ConfigureDataTypes(
1192 syncer::CONFIGURE_REASON_NEW_CLIENT, 1205 syncer::CONFIGURE_REASON_NEW_CLIENT,
1193 syncer::ModelTypeSet(), 1206 syncer::ModelTypeSet(),
1194 syncer::ModelTypeSet(), 1207 syncer::ModelTypeSet(),
1195 WITH_NIGORI, 1208 WITH_NIGORI,
1196 // Calls back into this function. 1209 // Calls back into this function.
1197 base::Bind( 1210 base::Bind(
1198 &SyncBackendHost:: 1211 &SyncBackendHost::
1199 HandleNigoriConfigurationCompletedOnFrontendLoop, 1212 HandleNigoriConfigurationCompletedOnFrontendLoop,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 FROM_HERE, 1388 FROM_HERE,
1376 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, 1389 base::Bind(&SyncBackendHost::Core::DoRefreshNigori,
1377 core_.get(), sync_thread_done_callback)); 1390 core_.get(), sync_thread_done_callback));
1378 } 1391 }
1379 1392
1380 #undef SDVLOG 1393 #undef SDVLOG
1381 1394
1382 #undef SLOG 1395 #undef SLOG
1383 1396
1384 } // namespace browser_sync 1397 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698