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

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

Issue 10824252: Revert 150990 - [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // a final SaveChanges, and close sqlite handles. 163 // a final SaveChanges, and close sqlite handles.
164 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is 164 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is
165 // a blocking call). This causes syncapi thread-exit handlers 165 // a blocking call). This causes syncapi thread-exit handlers
166 // to run and make use of cached pointers to various components 166 // to run and make use of cached pointers to various components
167 // owned implicitly by us. 167 // owned implicitly by us.
168 // 3) Destroy this Core. That will delete syncapi components in a 168 // 3) Destroy this Core. That will delete syncapi components in a
169 // safe order because the thread that was using them has exited 169 // safe order because the thread that was using them has exited
170 // (in step 2). 170 // (in step 2).
171 void DoStopSyncManagerForShutdown(const base::Closure& closure); 171 void DoStopSyncManagerForShutdown(const base::Closure& closure);
172 void DoShutdown(bool stopping_sync); 172 void DoShutdown(bool stopping_sync);
173 void DoDestroySyncManager();
174 173
175 // Configuration methods that must execute on sync loop. 174 // Configuration methods that must execute on sync loop.
176 void DoConfigureSyncer( 175 void DoConfigureSyncer(
177 syncer::ConfigureReason reason, 176 syncer::ConfigureReason reason,
178 syncer::ModelTypeSet types_to_config, 177 syncer::ModelTypeSet types_to_config,
179 const syncer::ModelSafeRoutingInfo routing_info, 178 const syncer::ModelSafeRoutingInfo routing_info,
180 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, 179 const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
181 const base::Closure& retry_callback); 180 const base::Closure& retry_callback);
182 void DoFinishConfigureDataTypes( 181 void DoFinishConfigureDataTypes(
183 syncer::ModelTypeSet types_to_config, 182 syncer::ModelTypeSet types_to_config,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 238
240 // The timer used to periodically call SaveChanges. 239 // The timer used to periodically call SaveChanges.
241 scoped_ptr<base::RepeatingTimer<Core> > save_changes_timer_; 240 scoped_ptr<base::RepeatingTimer<Core> > save_changes_timer_;
242 241
243 // Our encryptor, which uses Chrome's encryption functions. 242 // Our encryptor, which uses Chrome's encryption functions.
244 ChromeEncryptor encryptor_; 243 ChromeEncryptor encryptor_;
245 244
246 // The top-level syncapi entry point. Lives on the sync thread. 245 // The top-level syncapi entry point. Lives on the sync thread.
247 scoped_ptr<syncer::SyncManager> sync_manager_; 246 scoped_ptr<syncer::SyncManager> sync_manager_;
248 247
249 // Whether or not we registered with |sync_manager_| as an invalidation
250 // handler. Necessary since we may end up trying to unregister before we
251 // register in tests (in synchronous initialization mode).
252 //
253 // TODO(akalin): Fix this behavior (see http://crbug.com/140354).
254 bool registered_as_invalidation_handler_;
255
256 DISALLOW_COPY_AND_ASSIGN(Core); 248 DISALLOW_COPY_AND_ASSIGN(Core);
257 }; 249 };
258 250
259 namespace { 251 namespace {
260 252
261 // Parses the given command line for notifier options. 253 // Parses the given command line for notifier options.
262 notifier::NotifierOptions ParseNotifierOptions( 254 notifier::NotifierOptions ParseNotifierOptions(
263 const CommandLine& command_line, 255 const CommandLine& command_line,
264 const scoped_refptr<net::URLRequestContextGetter>& 256 const scoped_refptr<net::URLRequestContextGetter>&
265 request_context_getter) { 257 request_context_getter) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 &SyncBackendHost::Core::DoStopSyncManagerForShutdown, 534 &SyncBackendHost::Core::DoStopSyncManagerForShutdown,
543 core_.get(), 535 core_.get(),
544 closure)); 536 closure));
545 } else { 537 } else {
546 core_->DoStopSyncManagerForShutdown(closure); 538 core_->DoStopSyncManagerForShutdown(closure);
547 } 539 }
548 } 540 }
549 541
550 void SyncBackendHost::StopSyncingForShutdown() { 542 void SyncBackendHost::StopSyncingForShutdown() {
551 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 543 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
552
553 // Immediately stop sending messages to the frontend.
554 frontend_ = NULL;
555
556 // Thread shutdown should occur in the following order: 544 // Thread shutdown should occur in the following order:
557 // - Sync Thread 545 // - Sync Thread
558 // - UI Thread (stops some time after we return from this call). 546 // - UI Thread (stops some time after we return from this call).
559 // 547 //
560 // In order to achieve this, we first shutdown components from the UI thread 548 // In order to acheive this, we first shutdown components from the UI thread
561 // and send signals to abort components that may be busy on the sync thread. 549 // and send signals to abort components that may be busy on the sync thread.
562 // The callback (OnSyncerShutdownComplete) will happen on the sync thread, 550 // The callback (OnSyncerShutdownComplete) will happen on the sync thread,
563 // after which we'll shutdown components on the sync thread, and then be 551 // after which we'll shutdown components on the sync thread, and then be
564 // able to stop the sync loop. 552 // able to stop the sync loop.
565 if (sync_thread_.IsRunning()) { 553 if (sync_thread_.IsRunning()) {
566 StopSyncManagerForShutdown( 554 StopSyncManagerForShutdown(
567 base::Bind(&SyncBackendRegistrar::OnSyncerShutdownComplete, 555 base::Bind(&SyncBackendRegistrar::OnSyncerShutdownComplete,
568 base::Unretained(registrar_.get()))); 556 base::Unretained(registrar_.get())));
569 557
570 // Before joining the sync_thread_, we wait for the UIModelWorker to 558 // Before joining the sync_thread_, we wait for the UIModelWorker to
571 // give us the green light that it is not depending on the frontend_loop_ 559 // give us the green light that it is not depending on the frontend_loop_
572 // to process any more tasks. Stop() blocks until this termination 560 // to process any more tasks. Stop() blocks until this termination
573 // condition is true. 561 // condition is true.
574 base::Time stop_registrar_start_time = base::Time::Now(); 562 base::Time stop_registrar_start_time = base::Time::Now();
575 if (registrar_.get()) 563 if (registrar_.get())
576 registrar_->StopOnUIThread(); 564 registrar_->StopOnUIThread();
577 base::TimeDelta stop_registrar_time = base::Time::Now() - 565 base::TimeDelta stop_registrar_time = base::Time::Now() -
578 stop_registrar_start_time; 566 stop_registrar_start_time;
579 UMA_HISTOGRAM_TIMES("Sync.Shutdown.StopRegistrarTime", 567 UMA_HISTOGRAM_TIMES("Sync.Shutdown.StopRegistrarTime",
580 stop_registrar_time); 568 stop_registrar_time);
581 } else { 569 } else {
582 // If the sync thread isn't running, then the syncer is effectively 570 // If the sync thread isn't running, then the syncer is effectively
583 // stopped. Moreover, it implies that we never attempted initialization, 571 // stopped. Moreover, it implies that we never attempted initialization,
584 // so the registrar won't need stopping either. 572 // so the registrar won't need stopping either.
585 DCHECK_EQ(initialization_state_, NOT_ATTEMPTED); 573 DCHECK_EQ(NOT_ATTEMPTED, initialization_state_);
586 DCHECK(!registrar_.get()); 574 DCHECK(!registrar_.get());
587 } 575 }
588 } 576 }
589 577
590 void SyncBackendHost::Shutdown(bool sync_disabled) { 578 void SyncBackendHost::Shutdown(bool sync_disabled) {
591 // StopSyncingForShutdown() (which nulls out |frontend_|) should be
592 // called first.
593 DCHECK(!frontend_);
594 // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice. 579 // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice.
595 if (sync_thread_.IsRunning()) { 580 if (sync_thread_.IsRunning()) {
596 sync_thread_.message_loop()->PostTask(FROM_HERE, 581 sync_thread_.message_loop()->PostTask(FROM_HERE,
597 base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(), 582 base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(),
598 sync_disabled)); 583 sync_disabled));
599
600 if (chrome_sync_notification_bridge_.get())
601 chrome_sync_notification_bridge_->StopForShutdown();
602 } 584 }
603 585
604 // Stop will return once the thread exits, which will be after DoShutdown 586 // Stop will return once the thread exits, which will be after DoShutdown
605 // runs. DoShutdown needs to run from sync_thread_ because the sync backend 587 // runs. DoShutdown needs to run from sync_thread_ because the sync backend
606 // requires any thread that opened sqlite handles to relinquish them 588 // requires any thread that opened sqlite handles to relinquish them
607 // personally. We need to join threads, because otherwise the main Chrome 589 // personally. We need to join threads, because otherwise the main Chrome
608 // thread (ui loop) can exit before DoShutdown finishes, at which point 590 // thread (ui loop) can exit before DoShutdown finishes, at which point
609 // virtually anything the sync backend does (or the post-back to 591 // virtually anything the sync backend does (or the post-back to
610 // frontend_loop_ by our Core) will epically fail because the CRT won't be 592 // frontend_loop_ by our Core) will epically fail because the CRT won't be
611 // initialized. 593 // initialized.
612 // Since we are blocking the UI thread here, we need to turn ourselves in 594 // Since we are blocking the UI thread here, we need to turn ourselves in
613 // with the ThreadRestriction police. For sentencing and how we plan to fix 595 // with the ThreadRestriction police. For sentencing and how we plan to fix
614 // this, see bug 19757. 596 // this, see bug 19757.
615 base::Time stop_thread_start_time = base::Time::Now(); 597 base::Time stop_thread_start_time = base::Time::Now();
616 { 598 {
617 base::ThreadRestrictions::ScopedAllowIO allow_io; 599 base::ThreadRestrictions::ScopedAllowIO allow_io;
618 sync_thread_.Stop(); 600 sync_thread_.Stop();
619 } 601 }
620 base::TimeDelta stop_sync_thread_time = base::Time::Now() - 602 base::TimeDelta stop_sync_thread_time = base::Time::Now() -
621 stop_thread_start_time; 603 stop_thread_start_time;
622 UMA_HISTOGRAM_TIMES("Sync.Shutdown.StopSyncThreadTime", 604 UMA_HISTOGRAM_TIMES("Sync.Shutdown.StopSyncThreadTime",
623 stop_sync_thread_time); 605 stop_sync_thread_time);
624 606
625 registrar_.reset(); 607 registrar_.reset();
608 frontend_ = NULL;
626 chrome_sync_notification_bridge_.reset(); 609 chrome_sync_notification_bridge_.reset();
627 core_ = NULL; // Releases reference to core_. 610 core_ = NULL; // Releases reference to core_.
628 } 611 }
629 612
630 void SyncBackendHost::ConfigureDataTypes( 613 void SyncBackendHost::ConfigureDataTypes(
631 syncer::ConfigureReason reason, 614 syncer::ConfigureReason reason,
632 syncer::ModelTypeSet types_to_add, 615 syncer::ModelTypeSet types_to_add,
633 syncer::ModelTypeSet types_to_remove, 616 syncer::ModelTypeSet types_to_remove,
634 NigoriState nigori_state, 617 NigoriState nigori_state,
635 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, 618 const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {} 839 SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {}
857 840
858 SyncBackendHost::Core::Core(const std::string& name, 841 SyncBackendHost::Core::Core(const std::string& name,
859 const FilePath& sync_data_folder_path, 842 const FilePath& sync_data_folder_path,
860 const base::WeakPtr<SyncBackendHost>& backend) 843 const base::WeakPtr<SyncBackendHost>& backend)
861 : name_(name), 844 : name_(name),
862 sync_data_folder_path_(sync_data_folder_path), 845 sync_data_folder_path_(sync_data_folder_path),
863 host_(backend), 846 host_(backend),
864 sync_loop_(NULL), 847 sync_loop_(NULL),
865 registrar_(NULL), 848 registrar_(NULL),
866 chrome_sync_notification_bridge_(NULL), 849 chrome_sync_notification_bridge_(NULL) {
867 registered_as_invalidation_handler_(false) {
868 DCHECK(backend.get()); 850 DCHECK(backend.get());
869 } 851 }
870 852
871 SyncBackendHost::Core::~Core() { 853 SyncBackendHost::Core::~Core() {
872 DCHECK(!sync_manager_.get()); 854 DCHECK(!sync_manager_.get());
873 DCHECK(!sync_loop_); 855 DCHECK(!sync_loop_);
874 } 856 }
875 857
876 void SyncBackendHost::Core::OnSyncCycleCompleted( 858 void SyncBackendHost::Core::OnSyncCycleCompleted(
877 const SyncSessionSnapshot& snapshot) { 859 const SyncSessionSnapshot& snapshot) {
(...skipping 25 matching lines...) Expand all
903 } 885 }
904 886
905 887
906 void SyncBackendHost::Core::OnInitializationComplete( 888 void SyncBackendHost::Core::OnInitializationComplete(
907 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 889 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
908 bool success, 890 bool success,
909 const syncer::ModelTypeSet restored_types) { 891 const syncer::ModelTypeSet restored_types) {
910 DCHECK_EQ(MessageLoop::current(), sync_loop_); 892 DCHECK_EQ(MessageLoop::current(), sync_loop_);
911 893
912 if (!success) { 894 if (!success) {
913 DoDestroySyncManager(); 895 sync_manager_->RemoveObserver(this);
896 sync_manager_->UpdateRegisteredInvalidationIds(
897 this, syncer::ObjectIdSet());
898 sync_manager_->ShutdownOnSyncThread();
899 sync_manager_.reset();
914 } 900 }
915 901
916 host_.Call( 902 host_.Call(
917 FROM_HERE, 903 FROM_HERE,
918 &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop, 904 &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop,
919 js_backend, success, restored_types); 905 js_backend, success, restored_types);
920 906
921 if (success) { 907 if (success) {
922 // Initialization is complete, so we can schedule recurring SaveChanges. 908 // Initialization is complete, so we can schedule recurring SaveChanges.
923 sync_loop_->PostTask(FROM_HERE, 909 sync_loop_->PostTask(FROM_HERE,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 options.restored_key_for_bootstrapping, 1078 options.restored_key_for_bootstrapping,
1093 options.restored_keystore_key_for_bootstrapping, 1079 options.restored_keystore_key_for_bootstrapping,
1094 CommandLine::ForCurrentProcess()->HasSwitch( 1080 CommandLine::ForCurrentProcess()->HasSwitch(
1095 switches::kSyncKeystoreEncryption), 1081 switches::kSyncKeystoreEncryption),
1096 scoped_ptr<InternalComponentsFactory>( 1082 scoped_ptr<InternalComponentsFactory>(
1097 options.internal_components_factory), 1083 options.internal_components_factory),
1098 &encryptor_, 1084 &encryptor_,
1099 options.unrecoverable_error_handler, 1085 options.unrecoverable_error_handler,
1100 options.report_unrecoverable_error_function); 1086 options.report_unrecoverable_error_function);
1101 1087
1102 // |sync_manager_| may end up being NULL here in tests (in 1088 // Now check the command line to see if we need to simulate an
1103 // synchronous initialization mode). 1089 // unrecoverable error for testing purpose. Note the error is thrown
1104 // 1090 // only if the initialization succeeded. Also it makes sense to use this
1105 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). 1091 // flag only when restarting the browser with an account already setup. If
1106 if (sync_manager_.get()) { 1092 // you use this before setting up the setup would not succeed as an error
1107 sync_manager_->RegisterInvalidationHandler(this); 1093 // would be encountered.
1108 registered_as_invalidation_handler_ = true; 1094 if (CommandLine::ForCurrentProcess()->HasSwitch(
1109 1095 switches::kSyncThrowUnrecoverableError)) {
1110 // Now check the command line to see if we need to simulate an 1096 sync_manager_->ThrowUnrecoverableError();
1111 // unrecoverable error for testing purpose. Note the error is thrown
1112 // only if the initialization succeeded. Also it makes sense to use this
1113 // flag only when restarting the browser with an account already setup. If
1114 // you use this before setting up the setup would not succeed as an error
1115 // would be encountered.
1116 if (CommandLine::ForCurrentProcess()->HasSwitch(
1117 switches::kSyncThrowUnrecoverableError)) {
1118 sync_manager_->ThrowUnrecoverableError();
1119 }
1120 } 1097 }
1121 } 1098 }
1122 1099
1123 void SyncBackendHost::Core::DoUpdateCredentials( 1100 void SyncBackendHost::Core::DoUpdateCredentials(
1124 const SyncCredentials& credentials) { 1101 const SyncCredentials& credentials) {
1125 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1102 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1126 sync_manager_->UpdateCredentials(credentials); 1103 sync_manager_->UpdateCredentials(credentials);
1127 } 1104 }
1128 1105
1129 void SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds( 1106 void SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds(
1130 const syncer::ObjectIdSet& ids) { 1107 const syncer::ObjectIdSet& ids) {
1131 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1108 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1132 // |sync_manager_| may end up being NULL here in tests (in 1109 // |sync_manager_| may end up being NULL here in tests (in
1133 // synchronous initialization mode) since this is called during 1110 // synchronous initialization mode) since this is called during
1134 // shutdown. 1111 // shutdown.
1135 // 1112 //
1136 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). 1113 // TODO(akalin): Fix this behavior.
1137 if (sync_manager_.get()) { 1114 if (sync_manager_.get()) {
1138 sync_manager_->UpdateRegisteredInvalidationIds(this, ids); 1115 sync_manager_->UpdateRegisteredInvalidationIds(this, ids);
1139 } 1116 }
1140 } 1117 }
1141 1118
1142 void SyncBackendHost::Core::DoStartSyncing( 1119 void SyncBackendHost::Core::DoStartSyncing(
1143 const syncer::ModelSafeRoutingInfo& routing_info) { 1120 const syncer::ModelSafeRoutingInfo& routing_info) {
1144 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1121 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1145 sync_manager_->StartSyncingNormally(routing_info); 1122 sync_manager_->StartSyncingNormally(routing_info);
1146 } 1123 }
(...skipping 28 matching lines...) Expand all
1175 const base::Closure& closure) { 1152 const base::Closure& closure) {
1176 if (sync_manager_.get()) { 1153 if (sync_manager_.get()) {
1177 sync_manager_->StopSyncingForShutdown(closure); 1154 sync_manager_->StopSyncingForShutdown(closure);
1178 } else { 1155 } else {
1179 sync_loop_->PostTask(FROM_HERE, closure); 1156 sync_loop_->PostTask(FROM_HERE, closure);
1180 } 1157 }
1181 } 1158 }
1182 1159
1183 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { 1160 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) {
1184 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1161 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1185 DoDestroySyncManager(); 1162 if (sync_manager_.get()) {
1163 save_changes_timer_.reset();
1164 sync_manager_->UpdateRegisteredInvalidationIds(
1165 this, syncer::ObjectIdSet());
1166 sync_manager_->ShutdownOnSyncThread();
1167 sync_manager_->RemoveObserver(this);
1168 sync_manager_.reset();
1169 }
1186 1170
1187 chrome_sync_notification_bridge_ = NULL; 1171 chrome_sync_notification_bridge_ = NULL;
1188 registrar_ = NULL; 1172 registrar_ = NULL;
1189 1173
1190 if (sync_disabled) 1174 if (sync_disabled)
1191 DeleteSyncDataFolder(); 1175 DeleteSyncDataFolder();
1192 1176
1193 sync_loop_ = NULL; 1177 sync_loop_ = NULL;
1194 1178
1195 host_.Reset(); 1179 host_.Reset();
1196 } 1180 }
1197 1181
1198 void SyncBackendHost::Core::DoDestroySyncManager() {
1199 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1200 if (sync_manager_.get()) {
1201 save_changes_timer_.reset();
1202 if (registered_as_invalidation_handler_) {
1203 sync_manager_->UnregisterInvalidationHandler(this);
1204 registered_as_invalidation_handler_ = false;
1205 }
1206 sync_manager_->RemoveObserver(this);
1207 sync_manager_->ShutdownOnSyncThread();
1208 sync_manager_.reset();
1209 }
1210 }
1211
1212 void SyncBackendHost::Core::DoConfigureSyncer( 1182 void SyncBackendHost::Core::DoConfigureSyncer(
1213 syncer::ConfigureReason reason, 1183 syncer::ConfigureReason reason,
1214 syncer::ModelTypeSet types_to_config, 1184 syncer::ModelTypeSet types_to_config,
1215 const syncer::ModelSafeRoutingInfo routing_info, 1185 const syncer::ModelSafeRoutingInfo routing_info,
1216 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, 1186 const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
1217 const base::Closure& retry_callback) { 1187 const base::Closure& retry_callback) {
1218 DCHECK_EQ(MessageLoop::current(), sync_loop_); 1188 DCHECK_EQ(MessageLoop::current(), sync_loop_);
1219 sync_manager_->ConfigureSyncer( 1189 sync_manager_->ConfigureSyncer(
1220 reason, 1190 reason,
1221 types_to_config, 1191 types_to_config,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 void SyncBackendHost::OnNigoriDownloadRetry() { 1262 void SyncBackendHost::OnNigoriDownloadRetry() {
1293 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 1263 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
1294 if (!frontend_) 1264 if (!frontend_)
1295 return; 1265 return;
1296 1266
1297 frontend_->OnSyncConfigureRetry(); 1267 frontend_->OnSyncConfigureRetry();
1298 } 1268 }
1299 1269
1300 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( 1270 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop(
1301 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { 1271 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) {
1302 DCHECK_NE(initialization_state_, NOT_ATTEMPTED); 1272 DCHECK_NE(NOT_ATTEMPTED, initialization_state_);
1303 if (!frontend_) 1273 if (!frontend_)
1304 return; 1274 return;
1305 1275
1306 // We've at least created the sync manager at this point, but if that is all 1276 // We've at least created the sync manager at this point, but if that is all
1307 // we've done we're just beginning the initialization process. 1277 // we've done we're just beginning the initialization process.
1308 if (initialization_state_ == CREATING_SYNC_MANAGER) 1278 if (initialization_state_ == CREATING_SYNC_MANAGER)
1309 initialization_state_ = NOT_INITIALIZED; 1279 initialization_state_ = NOT_INITIALIZED;
1310 1280
1311 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 1281 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
1312 if (!success) { 1282 if (!success) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 FROM_HERE, 1512 FROM_HERE,
1543 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, 1513 base::Bind(&SyncBackendHost::Core::DoRefreshNigori,
1544 core_.get(), sync_thread_done_callback)); 1514 core_.get(), sync_thread_done_callback));
1545 } 1515 }
1546 1516
1547 #undef SDVLOG 1517 #undef SDVLOG
1548 1518
1549 #undef SLOG 1519 #undef SLOG
1550 1520
1551 } // namespace browser_sync 1521 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/glue/sync_backend_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698