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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 sync_manager_factory, | 453 sync_manager_factory, |
454 delete_sync_data_folder, | 454 delete_sync_data_folder, |
455 sync_prefs_->GetEncryptionBootstrapToken(), | 455 sync_prefs_->GetEncryptionBootstrapToken(), |
456 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), | 456 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), |
457 new InternalComponentsFactoryImpl(factory_switches), | 457 new InternalComponentsFactoryImpl(factory_switches), |
458 unrecoverable_error_handler, | 458 unrecoverable_error_handler, |
459 report_unrecoverable_error_function)); | 459 report_unrecoverable_error_function)); |
460 } | 460 } |
461 | 461 |
462 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { | 462 void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { |
| 463 DCHECK(sync_thread_.IsRunning()); |
463 sync_thread_.message_loop()->PostTask(FROM_HERE, | 464 sync_thread_.message_loop()->PostTask(FROM_HERE, |
464 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), | 465 base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), |
465 credentials)); | 466 credentials)); |
466 } | 467 } |
467 | 468 |
468 void SyncBackendHost::UpdateRegisteredInvalidationIds( | 469 void SyncBackendHost::UpdateRegisteredInvalidationIds( |
469 const syncer::ObjectIdSet& ids) { | 470 const syncer::ObjectIdSet& ids) { |
470 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 471 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
471 DCHECK(sync_thread_.IsRunning()); | 472 DCHECK(sync_thread_.IsRunning()); |
472 sync_thread_.message_loop()->PostTask(FROM_HERE, | 473 sync_thread_.message_loop()->PostTask(FROM_HERE, |
473 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds, | 474 base::Bind(&SyncBackendHost::Core::DoUpdateRegisteredInvalidationIds, |
474 core_.get(), ids)); | 475 core_.get(), ids)); |
475 } | 476 } |
476 | 477 |
477 void SyncBackendHost::StartSyncingWithServer() { | 478 void SyncBackendHost::StartSyncingWithServer() { |
478 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; | 479 SDVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; |
479 | 480 |
480 syncer::ModelSafeRoutingInfo routing_info; | 481 syncer::ModelSafeRoutingInfo routing_info; |
481 registrar_->GetModelSafeRoutingInfo(&routing_info); | 482 registrar_->GetModelSafeRoutingInfo(&routing_info); |
482 | 483 |
483 sync_thread_.message_loop()->PostTask(FROM_HERE, | 484 sync_thread_.message_loop()->PostTask(FROM_HERE, |
484 base::Bind(&SyncBackendHost::Core::DoStartSyncing, | 485 base::Bind(&SyncBackendHost::Core::DoStartSyncing, |
485 core_.get(), routing_info)); | 486 core_.get(), routing_info)); |
486 } | 487 } |
487 | 488 |
488 void SyncBackendHost::SetEncryptionPassphrase(const std::string& passphrase, | 489 void SyncBackendHost::SetEncryptionPassphrase(const std::string& passphrase, |
489 bool is_explicit) { | 490 bool is_explicit) { |
| 491 DCHECK(sync_thread_.IsRunning()); |
490 if (!IsNigoriEnabled()) { | 492 if (!IsNigoriEnabled()) { |
491 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" | 493 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" |
492 " is disabled."; | 494 " is disabled."; |
493 return; | 495 return; |
494 } | 496 } |
495 | 497 |
496 // We should never be called with an empty passphrase. | 498 // We should never be called with an empty passphrase. |
497 DCHECK(!passphrase.empty()); | 499 DCHECK(!passphrase.empty()); |
498 | 500 |
499 // This should only be called by the frontend. | 501 // This should only be called by the frontend. |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 1586 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
1585 | 1587 |
1586 frontend_->OnConnectionStatusChange(status); | 1588 frontend_->OnConnectionStatusChange(status); |
1587 } | 1589 } |
1588 | 1590 |
1589 #undef SDVLOG | 1591 #undef SDVLOG |
1590 | 1592 |
1591 #undef SLOG | 1593 #undef SLOG |
1592 | 1594 |
1593 } // namespace browser_sync | 1595 } // namespace browser_sync |
OLD | NEW |