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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 typedef GoogleServiceAuthError AuthError; | 62 typedef GoogleServiceAuthError AuthError; |
63 | 63 |
64 namespace browser_sync { | 64 namespace browser_sync { |
65 | 65 |
66 using content::BrowserThread; | 66 using content::BrowserThread; |
67 using syncer::InternalComponentsFactory; | 67 using syncer::InternalComponentsFactory; |
68 using syncer::InternalComponentsFactoryImpl; | 68 using syncer::InternalComponentsFactoryImpl; |
69 using syncer::sessions::SyncSessionSnapshot; | 69 using syncer::sessions::SyncSessionSnapshot; |
70 using syncer::SyncCredentials; | 70 using syncer::SyncCredentials; |
71 | 71 |
72 const char kHandlerName[] = "SyncBackendHost::Core"; | |
73 | |
72 // Helper macros to log with the syncer thread name; useful when there | 74 // Helper macros to log with the syncer thread name; useful when there |
73 // are multiple syncers involved. | 75 // are multiple syncers involved. |
74 | 76 |
75 #define SLOG(severity) LOG(severity) << name_ << ": " | 77 #define SLOG(severity) LOG(severity) << name_ << ": " |
76 | 78 |
77 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " | 79 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " |
78 | 80 |
79 class SyncBackendHost::Core | 81 class SyncBackendHost::Core |
80 : public base::RefCountedThreadSafe<SyncBackendHost::Core>, | 82 : public base::RefCountedThreadSafe<SyncBackendHost::Core>, |
81 public syncer::SyncManager::Observer, | 83 public syncer::SyncManager::Observer, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 // a final SaveChanges, and close sqlite handles. | 165 // a final SaveChanges, and close sqlite handles. |
164 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is | 166 // 2) Then, from |frontend_loop_|, halt the sync_thread_ (which is |
165 // a blocking call). This causes syncapi thread-exit handlers | 167 // a blocking call). This causes syncapi thread-exit handlers |
166 // to run and make use of cached pointers to various components | 168 // to run and make use of cached pointers to various components |
167 // owned implicitly by us. | 169 // owned implicitly by us. |
168 // 3) Destroy this Core. That will delete syncapi components in a | 170 // 3) Destroy this Core. That will delete syncapi components in a |
169 // safe order because the thread that was using them has exited | 171 // safe order because the thread that was using them has exited |
170 // (in step 2). | 172 // (in step 2). |
171 void DoStopSyncManagerForShutdown(const base::Closure& closure); | 173 void DoStopSyncManagerForShutdown(const base::Closure& closure); |
172 void DoShutdown(bool stopping_sync); | 174 void DoShutdown(bool stopping_sync); |
175 void DoDestroySyncManager(); | |
173 | 176 |
174 // Configuration methods that must execute on sync loop. | 177 // Configuration methods that must execute on sync loop. |
175 void DoConfigureSyncer( | 178 void DoConfigureSyncer( |
176 syncer::ConfigureReason reason, | 179 syncer::ConfigureReason reason, |
177 syncer::ModelTypeSet types_to_config, | 180 syncer::ModelTypeSet types_to_config, |
178 const syncer::ModelSafeRoutingInfo routing_info, | 181 const syncer::ModelSafeRoutingInfo routing_info, |
179 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, | 182 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, |
180 const base::Closure& retry_callback); | 183 const base::Closure& retry_callback); |
181 void DoFinishConfigureDataTypes( | 184 void DoFinishConfigureDataTypes( |
182 syncer::ModelTypeSet types_to_config, | 185 syncer::ModelTypeSet types_to_config, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 name_(name), | 309 name_(name), |
307 core_(new Core(name, profile_->GetPath().Append(kSyncDataFolderName), | 310 core_(new Core(name, profile_->GetPath().Append(kSyncDataFolderName), |
308 weak_ptr_factory_.GetWeakPtr())), | 311 weak_ptr_factory_.GetWeakPtr())), |
309 initialization_state_(NOT_ATTEMPTED), | 312 initialization_state_(NOT_ATTEMPTED), |
310 sync_prefs_(sync_prefs), | 313 sync_prefs_(sync_prefs), |
311 sync_notifier_factory_( | 314 sync_notifier_factory_( |
312 ParseNotifierOptions(*CommandLine::ForCurrentProcess(), | 315 ParseNotifierOptions(*CommandLine::ForCurrentProcess(), |
313 profile_->GetRequestContext()), | 316 profile_->GetRequestContext()), |
314 content::GetUserAgent(GURL()), | 317 content::GetUserAgent(GURL()), |
315 invalidator_storage), | 318 invalidator_storage), |
316 frontend_(NULL) { | 319 frontend_(NULL), |
320 propagate_invalidations_(true) { | |
317 } | 321 } |
318 | 322 |
319 SyncBackendHost::SyncBackendHost(Profile* profile) | 323 SyncBackendHost::SyncBackendHost(Profile* profile) |
320 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 324 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
321 sync_thread_("Chrome_SyncThread"), | 325 sync_thread_("Chrome_SyncThread"), |
322 frontend_loop_(MessageLoop::current()), | 326 frontend_loop_(MessageLoop::current()), |
323 profile_(profile), | 327 profile_(profile), |
324 name_("Unknown"), | 328 name_("Unknown"), |
325 initialization_state_(NOT_ATTEMPTED), | 329 initialization_state_(NOT_ATTEMPTED), |
326 sync_notifier_factory_( | 330 sync_notifier_factory_( |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 &SyncBackendHost::Core::DoStopSyncManagerForShutdown, | 538 &SyncBackendHost::Core::DoStopSyncManagerForShutdown, |
535 core_.get(), | 539 core_.get(), |
536 closure)); | 540 closure)); |
537 } else { | 541 } else { |
538 core_->DoStopSyncManagerForShutdown(closure); | 542 core_->DoStopSyncManagerForShutdown(closure); |
539 } | 543 } |
540 } | 544 } |
541 | 545 |
542 void SyncBackendHost::StopSyncingForShutdown() { | 546 void SyncBackendHost::StopSyncingForShutdown() { |
543 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 547 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
548 | |
549 // Stop propagating notifications to invalidation handlers. | |
550 propagate_invalidations_ = false; | |
551 | |
544 // Thread shutdown should occur in the following order: | 552 // Thread shutdown should occur in the following order: |
545 // - Sync Thread | 553 // - Sync Thread |
546 // - UI Thread (stops some time after we return from this call). | 554 // - UI Thread (stops some time after we return from this call). |
547 // | 555 // |
548 // In order to acheive this, we first shutdown components from the UI thread | 556 // 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. | 557 // and send signals to abort components that may be busy on the sync thread. |
550 // The callback (OnSyncerShutdownComplete) will happen on the sync thread, | 558 // The callback (OnSyncerShutdownComplete) will happen on the sync thread, |
551 // after which we'll shutdown components on the sync thread, and then be | 559 // after which we'll shutdown components on the sync thread, and then be |
552 // able to stop the sync loop. | 560 // able to stop the sync loop. |
553 if (sync_thread_.IsRunning()) { | 561 if (sync_thread_.IsRunning()) { |
554 StopSyncManagerForShutdown( | 562 StopSyncManagerForShutdown( |
555 base::Bind(&SyncBackendRegistrar::OnSyncerShutdownComplete, | 563 base::Bind(&SyncBackendRegistrar::OnSyncerShutdownComplete, |
556 base::Unretained(registrar_.get()))); | 564 base::Unretained(registrar_.get()))); |
557 | 565 |
558 // Before joining the sync_thread_, we wait for the UIModelWorker to | 566 // Before joining the sync_thread_, we wait for the UIModelWorker to |
(...skipping 15 matching lines...) Expand all Loading... | |
574 DCHECK(!registrar_.get()); | 582 DCHECK(!registrar_.get()); |
575 } | 583 } |
576 } | 584 } |
577 | 585 |
578 void SyncBackendHost::Shutdown(bool sync_disabled) { | 586 void SyncBackendHost::Shutdown(bool sync_disabled) { |
579 // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice. | 587 // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice. |
580 if (sync_thread_.IsRunning()) { | 588 if (sync_thread_.IsRunning()) { |
581 sync_thread_.message_loop()->PostTask(FROM_HERE, | 589 sync_thread_.message_loop()->PostTask(FROM_HERE, |
582 base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(), | 590 base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(), |
583 sync_disabled)); | 591 sync_disabled)); |
592 | |
593 if (chrome_sync_notification_bridge_.get()) { | |
msw
2012/08/03 23:30:46
nit: remove unnecessary {}
akalin
2012/08/07 07:25:19
Done.
| |
594 chrome_sync_notification_bridge_->StopForShutdown(); | |
595 } | |
584 } | 596 } |
585 | 597 |
586 // Stop will return once the thread exits, which will be after DoShutdown | 598 // 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 | 599 // runs. DoShutdown needs to run from sync_thread_ because the sync backend |
588 // requires any thread that opened sqlite handles to relinquish them | 600 // requires any thread that opened sqlite handles to relinquish them |
589 // personally. We need to join threads, because otherwise the main Chrome | 601 // personally. We need to join threads, because otherwise the main Chrome |
590 // thread (ui loop) can exit before DoShutdown finishes, at which point | 602 // thread (ui loop) can exit before DoShutdown finishes, at which point |
591 // virtually anything the sync backend does (or the post-back to | 603 // 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 | 604 // frontend_loop_ by our Core) will epically fail because the CRT won't be |
593 // initialized. | 605 // initialized. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
885 } | 897 } |
886 | 898 |
887 | 899 |
888 void SyncBackendHost::Core::OnInitializationComplete( | 900 void SyncBackendHost::Core::OnInitializationComplete( |
889 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 901 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
890 bool success, | 902 bool success, |
891 const syncer::ModelTypeSet restored_types) { | 903 const syncer::ModelTypeSet restored_types) { |
892 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 904 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
893 | 905 |
894 if (!success) { | 906 if (!success) { |
895 sync_manager_->RemoveObserver(this); | 907 DoDestroySyncManager(); |
896 sync_manager_->UpdateRegisteredInvalidationIds( | |
897 this, syncer::ObjectIdSet()); | |
898 sync_manager_->ShutdownOnSyncThread(); | |
899 sync_manager_.reset(); | |
900 } | 908 } |
901 | 909 |
902 host_.Call( | 910 host_.Call( |
903 FROM_HERE, | 911 FROM_HERE, |
904 &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop, | 912 &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop, |
905 js_backend, success, restored_types); | 913 js_backend, success, restored_types); |
906 | 914 |
907 if (success) { | 915 if (success) { |
908 // Initialization is complete, so we can schedule recurring SaveChanges. | 916 // Initialization is complete, so we can schedule recurring SaveChanges. |
909 sync_loop_->PostTask(FROM_HERE, | 917 sync_loop_->PostTask(FROM_HERE, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1078 options.restored_keystore_key_for_bootstrapping, | 1086 options.restored_keystore_key_for_bootstrapping, |
1079 CommandLine::ForCurrentProcess()->HasSwitch( | 1087 CommandLine::ForCurrentProcess()->HasSwitch( |
1080 switches::kSyncKeystoreEncryption), | 1088 switches::kSyncKeystoreEncryption), |
1081 scoped_ptr<InternalComponentsFactory>( | 1089 scoped_ptr<InternalComponentsFactory>( |
1082 options.internal_components_factory), | 1090 options.internal_components_factory), |
1083 &encryptor_, | 1091 &encryptor_, |
1084 options.unrecoverable_error_handler, | 1092 options.unrecoverable_error_handler, |
1085 options.report_unrecoverable_error_function); | 1093 options.report_unrecoverable_error_function); |
1086 LOG_IF(ERROR, !success) << "Sync manager initialization failed!"; | 1094 LOG_IF(ERROR, !success) << "Sync manager initialization failed!"; |
1087 | 1095 |
1088 // Now check the command line to see if we need to simulate an | 1096 // |sync_manager_| may end up being NULL here in tests (in |
1089 // unrecoverable error for testing purpose. Note the error is thrown | 1097 // synchronous initialization mode). |
1090 // only if the initialization succeeded. Also it makes sense to use this | 1098 // |
1091 // flag only when restarting the browser with an account already setup. If | 1099 // 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 | 1100 if (sync_manager_.get()) { |
1093 // would be encountered. | 1101 sync_manager_->SetInvalidationHandler(kHandlerName, this); |
1094 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1102 |
1095 switches::kSyncThrowUnrecoverableError)) { | 1103 // Now check the command line to see if we need to simulate an |
1096 sync_manager_->ThrowUnrecoverableError(); | 1104 // unrecoverable error for testing purpose. Note the error is thrown |
1105 // only if the initialization succeeded. Also it makes sense to use this | |
1106 // flag only when restarting the browser with an account already setup. If | |
1107 // you use this before setting up the setup would not succeed as an error | |
1108 // would be encountered. | |
1109 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
1110 switches::kSyncThrowUnrecoverableError)) { | |
1111 sync_manager_->ThrowUnrecoverableError(); | |
1112 } | |
1097 } | 1113 } |
1098 } | 1114 } |
1099 | 1115 |
1100 void SyncBackendHost::Core::DoUpdateCredentials( | 1116 void SyncBackendHost::Core::DoUpdateCredentials( |
1101 const SyncCredentials& credentials) { | 1117 const SyncCredentials& credentials) { |
1102 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1118 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1103 sync_manager_->UpdateCredentials(credentials); | 1119 sync_manager_->UpdateCredentials(credentials); |
1104 } | 1120 } |
1105 | 1121 |
1106 void SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds( | 1122 void SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds( |
1107 const syncer::ObjectIdSet& ids) { | 1123 const syncer::ObjectIdSet& ids) { |
1108 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1124 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1109 // |sync_manager_| may end up being NULL here in tests (in | 1125 // |sync_manager_| may end up being NULL here in tests (in |
1110 // synchronous initialization mode) since this is called during | 1126 // synchronous initialization mode) since this is called during |
1111 // shutdown. | 1127 // shutdown. |
1112 // | 1128 // |
1113 // TODO(akalin): Fix this behavior. | 1129 // TODO(akalin): Fix this behavior (see http://crbug.com/140354). |
1114 if (sync_manager_.get()) { | 1130 if (sync_manager_.get()) { |
1115 sync_manager_->UpdateRegisteredInvalidationIds(this, ids); | 1131 sync_manager_->UpdateRegisteredInvalidationIds(kHandlerName, ids); |
1116 } | 1132 } |
1117 } | 1133 } |
1118 | 1134 |
1119 void SyncBackendHost::Core::DoStartSyncing( | 1135 void SyncBackendHost::Core::DoStartSyncing( |
1120 const syncer::ModelSafeRoutingInfo& routing_info) { | 1136 const syncer::ModelSafeRoutingInfo& routing_info) { |
1121 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1137 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1122 sync_manager_->StartSyncingNormally(routing_info); | 1138 sync_manager_->StartSyncingNormally(routing_info); |
1123 } | 1139 } |
1124 | 1140 |
1125 void SyncBackendHost::Core::DoSetEncryptionPassphrase( | 1141 void SyncBackendHost::Core::DoSetEncryptionPassphrase( |
(...skipping 26 matching lines...) Expand all Loading... | |
1152 const base::Closure& closure) { | 1168 const base::Closure& closure) { |
1153 if (sync_manager_.get()) { | 1169 if (sync_manager_.get()) { |
1154 sync_manager_->StopSyncingForShutdown(closure); | 1170 sync_manager_->StopSyncingForShutdown(closure); |
1155 } else { | 1171 } else { |
1156 sync_loop_->PostTask(FROM_HERE, closure); | 1172 sync_loop_->PostTask(FROM_HERE, closure); |
1157 } | 1173 } |
1158 } | 1174 } |
1159 | 1175 |
1160 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { | 1176 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { |
1161 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1177 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1162 if (sync_manager_.get()) { | 1178 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 | 1179 |
1171 chrome_sync_notification_bridge_ = NULL; | 1180 chrome_sync_notification_bridge_ = NULL; |
1172 registrar_ = NULL; | 1181 registrar_ = NULL; |
1173 | 1182 |
1174 if (sync_disabled) | 1183 if (sync_disabled) |
1175 DeleteSyncDataFolder(); | 1184 DeleteSyncDataFolder(); |
1176 | 1185 |
1177 sync_loop_ = NULL; | 1186 sync_loop_ = NULL; |
1178 | 1187 |
1179 host_.Reset(); | 1188 host_.Reset(); |
1180 } | 1189 } |
1181 | 1190 |
1191 void SyncBackendHost::Core::DoDestroySyncManager() { | |
1192 DCHECK_EQ(MessageLoop::current(), sync_loop_); | |
1193 if (sync_manager_.get()) { | |
1194 save_changes_timer_.reset(); | |
1195 sync_manager_->SetInvalidationHandler(kHandlerName, NULL); | |
1196 sync_manager_->RemoveObserver(this); | |
1197 sync_manager_->ShutdownOnSyncThread(); | |
1198 sync_manager_.reset(); | |
1199 } | |
1200 } | |
1201 | |
1182 void SyncBackendHost::Core::DoConfigureSyncer( | 1202 void SyncBackendHost::Core::DoConfigureSyncer( |
1183 syncer::ConfigureReason reason, | 1203 syncer::ConfigureReason reason, |
1184 syncer::ModelTypeSet types_to_config, | 1204 syncer::ModelTypeSet types_to_config, |
1185 const syncer::ModelSafeRoutingInfo routing_info, | 1205 const syncer::ModelSafeRoutingInfo routing_info, |
1186 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, | 1206 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, |
1187 const base::Closure& retry_callback) { | 1207 const base::Closure& retry_callback) { |
1188 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 1208 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
1189 sync_manager_->ConfigureSyncer( | 1209 sync_manager_->ConfigureSyncer( |
1190 reason, | 1210 reason, |
1191 types_to_config, | 1211 types_to_config, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1375 | 1395 |
1376 void SyncBackendHost::HandleActionableErrorEventOnFrontendLoop( | 1396 void SyncBackendHost::HandleActionableErrorEventOnFrontendLoop( |
1377 const syncer::SyncProtocolError& sync_error) { | 1397 const syncer::SyncProtocolError& sync_error) { |
1378 if (!frontend_) | 1398 if (!frontend_) |
1379 return; | 1399 return; |
1380 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1400 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1381 frontend_->OnActionableError(sync_error); | 1401 frontend_->OnActionableError(sync_error); |
1382 } | 1402 } |
1383 | 1403 |
1384 void SyncBackendHost::HandleNotificationsEnabledOnFrontendLoop() { | 1404 void SyncBackendHost::HandleNotificationsEnabledOnFrontendLoop() { |
1385 if (!frontend_) | 1405 if (!frontend_ || !propagate_invalidations_) |
1386 return; | 1406 return; |
1387 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1407 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1388 frontend_->OnNotificationsEnabled(); | 1408 frontend_->OnNotificationsEnabled(); |
1389 } | 1409 } |
1390 | 1410 |
1391 void SyncBackendHost::HandleNotificationsDisabledOnFrontendLoop( | 1411 void SyncBackendHost::HandleNotificationsDisabledOnFrontendLoop( |
1392 syncer::NotificationsDisabledReason reason) { | 1412 syncer::NotificationsDisabledReason reason) { |
1393 if (!frontend_) | 1413 if (!frontend_ || !propagate_invalidations_) |
1394 return; | 1414 return; |
1395 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1415 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1396 frontend_->OnNotificationsDisabled(reason); | 1416 frontend_->OnNotificationsDisabled(reason); |
1397 } | 1417 } |
1398 | 1418 |
1399 void SyncBackendHost::HandleIncomingNotificationOnFrontendLoop( | 1419 void SyncBackendHost::HandleIncomingNotificationOnFrontendLoop( |
1400 const syncer::ObjectIdPayloadMap& id_payloads, | 1420 const syncer::ObjectIdPayloadMap& id_payloads, |
1401 syncer::IncomingNotificationSource source) { | 1421 syncer::IncomingNotificationSource source) { |
1402 if (!frontend_) | 1422 if (!frontend_ || !propagate_invalidations_) |
1403 return; | 1423 return; |
1404 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1424 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1405 frontend_->OnIncomingNotification(id_payloads, source); | 1425 frontend_->OnIncomingNotification(id_payloads, source); |
1406 } | 1426 } |
1407 | 1427 |
1408 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys( | 1428 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys( |
1409 const std::string& passphrase) const { | 1429 const std::string& passphrase) const { |
1410 DCHECK(cached_pending_keys_.has_blob()); | 1430 DCHECK(cached_pending_keys_.has_blob()); |
1411 DCHECK(!passphrase.empty()); | 1431 DCHECK(!passphrase.empty()); |
1412 syncer::Nigori nigori; | 1432 syncer::Nigori nigori; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1512 FROM_HERE, | 1532 FROM_HERE, |
1513 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, | 1533 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, |
1514 core_.get(), sync_thread_done_callback)); | 1534 core_.get(), sync_thread_done_callback)); |
1515 } | 1535 } |
1516 | 1536 |
1517 #undef SDVLOG | 1537 #undef SDVLOG |
1518 | 1538 |
1519 #undef SLOG | 1539 #undef SLOG |
1520 | 1540 |
1521 } // namespace browser_sync | 1541 } // namespace browser_sync |
OLD | NEW |