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