| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 | 181 |
| 182 void SyncBackendHostImpl::StartSyncingWithServer() { | 182 void SyncBackendHostImpl::StartSyncingWithServer() { |
| 183 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called."; | 183 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called."; |
| 184 | 184 |
| 185 syncer::ModelSafeRoutingInfo routing_info; | 185 syncer::ModelSafeRoutingInfo routing_info; |
| 186 registrar_->GetModelSafeRoutingInfo(&routing_info); | 186 registrar_->GetModelSafeRoutingInfo(&routing_info); |
| 187 | 187 |
| 188 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, | 188 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, |
| 189 base::Bind(&SyncBackendHostCore::DoStartSyncing, | 189 base::Bind(&SyncBackendHostCore::DoStartSyncing, |
| 190 core_.get(), routing_info, sync_prefs_->GetLastPollTime())); | 190 core_.get(), routing_info)); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase, | 193 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase, |
| 194 bool is_explicit) { | 194 bool is_explicit) { |
| 195 DCHECK(registrar_->sync_thread()->IsRunning()); | 195 DCHECK(registrar_->sync_thread()->IsRunning()); |
| 196 if (!IsNigoriEnabled()) { | 196 if (!IsNigoriEnabled()) { |
| 197 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" | 197 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" |
| 198 " is disabled."; | 198 " is disabled."; |
| 199 return; | 199 return; |
| 200 } | 200 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( | 712 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( |
| 713 const syncer::sessions::SyncSessionSnapshot& snapshot) { | 713 const syncer::sessions::SyncSessionSnapshot& snapshot) { |
| 714 if (!frontend_) | 714 if (!frontend_) |
| 715 return; | 715 return; |
| 716 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 716 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 717 | 717 |
| 718 last_snapshot_ = snapshot; | 718 last_snapshot_ = snapshot; |
| 719 | 719 |
| 720 SDVLOG(1) << "Got snapshot " << snapshot.ToString(); | 720 SDVLOG(1) << "Got snapshot " << snapshot.ToString(); |
| 721 | 721 |
| 722 if (!snapshot.poll_finish_time().is_null()) | |
| 723 sync_prefs_->SetLastPollTime(snapshot.poll_finish_time()); | |
| 724 | |
| 725 // Process any changes to the datatypes we're syncing. | 722 // Process any changes to the datatypes we're syncing. |
| 726 // TODO(sync): add support for removing types. | 723 // TODO(sync): add support for removing types. |
| 727 if (initialized()) | 724 if (initialized()) |
| 728 AddExperimentalTypes(); | 725 AddExperimentalTypes(); |
| 729 | 726 |
| 730 if (initialized()) | 727 if (initialized()) |
| 731 frontend_->OnSyncCycleCompleted(); | 728 frontend_->OnSyncCycleCompleted(); |
| 732 } | 729 } |
| 733 | 730 |
| 734 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop( | 731 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 | 895 |
| 899 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 896 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
| 900 return registrar_->sync_thread()->message_loop(); | 897 return registrar_->sync_thread()->message_loop(); |
| 901 } | 898 } |
| 902 | 899 |
| 903 } // namespace browser_sync | 900 } // namespace browser_sync |
| 904 | 901 |
| 905 #undef SDVLOG | 902 #undef SDVLOG |
| 906 | 903 |
| 907 #undef SLOG | 904 #undef SLOG |
| OLD | NEW |