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_core.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/browser/sync/glue/invalidation_adapter.h" | 9 #include "chrome/browser/sync/glue/invalidation_adapter.h" |
10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 FROM_HERE, | 128 FROM_HERE, |
129 &SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop, | 129 &SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop, |
130 snapshot); | 130 snapshot); |
131 } | 131 } |
132 | 132 |
133 void SyncBackendHostCore::DoRefreshTypes(syncer::ModelTypeSet types) { | 133 void SyncBackendHostCore::DoRefreshTypes(syncer::ModelTypeSet types) { |
134 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 134 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
135 sync_manager_->RefreshTypes(types); | 135 sync_manager_->RefreshTypes(types); |
136 } | 136 } |
137 | 137 |
138 void SyncBackendHostCore::OnControlTypesDownloadRetry() { | |
139 host_.Call(FROM_HERE, | |
140 &SyncBackendHostImpl::HandleControlTypesDownloadRetry); | |
141 } | |
142 | |
143 void SyncBackendHostCore::OnInitializationComplete( | 138 void SyncBackendHostCore::OnInitializationComplete( |
144 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 139 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
145 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 140 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
146 debug_info_listener, | 141 debug_info_listener, |
147 bool success, | 142 bool success, |
148 const syncer::ModelTypeSet restored_types) { | 143 const syncer::ModelTypeSet restored_types) { |
149 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 144 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
150 | 145 |
151 if (!success) { | 146 if (!success) { |
152 DoDestroySyncManager(syncer::STOP_SYNC); | 147 DoDestroySyncManager(syncer::STOP_SYNC); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 210 |
216 sync_manager_->ConfigureSyncer( | 211 sync_manager_->ConfigureSyncer( |
217 reason, | 212 reason, |
218 new_control_types, | 213 new_control_types, |
219 types_to_purge, | 214 types_to_purge, |
220 syncer::ModelTypeSet(), | 215 syncer::ModelTypeSet(), |
221 syncer::ModelTypeSet(), | 216 syncer::ModelTypeSet(), |
222 routing_info, | 217 routing_info, |
223 base::Bind(&SyncBackendHostCore::DoInitialProcessControlTypes, | 218 base::Bind(&SyncBackendHostCore::DoInitialProcessControlTypes, |
224 weak_ptr_factory_.GetWeakPtr()), | 219 weak_ptr_factory_.GetWeakPtr()), |
225 base::Bind(&SyncBackendHostCore::OnControlTypesDownloadRetry, | 220 base::Closure()); |
226 weak_ptr_factory_.GetWeakPtr())); | |
227 } | 221 } |
228 | 222 |
229 void SyncBackendHostCore::OnConnectionStatusChange( | 223 void SyncBackendHostCore::OnConnectionStatusChange( |
230 syncer::ConnectionStatus status) { | 224 syncer::ConnectionStatus status) { |
231 if (!sync_loop_) | 225 if (!sync_loop_) |
232 return; | 226 return; |
233 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 227 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
234 host_.Call( | 228 host_.Call( |
235 FROM_HERE, | 229 FROM_HERE, |
236 &SyncBackendHostImpl::HandleConnectionStatusChangeOnFrontendLoop, status); | 230 &SyncBackendHostImpl::HandleConnectionStatusChangeOnFrontendLoop, status); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), | 722 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), |
729 this, &SyncBackendHostCore::SaveChanges); | 723 this, &SyncBackendHostCore::SaveChanges); |
730 } | 724 } |
731 | 725 |
732 void SyncBackendHostCore::SaveChanges() { | 726 void SyncBackendHostCore::SaveChanges() { |
733 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 727 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
734 sync_manager_->SaveChanges(); | 728 sync_manager_->SaveChanges(); |
735 } | 729 } |
736 | 730 |
737 } // namespace browser_sync | 731 } // namespace browser_sync |
OLD | NEW |