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

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

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