| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 void SyncBackendHost::Core::OnInitializationComplete( | 414 void SyncBackendHost::Core::OnInitializationComplete( |
| 415 const WeakHandle<JsBackend>& js_backend, | 415 const WeakHandle<JsBackend>& js_backend, |
| 416 bool success) { | 416 bool success) { |
| 417 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 417 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 418 | 418 |
| 419 host_->frontend_loop_->PostTask(FROM_HERE, | 419 host_->frontend_loop_->PostTask(FROM_HERE, |
| 420 base::Bind(&Core::HandleInitializationCompletedOnFrontendLoop, this, | 420 base::Bind(&Core::HandleInitializationCompletedOnFrontendLoop, this, |
| 421 js_backend, success)); | 421 js_backend, success)); |
| 422 | 422 |
| 423 if (success) { | 423 // Initialization is complete, so we can schedule recurring SaveChanges. |
| 424 // Initialization is complete, so we can schedule recurring SaveChanges. | 424 sync_loop_->PostTask(FROM_HERE, base::Bind(&Core::StartSavingChanges, this)); |
| 425 sync_loop_->PostTask(FROM_HERE, | |
| 426 base::Bind(&Core::StartSavingChanges, this)); | |
| 427 } | |
| 428 } | 425 } |
| 429 | 426 |
| 430 void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) { | 427 void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) { |
| 431 if (!sync_loop_) | 428 if (!sync_loop_) |
| 432 return; | 429 return; |
| 433 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 430 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 434 // Post to our core loop so we can modify state. Could be on another thread. | 431 // Post to our core loop so we can modify state. Could be on another thread. |
| 435 host_->frontend_loop_->PostTask(FROM_HERE, | 432 host_->frontend_loop_->PostTask(FROM_HERE, |
| 436 base::Bind(&Core::HandleAuthErrorEventOnFrontendLoop, this, auth_error)); | 433 base::Bind(&Core::HandleAuthErrorEventOnFrontendLoop, this, auth_error)); |
| 437 } | 434 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 options.service_url.EffectiveIntPort(), | 601 options.service_url.EffectiveIntPort(), |
| 605 options.service_url.SchemeIsSecure(), | 602 options.service_url.SchemeIsSecure(), |
| 606 host_->MakeHttpBridgeFactory(options.request_context_getter), | 603 host_->MakeHttpBridgeFactory(options.request_context_getter), |
| 607 options.registrar /* as ModelSafeWorkerRegistrar */, | 604 options.registrar /* as ModelSafeWorkerRegistrar */, |
| 608 options.registrar /* as SyncManager::ChangeDelegate */, | 605 options.registrar /* as SyncManager::ChangeDelegate */, |
| 609 MakeUserAgentForSyncApi(), | 606 MakeUserAgentForSyncApi(), |
| 610 options.credentials, | 607 options.credentials, |
| 611 host_->sync_notifier_factory_.CreateSyncNotifier(), | 608 host_->sync_notifier_factory_.CreateSyncNotifier(), |
| 612 options.restored_key_for_bootstrapping, | 609 options.restored_key_for_bootstrapping, |
| 613 options.setup_for_test_mode); | 610 options.setup_for_test_mode); |
| 614 LOG_IF(ERROR, !success) << "Syncapi initialization failed!"; | 611 DCHECK(success) << "Syncapi initialization failed!"; |
| 615 } | 612 } |
| 616 | 613 |
| 617 void SyncBackendHost::Core::DoCheckServerReachable() { | 614 void SyncBackendHost::Core::DoCheckServerReachable() { |
| 618 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 615 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 619 sync_manager_->CheckServerReachable(); | 616 sync_manager_->CheckServerReachable(); |
| 620 } | 617 } |
| 621 | 618 |
| 622 void SyncBackendHost::Core::DoUpdateCredentials( | 619 void SyncBackendHost::Core::DoUpdateCredentials( |
| 623 const SyncCredentials& credentials) { | 620 const SyncCredentials& credentials) { |
| 624 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 621 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 FROM_HERE, | 1061 FROM_HERE, |
| 1065 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, | 1062 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, |
| 1066 core_.get(), sync_thread_done_callback)); | 1063 core_.get(), sync_thread_done_callback)); |
| 1067 } | 1064 } |
| 1068 | 1065 |
| 1069 #undef SVLOG | 1066 #undef SVLOG |
| 1070 | 1067 |
| 1071 #undef SLOG | 1068 #undef SLOG |
| 1072 | 1069 |
| 1073 } // namespace browser_sync | 1070 } // namespace browser_sync |
| OLD | NEW |