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 "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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 return user_agent; | 345 return user_agent; |
346 } | 346 } |
347 | 347 |
348 user_agent += version_info.Version(); | 348 user_agent += version_info.Version(); |
349 user_agent += " (" + version_info.LastChange() + ")"; | 349 user_agent += " (" + version_info.LastChange() + ")"; |
350 if (!version_info.IsOfficialBuild()) | 350 if (!version_info.IsOfficialBuild()) |
351 user_agent += "-devel"; | 351 user_agent += "-devel"; |
352 return user_agent; | 352 return user_agent; |
353 } | 353 } |
354 | 354 |
355 syncer::HttpPostProviderFactory* MakeHttpBridgeFactory( | 355 scoped_ptr<syncer::HttpPostProviderFactory> MakeHttpBridgeFactory( |
356 const scoped_refptr<net::URLRequestContextGetter>& getter) { | 356 const scoped_refptr<net::URLRequestContextGetter>& getter) { |
357 return new syncer::HttpBridgeFactory(getter, MakeUserAgentForSyncApi()); | 357 return scoped_ptr<syncer::HttpPostProviderFactory>( |
358 new syncer::HttpBridgeFactory(getter, MakeUserAgentForSyncApi())); | |
358 } | 359 } |
359 | 360 |
360 } // namespace | 361 } // namespace |
361 | 362 |
362 void SyncBackendHost::Initialize( | 363 void SyncBackendHost::Initialize( |
363 SyncFrontend* frontend, | 364 SyncFrontend* frontend, |
364 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 365 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
365 const GURL& sync_service_url, | 366 const GURL& sync_service_url, |
366 syncer::ModelTypeSet initial_types, | 367 syncer::ModelTypeSet initial_types, |
367 const SyncCredentials& credentials, | 368 const SyncCredentials& credentials, |
368 bool delete_sync_data_folder, | 369 bool delete_sync_data_folder, |
370 syncer::SyncManagerFactory* sync_manager_factory, | |
369 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, | 371 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, |
370 syncer::ReportUnrecoverableErrorFunction | 372 syncer::ReportUnrecoverableErrorFunction |
371 report_unrecoverable_error_function) { | 373 report_unrecoverable_error_function) { |
372 if (!sync_thread_.Start()) | 374 if (!StartSyncThread()) |
373 return; | 375 return; |
374 | 376 |
375 frontend_ = frontend; | 377 frontend_ = frontend; |
376 DCHECK(frontend); | 378 DCHECK(frontend); |
377 | 379 |
378 syncer::ModelTypeSet initial_types_with_nigori(initial_types); | 380 syncer::ModelTypeSet initial_types_with_nigori(initial_types); |
379 CHECK(sync_prefs_.get()); | 381 CHECK(sync_prefs_.get()); |
380 if (sync_prefs_->HasSyncSetupCompleted()) { | 382 if (sync_prefs_->HasSyncSetupCompleted()) { |
381 initial_types_with_nigori.Put(syncer::NIGORI); | 383 initial_types_with_nigori.Put(syncer::NIGORI); |
382 } | 384 } |
(...skipping 14 matching lines...) Expand all Loading... | |
397 routing_info, | 399 routing_info, |
398 workers, | 400 workers, |
399 &extensions_activity_monitor_, | 401 &extensions_activity_monitor_, |
400 event_handler, | 402 event_handler, |
401 sync_service_url, | 403 sync_service_url, |
402 base::Bind(&MakeHttpBridgeFactory, | 404 base::Bind(&MakeHttpBridgeFactory, |
403 make_scoped_refptr(profile_->GetRequestContext())), | 405 make_scoped_refptr(profile_->GetRequestContext())), |
404 credentials, | 406 credentials, |
405 &chrome_sync_notification_bridge_, | 407 &chrome_sync_notification_bridge_, |
406 &sync_notifier_factory_, | 408 &sync_notifier_factory_, |
409 sync_manager_factory, | |
407 delete_sync_data_folder, | 410 delete_sync_data_folder, |
408 sync_prefs_->GetEncryptionBootstrapToken(), | 411 sync_prefs_->GetEncryptionBootstrapToken(), |
409 syncer::SyncManager::NON_TEST, | 412 syncer::SyncManager::NON_TEST, |
410 unrecoverable_error_handler, | 413 unrecoverable_error_handler, |
411 report_unrecoverable_error_function)); | 414 report_unrecoverable_error_function)); |
412 } | 415 } |
413 | 416 |
414 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { | 417 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { |
415 sync_thread_.message_loop()->PostTask(FROM_HERE, | 418 sync_thread_.message_loop()->PostTask(FROM_HERE, |
416 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), | 419 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 syncer::ModelTypeSet types_to_add_with_nigori = types_to_add; | 594 syncer::ModelTypeSet types_to_add_with_nigori = types_to_add; |
592 syncer::ModelTypeSet types_to_remove_with_nigori = types_to_remove; | 595 syncer::ModelTypeSet types_to_remove_with_nigori = types_to_remove; |
593 if (nigori_state == WITH_NIGORI) { | 596 if (nigori_state == WITH_NIGORI) { |
594 types_to_add_with_nigori.Put(syncer::NIGORI); | 597 types_to_add_with_nigori.Put(syncer::NIGORI); |
595 types_to_remove_with_nigori.Remove(syncer::NIGORI); | 598 types_to_remove_with_nigori.Remove(syncer::NIGORI); |
596 } else { | 599 } else { |
597 types_to_add_with_nigori.Remove(syncer::NIGORI); | 600 types_to_add_with_nigori.Remove(syncer::NIGORI); |
598 types_to_remove_with_nigori.Put(syncer::NIGORI); | 601 types_to_remove_with_nigori.Put(syncer::NIGORI); |
599 } | 602 } |
600 // Only one configure is allowed at a time (DataTypeManager handles user | 603 // Only one configure is allowed at a time (DataTypeManager handles user |
601 // changes that happen while the syncer is reconfiguraing, and will only | 604 // changes that happen while the syncer is reconfiguring, and will only |
602 // trigger another call to ConfigureDataTypes once the current reconfiguration | 605 // trigger another call to ConfigureDataTypes once the current reconfiguration |
603 // completes). | 606 // completes). |
604 DCHECK_GT(initialization_state_, NOT_INITIALIZED); | 607 DCHECK_GT(initialization_state_, NOT_INITIALIZED); |
605 | 608 |
606 // The new set of enabled types is types_to_add_with_nigori + the | 609 // The new set of enabled types is types_to_add_with_nigori + the |
607 // previously enabled types (on restart, the preferred types are already | 610 // previously enabled types (on restart, the preferred types are already |
608 // enabled) - types_to_remove_with_nigori. After reconfiguring the registrar, | 611 // enabled) - types_to_remove_with_nigori. After reconfiguring the registrar, |
609 // the new routing info will reflect the set of enabled types. | 612 // the new routing info will reflect the set of enabled types. |
610 syncer::ModelSafeRoutingInfo routing_info; | 613 syncer::ModelSafeRoutingInfo routing_info; |
611 registrar_->ConfigureDataTypes(types_to_add_with_nigori, | 614 registrar_->ConfigureDataTypes(types_to_add_with_nigori, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
705 void SyncBackendHost::GetModelSafeRoutingInfo( | 708 void SyncBackendHost::GetModelSafeRoutingInfo( |
706 syncer::ModelSafeRoutingInfo* out) const { | 709 syncer::ModelSafeRoutingInfo* out) const { |
707 if (initialized()) { | 710 if (initialized()) { |
708 CHECK(registrar_.get()); | 711 CHECK(registrar_.get()); |
709 registrar_->GetModelSafeRoutingInfo(out); | 712 registrar_->GetModelSafeRoutingInfo(out); |
710 } else { | 713 } else { |
711 NOTREACHED(); | 714 NOTREACHED(); |
712 } | 715 } |
713 } | 716 } |
714 | 717 |
718 bool SyncBackendHost::StartSyncThread() { | |
719 if (!sync_thread_.IsRunning()) | |
720 return sync_thread_.Start(); | |
721 return true; | |
722 } | |
723 | |
715 void SyncBackendHost::InitCore(const DoInitializeOptions& options) { | 724 void SyncBackendHost::InitCore(const DoInitializeOptions& options) { |
716 sync_thread_.message_loop()->PostTask(FROM_HERE, | 725 sync_thread_.message_loop()->PostTask(FROM_HERE, |
717 base::Bind(&SyncBackendHost::Core::DoInitialize, core_.get(), options)); | 726 base::Bind(&SyncBackendHost::Core::DoInitialize, core_.get(), options)); |
718 } | 727 } |
719 | 728 |
720 void SyncBackendHost::RequestConfigureSyncer( | 729 void SyncBackendHost::RequestConfigureSyncer( |
721 syncer::ConfigureReason reason, | 730 syncer::ConfigureReason reason, |
722 syncer::ModelTypeSet types_to_config, | 731 syncer::ModelTypeSet types_to_config, |
723 const syncer::ModelSafeRoutingInfo& routing_info, | 732 const syncer::ModelSafeRoutingInfo& routing_info, |
724 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, | 733 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 SyncBackendRegistrar* registrar, | 774 SyncBackendRegistrar* registrar, |
766 const syncer::ModelSafeRoutingInfo& routing_info, | 775 const syncer::ModelSafeRoutingInfo& routing_info, |
767 const std::vector<syncer::ModelSafeWorker*>& workers, | 776 const std::vector<syncer::ModelSafeWorker*>& workers, |
768 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, | 777 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
769 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 778 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
770 const GURL& service_url, | 779 const GURL& service_url, |
771 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, | 780 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, |
772 const syncer::SyncCredentials& credentials, | 781 const syncer::SyncCredentials& credentials, |
773 ChromeSyncNotificationBridge* chrome_sync_notification_bridge, | 782 ChromeSyncNotificationBridge* chrome_sync_notification_bridge, |
774 syncer::SyncNotifierFactory* sync_notifier_factory, | 783 syncer::SyncNotifierFactory* sync_notifier_factory, |
784 syncer::SyncManagerFactory* sync_manager_factory, | |
775 bool delete_sync_data_folder, | 785 bool delete_sync_data_folder, |
776 const std::string& restored_key_for_bootstrapping, | 786 const std::string& restored_key_for_bootstrapping, |
777 syncer::SyncManager::TestingMode testing_mode, | 787 syncer::SyncManager::TestingMode testing_mode, |
778 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, | 788 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, |
779 syncer::ReportUnrecoverableErrorFunction | 789 syncer::ReportUnrecoverableErrorFunction |
780 report_unrecoverable_error_function) | 790 report_unrecoverable_error_function) |
781 : sync_loop(sync_loop), | 791 : sync_loop(sync_loop), |
782 registrar(registrar), | 792 registrar(registrar), |
783 routing_info(routing_info), | 793 routing_info(routing_info), |
784 workers(workers), | 794 workers(workers), |
785 extensions_activity_monitor(extensions_activity_monitor), | 795 extensions_activity_monitor(extensions_activity_monitor), |
786 event_handler(event_handler), | 796 event_handler(event_handler), |
787 service_url(service_url), | 797 service_url(service_url), |
788 make_http_bridge_factory_fn(make_http_bridge_factory_fn), | 798 make_http_bridge_factory_fn(make_http_bridge_factory_fn), |
789 credentials(credentials), | 799 credentials(credentials), |
790 chrome_sync_notification_bridge(chrome_sync_notification_bridge), | 800 chrome_sync_notification_bridge(chrome_sync_notification_bridge), |
791 sync_notifier_factory(sync_notifier_factory), | 801 sync_notifier_factory(sync_notifier_factory), |
802 sync_manager_factory(sync_manager_factory), | |
792 delete_sync_data_folder(delete_sync_data_folder), | 803 delete_sync_data_folder(delete_sync_data_folder), |
793 restored_key_for_bootstrapping(restored_key_for_bootstrapping), | 804 restored_key_for_bootstrapping(restored_key_for_bootstrapping), |
794 testing_mode(testing_mode), | 805 testing_mode(testing_mode), |
795 unrecoverable_error_handler(unrecoverable_error_handler), | 806 unrecoverable_error_handler(unrecoverable_error_handler), |
796 report_unrecoverable_error_function( | 807 report_unrecoverable_error_function( |
797 report_unrecoverable_error_function) { | 808 report_unrecoverable_error_function) { |
798 } | 809 } |
799 | 810 |
800 SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {} | 811 SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {} |
801 | 812 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 | 959 |
949 // Make sure that the directory exists before initializing the backend. | 960 // Make sure that the directory exists before initializing the backend. |
950 // If it already exists, this will do no harm. | 961 // If it already exists, this will do no harm. |
951 bool success = file_util::CreateDirectory(sync_data_folder_path_); | 962 bool success = file_util::CreateDirectory(sync_data_folder_path_); |
952 DCHECK(success); | 963 DCHECK(success); |
953 | 964 |
954 DCHECK(!registrar_); | 965 DCHECK(!registrar_); |
955 registrar_ = options.registrar; | 966 registrar_ = options.registrar; |
956 DCHECK(registrar_); | 967 DCHECK(registrar_); |
957 | 968 |
958 sync_manager_.reset(new syncer::SyncManager(name_)); | 969 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); |
959 sync_manager_->AddObserver(this); | 970 sync_manager_->AddObserver(this); |
960 success = sync_manager_->Init( | 971 success = sync_manager_->Init( |
961 sync_data_folder_path_, | 972 sync_data_folder_path_, |
962 options.event_handler, | 973 options.event_handler, |
963 options.service_url.host() + options.service_url.path(), | 974 options.service_url.host() + options.service_url.path(), |
964 options.service_url.EffectiveIntPort(), | 975 options.service_url.EffectiveIntPort(), |
965 options.service_url.SchemeIsSecure(), | 976 options.service_url.SchemeIsSecure(), |
966 BrowserThread::GetBlockingPool(), | 977 BrowserThread::GetBlockingPool(), |
967 options.make_http_bridge_factory_fn.Run(), | 978 options.make_http_bridge_factory_fn.Run().Pass(), |
968 options.routing_info, | 979 options.routing_info, |
969 options.workers, | 980 options.workers, |
970 options.extensions_activity_monitor, | 981 options.extensions_activity_monitor, |
971 options.registrar /* as SyncManager::ChangeDelegate */, | 982 options.registrar /* as SyncManager::ChangeDelegate */, |
972 options.credentials, | 983 options.credentials, |
973 new BridgedSyncNotifier( | 984 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier( |
974 options.chrome_sync_notification_bridge, | 985 options.chrome_sync_notification_bridge, |
975 options.sync_notifier_factory->CreateSyncNotifier()), | 986 options.sync_notifier_factory->CreateSyncNotifier())), |
976 options.restored_key_for_bootstrapping, | 987 options.restored_key_for_bootstrapping, |
977 options.testing_mode, | 988 options.testing_mode, |
978 &encryptor_, | 989 &encryptor_, |
979 options.unrecoverable_error_handler, | 990 options.unrecoverable_error_handler, |
980 options.report_unrecoverable_error_function); | 991 options.report_unrecoverable_error_function); |
981 LOG_IF(ERROR, !success) << "Syncapi initialization failed!"; | 992 LOG_IF(ERROR, !success) << "Syncapi initialization failed!"; |
982 | 993 |
983 // Now check the command line to see if we need to simulate an | 994 // Now check the command line to see if we need to simulate an |
984 // unrecoverable error for testing purpose. Note the error is thrown | 995 // unrecoverable error for testing purpose. Note the error is thrown |
985 // only if the initialization succeeded. Also it makes sense to use this | 996 // only if the initialization succeeded. Also it makes sense to use this |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1136 } | 1147 } |
1137 | 1148 |
1138 void SyncBackendHost::OnNigoriDownloadRetry() { | 1149 void SyncBackendHost::OnNigoriDownloadRetry() { |
1139 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1150 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1140 if (!frontend_) | 1151 if (!frontend_) |
1141 return; | 1152 return; |
1142 | 1153 |
1143 frontend_->OnSyncConfigureRetry(); | 1154 frontend_->OnSyncConfigureRetry(); |
1144 } | 1155 } |
1145 | 1156 |
1157 namespace { | |
1158 | |
1159 syncer::ModelTypeSet GetPartiallySyncedTypes( | |
1160 syncer::SyncManager* sync_manager) { | |
1161 syncer::ModelTypeSet partially_synced_types = | |
rlarocque
2012/07/09 19:22:58
This indentation doesn't look right.
Nicolas Zea
2012/07/09 19:42:50
Done.
| |
1162 syncer::ModelTypeSet::All(); | |
1163 partially_synced_types.RemoveAll(sync_manager->InitialSyncEndedTypes()); | |
1164 partially_synced_types.RemoveAll( | |
1165 sync_manager->GetTypesWithEmptyProgressMarkerToken( | |
1166 syncer::ModelTypeSet::All())); | |
1167 return partially_synced_types; | |
1168 } | |
1169 | |
1170 } // namespace | |
1171 | |
1146 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( | 1172 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( |
1147 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { | 1173 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { |
1148 DCHECK_NE(NOT_ATTEMPTED, initialization_state_); | 1174 DCHECK_NE(NOT_ATTEMPTED, initialization_state_); |
1149 if (!frontend_) | 1175 if (!frontend_) |
1150 return; | 1176 return; |
1151 | 1177 |
1152 // We've at least created the sync manager at this point, but if that is all | 1178 // We've at least created the sync manager at this point, but if that is all |
1153 // we've done we're just beginning the initialization process. | 1179 // we've done we're just beginning the initialization process. |
1154 if (initialization_state_ == CREATING_SYNC_MANAGER) | 1180 if (initialization_state_ == CREATING_SYNC_MANAGER) |
1155 initialization_state_ = NOT_INITIALIZED; | 1181 initialization_state_ = NOT_INITIALIZED; |
1156 | 1182 |
1157 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1183 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1158 if (!success) { | 1184 if (!success) { |
1159 initialization_state_ = NOT_INITIALIZED; | 1185 initialization_state_ = NOT_INITIALIZED; |
1160 frontend_->OnBackendInitialized( | 1186 frontend_->OnBackendInitialized( |
1161 syncer::WeakHandle<syncer::JsBackend>(), false); | 1187 syncer::WeakHandle<syncer::JsBackend>(), false); |
1162 return; | 1188 return; |
1163 } | 1189 } |
1164 | 1190 |
1165 // Run initialization state machine. | 1191 // Run initialization state machine. |
1166 switch (initialization_state_) { | 1192 switch (initialization_state_) { |
1167 case NOT_INITIALIZED: | 1193 case NOT_INITIALIZED: { |
1194 NigoriState nigori_state; | |
1195 syncer::ModelTypeSet partially_synced_types = GetPartiallySyncedTypes( | |
1196 core_->sync_manager()); | |
1197 | |
1198 // Although it's possible for any type to be in a partially downloaded | |
1199 // state, we only care about nigori as it's the only one we download | |
1200 // before the backend is fully initialized. Other types will be | |
1201 // re-downloaded at configuration time, at which point we can handle | |
1202 // migrations and other events. | |
1203 UMA_HISTOGRAM_COUNTS("Sync.PartiallySyncedTypes", | |
1204 partially_synced_types.Size()); | |
1205 | |
1206 if (partially_synced_types.Has(syncer::NIGORI)) { | |
1207 // Configure without nigori to force it to be cleaned ( | |
1208 // SyncBackendRegistrar will remove nigori from routing info as part | |
1209 // of the configuration). | |
1210 nigori_state = WITHOUT_NIGORI; | |
1211 initialization_state_ = CLEANING_NIGORI; | |
1212 } else { | |
1213 // Normal configuration. Will do nothing if the nigori is already | |
1214 // downloaded and applied. | |
1215 nigori_state = WITH_NIGORI; | |
1216 initialization_state_ = DOWNLOADING_NIGORI; | |
1217 } | |
1218 ConfigureDataTypes( | |
rlarocque
2012/07/09 19:22:58
I don't like the nigori_state variable, or the fac
Nicolas Zea
2012/07/09 19:42:50
Can you be more specific about what you dislike? T
rlarocque
2012/07/09 20:30:22
Resolved offline.
The summary is that I wanted to
| |
1219 syncer::CONFIGURE_REASON_NEW_CLIENT, | |
1220 syncer::ModelTypeSet(), | |
1221 syncer::ModelTypeSet(), | |
1222 nigori_state, | |
1223 // Calls back into this function. | |
1224 base::Bind( | |
1225 &SyncBackendHost:: | |
1226 HandleNigoriConfigurationCompletedOnFrontendLoop, | |
1227 weak_ptr_factory_.GetWeakPtr(), js_backend), | |
1228 base::Bind(&SyncBackendHost::OnNigoriDownloadRetry, | |
1229 weak_ptr_factory_.GetWeakPtr())); | |
1230 break; | |
1231 } | |
1232 case CLEANING_NIGORI: { | |
1233 syncer::ModelTypeSet partially_synced_types = GetPartiallySyncedTypes( | |
1234 core_->sync_manager()); | |
1235 if (partially_synced_types.Has(syncer::NIGORI)) { | |
1236 // We apparently failed to clean the nigori somehow. Attempting | |
1237 // to continue could lead to crashes (see bug 133219), so we fail | |
1238 // gracefully instead by triggering an unrecoverable error. | |
1239 LOG(ERROR) << "Failed to cleanup partial nigori."; | |
1240 initialization_state_ = NOT_INITIALIZED; | |
1241 frontend_->OnBackendInitialized( | |
1242 syncer::WeakHandle<syncer::JsBackend>(), false); | |
1243 return; | |
1244 } | |
1245 | |
1168 initialization_state_ = DOWNLOADING_NIGORI; | 1246 initialization_state_ = DOWNLOADING_NIGORI; |
1169 ConfigureDataTypes( | 1247 ConfigureDataTypes( |
1170 syncer::CONFIGURE_REASON_NEW_CLIENT, | 1248 syncer::CONFIGURE_REASON_NEW_CLIENT, |
1171 syncer::ModelTypeSet(), | 1249 syncer::ModelTypeSet(), |
1172 syncer::ModelTypeSet(), | 1250 syncer::ModelTypeSet(), |
1173 WITH_NIGORI, | 1251 WITH_NIGORI, |
1174 // Calls back into this function. | 1252 // Calls back into this function. |
1175 base::Bind( | 1253 base::Bind( |
1176 &SyncBackendHost:: | 1254 &SyncBackendHost:: |
1177 HandleNigoriConfigurationCompletedOnFrontendLoop, | 1255 HandleNigoriConfigurationCompletedOnFrontendLoop, |
1178 weak_ptr_factory_.GetWeakPtr(), js_backend), | 1256 weak_ptr_factory_.GetWeakPtr(), js_backend), |
1179 base::Bind(&SyncBackendHost::OnNigoriDownloadRetry, | 1257 base::Bind(&SyncBackendHost::OnNigoriDownloadRetry, |
1180 weak_ptr_factory_.GetWeakPtr())); | 1258 weak_ptr_factory_.GetWeakPtr())); |
1181 break; | 1259 break; |
1260 } | |
1182 case DOWNLOADING_NIGORI: | 1261 case DOWNLOADING_NIGORI: |
1183 initialization_state_ = REFRESHING_NIGORI; | 1262 initialization_state_ = REFRESHING_NIGORI; |
1184 // Triggers OnEncryptedTypesChanged() and OnEncryptionComplete() | 1263 // Triggers OnEncryptedTypesChanged() and OnEncryptionComplete() |
1185 // if necessary. | 1264 // if necessary. |
1186 RefreshNigori( | 1265 RefreshNigori( |
1187 base::Bind( | 1266 base::Bind( |
1188 &SyncBackendHost:: | 1267 &SyncBackendHost:: |
1189 HandleInitializationCompletedOnFrontendLoop, | 1268 HandleInitializationCompletedOnFrontendLoop, |
1190 weak_ptr_factory_.GetWeakPtr(), js_backend, true)); | 1269 weak_ptr_factory_.GetWeakPtr(), js_backend, true)); |
1191 break; | 1270 break; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1353 FROM_HERE, | 1432 FROM_HERE, |
1354 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, | 1433 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, |
1355 core_.get(), sync_thread_done_callback)); | 1434 core_.get(), sync_thread_done_callback)); |
1356 } | 1435 } |
1357 | 1436 |
1358 #undef SDVLOG | 1437 #undef SDVLOG |
1359 | 1438 |
1360 #undef SLOG | 1439 #undef SLOG |
1361 | 1440 |
1362 } // namespace browser_sync | 1441 } // namespace browser_sync |
OLD | NEW |