Chromium Code Reviews| 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 "components/sync/driver/glue/sync_backend_host_core.h" | 5 #include "components/sync/driver/glue/sync_backend_host_core.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 fetcher, data_use_measurement::DataUseUserData::SYNC); | 48 fetcher, data_use_measurement::DataUseUserData::SYNC); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 namespace syncer { | 53 namespace syncer { |
| 54 | 54 |
| 55 class EngineComponentsFactory; | 55 class EngineComponentsFactory; |
| 56 | 56 |
| 57 DoInitializeOptions::DoInitializeOptions( | 57 DoInitializeOptions::DoInitializeOptions( |
| 58 base::MessageLoop* sync_loop, | 58 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner, |
| 59 SyncBackendRegistrar* registrar, | 59 SyncBackendRegistrar* registrar, |
| 60 const std::vector<scoped_refptr<ModelSafeWorker>>& workers, | 60 const std::vector<scoped_refptr<ModelSafeWorker>>& workers, |
| 61 const scoped_refptr<ExtensionsActivity>& extensions_activity, | 61 const scoped_refptr<ExtensionsActivity>& extensions_activity, |
| 62 const WeakHandle<JsEventHandler>& event_handler, | 62 const WeakHandle<JsEventHandler>& event_handler, |
| 63 const GURL& service_url, | 63 const GURL& service_url, |
| 64 const std::string& sync_user_agent, | 64 const std::string& sync_user_agent, |
| 65 std::unique_ptr<HttpPostProviderFactory> http_bridge_factory, | 65 std::unique_ptr<HttpPostProviderFactory> http_bridge_factory, |
| 66 const SyncCredentials& credentials, | 66 const SyncCredentials& credentials, |
| 67 const std::string& invalidator_client_id, | 67 const std::string& invalidator_client_id, |
| 68 std::unique_ptr<SyncManagerFactory> sync_manager_factory, | 68 std::unique_ptr<SyncManagerFactory> sync_manager_factory, |
| 69 bool delete_sync_data_folder, | 69 bool delete_sync_data_folder, |
| 70 bool enable_local_sync_backend, | 70 bool enable_local_sync_backend, |
| 71 const base::FilePath& local_sync_backend_folder, | 71 const base::FilePath& local_sync_backend_folder, |
| 72 const std::string& restored_key_for_bootstrapping, | 72 const std::string& restored_key_for_bootstrapping, |
| 73 const std::string& restored_keystore_key_for_bootstrapping, | 73 const std::string& restored_keystore_key_for_bootstrapping, |
| 74 std::unique_ptr<EngineComponentsFactory> engine_components_factory, | 74 std::unique_ptr<EngineComponentsFactory> engine_components_factory, |
| 75 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, | 75 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
| 76 const base::Closure& report_unrecoverable_error_function, | 76 const base::Closure& report_unrecoverable_error_function, |
| 77 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state, | 77 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state, |
| 78 const std::map<ModelType, int64_t>& invalidation_versions) | 78 const std::map<ModelType, int64_t>& invalidation_versions) |
| 79 : sync_loop(sync_loop), | 79 : sync_task_runner(std::move(sync_task_runner)), |
| 80 registrar(registrar), | 80 registrar(registrar), |
| 81 workers(workers), | 81 workers(workers), |
| 82 extensions_activity(extensions_activity), | 82 extensions_activity(extensions_activity), |
| 83 event_handler(event_handler), | 83 event_handler(event_handler), |
| 84 service_url(service_url), | 84 service_url(service_url), |
| 85 sync_user_agent(sync_user_agent), | 85 sync_user_agent(sync_user_agent), |
| 86 http_bridge_factory(std::move(http_bridge_factory)), | 86 http_bridge_factory(std::move(http_bridge_factory)), |
| 87 credentials(credentials), | 87 credentials(credentials), |
| 88 invalidator_client_id(invalidator_client_id), | 88 invalidator_client_id(invalidator_client_id), |
| 89 sync_manager_factory(std::move(sync_manager_factory)), | 89 sync_manager_factory(std::move(sync_manager_factory)), |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 109 DoConfigureSyncerTypes::~DoConfigureSyncerTypes() {} | 109 DoConfigureSyncerTypes::~DoConfigureSyncerTypes() {} |
| 110 | 110 |
| 111 SyncBackendHostCore::SyncBackendHostCore( | 111 SyncBackendHostCore::SyncBackendHostCore( |
| 112 const std::string& name, | 112 const std::string& name, |
| 113 const base::FilePath& sync_data_folder_path, | 113 const base::FilePath& sync_data_folder_path, |
| 114 bool has_sync_setup_completed, | 114 bool has_sync_setup_completed, |
| 115 const base::WeakPtr<SyncBackendHostImpl>& backend) | 115 const base::WeakPtr<SyncBackendHostImpl>& backend) |
| 116 : name_(name), | 116 : name_(name), |
| 117 sync_data_folder_path_(sync_data_folder_path), | 117 sync_data_folder_path_(sync_data_folder_path), |
| 118 host_(backend), | 118 host_(backend), |
| 119 sync_loop_(nullptr), | |
| 120 registrar_(nullptr), | 119 registrar_(nullptr), |
| 121 has_sync_setup_completed_(has_sync_setup_completed), | 120 has_sync_setup_completed_(has_sync_setup_completed), |
| 122 forward_protocol_events_(false), | 121 forward_protocol_events_(false), |
| 123 forward_type_info_(false), | 122 forward_type_info_(false), |
| 124 weak_ptr_factory_(this) { | 123 weak_ptr_factory_(this) { |
| 125 DCHECK(backend.get()); | 124 DCHECK(backend.get()); |
| 126 } | 125 } |
| 127 | 126 |
| 128 SyncBackendHostCore::~SyncBackendHostCore() { | 127 SyncBackendHostCore::~SyncBackendHostCore() { |
| 129 DCHECK(!sync_manager_.get()); | 128 DCHECK(!sync_manager_.get()); |
| 130 } | 129 } |
| 131 | 130 |
| 132 bool SyncBackendHostCore::OnMemoryDump( | 131 bool SyncBackendHostCore::OnMemoryDump( |
| 133 const base::trace_event::MemoryDumpArgs& args, | 132 const base::trace_event::MemoryDumpArgs& args, |
| 134 base::trace_event::ProcessMemoryDump* pmd) { | 133 base::trace_event::ProcessMemoryDump* pmd) { |
| 135 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 134 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 136 if (!sync_manager_) | 135 if (!sync_manager_) |
| 137 return false; | 136 return false; |
| 138 sync_manager_->OnMemoryDump(pmd); | 137 sync_manager_->OnMemoryDump(pmd); |
| 139 return true; | 138 return true; |
| 140 } | 139 } |
| 141 | 140 |
| 142 void SyncBackendHostCore::OnSyncCycleCompleted( | 141 void SyncBackendHostCore::OnSyncCycleCompleted( |
| 143 const SyncCycleSnapshot& snapshot) { | 142 const SyncCycleSnapshot& snapshot) { |
| 144 if (!sync_loop_) | 143 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
|
skym
2016/11/30 18:45:23
What makes us think that removing all these if (!s
maxbogue
2016/11/30 20:05:06
It was never nulled out and it was set in DoInitia
| |
| 145 return; | |
| 146 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 147 | 144 |
| 148 host_.Call(FROM_HERE, | 145 host_.Call(FROM_HERE, |
| 149 &SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop, | 146 &SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop, |
| 150 snapshot); | 147 snapshot); |
| 151 } | 148 } |
| 152 | 149 |
| 153 void SyncBackendHostCore::DoRefreshTypes(ModelTypeSet types) { | 150 void SyncBackendHostCore::DoRefreshTypes(ModelTypeSet types) { |
| 154 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 151 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 155 sync_manager_->RefreshTypes(types); | 152 sync_manager_->RefreshTypes(types); |
| 156 } | 153 } |
| 157 | 154 |
| 158 void SyncBackendHostCore::OnInitializationComplete( | 155 void SyncBackendHostCore::OnInitializationComplete( |
| 159 const WeakHandle<JsBackend>& js_backend, | 156 const WeakHandle<JsBackend>& js_backend, |
| 160 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | 157 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
| 161 bool success, | 158 bool success, |
| 162 const ModelTypeSet restored_types) { | 159 const ModelTypeSet restored_types) { |
| 163 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 160 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 164 | 161 |
| 165 if (!success) { | 162 if (!success) { |
| 166 DoDestroySyncManager(STOP_SYNC); | 163 DoDestroySyncManager(STOP_SYNC); |
| 167 host_.Call(FROM_HERE, | 164 host_.Call(FROM_HERE, |
| 168 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); | 165 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); |
| 169 return; | 166 return; |
| 170 } | 167 } |
| 171 | 168 |
| 172 // Register for encryption related changes now. We have to do this before | 169 // Register for encryption related changes now. We have to do this before |
| 173 // the initializing downloading control types or initializing the encryption | 170 // the initializing downloading control types or initializing the encryption |
| 174 // handler in order to receive notifications triggered during encryption | 171 // handler in order to receive notifications triggered during encryption |
| 175 // startup. | 172 // startup. |
| 176 sync_manager_->GetEncryptionHandler()->AddObserver(this); | 173 sync_manager_->GetEncryptionHandler()->AddObserver(this); |
| 177 | 174 |
| 178 // Sync manager initialization is complete, so we can schedule recurring | 175 // Sync manager initialization is complete, so we can schedule recurring |
| 179 // SaveChanges. | 176 // SaveChanges. |
| 180 sync_loop_->task_runner()->PostTask( | 177 sync_task_runner_->PostTask( |
| 181 FROM_HERE, base::Bind(&SyncBackendHostCore::StartSavingChanges, | 178 FROM_HERE, base::Bind(&SyncBackendHostCore::StartSavingChanges, |
| 182 weak_ptr_factory_.GetWeakPtr())); | 179 weak_ptr_factory_.GetWeakPtr())); |
| 183 | 180 |
| 184 // Hang on to these for a while longer. We're not ready to hand them back to | 181 // Hang on to these for a while longer. We're not ready to hand them back to |
| 185 // the UI thread yet. | 182 // the UI thread yet. |
| 186 js_backend_ = js_backend; | 183 js_backend_ = js_backend; |
| 187 debug_info_listener_ = debug_info_listener; | 184 debug_info_listener_ = debug_info_listener; |
| 188 | 185 |
| 189 // Before proceeding any further, we need to download the control types and | 186 // Before proceeding any further, we need to download the control types and |
| 190 // purge any partial data (ie. data downloaded for a type that was on its way | 187 // purge any partial data (ie. data downloaded for a type that was on its way |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 210 | 207 |
| 211 sync_manager_->ConfigureSyncer( | 208 sync_manager_->ConfigureSyncer( |
| 212 reason, new_control_types, types_to_purge, ModelTypeSet(), ModelTypeSet(), | 209 reason, new_control_types, types_to_purge, ModelTypeSet(), ModelTypeSet(), |
| 213 routing_info, | 210 routing_info, |
| 214 base::Bind(&SyncBackendHostCore::DoInitialProcessControlTypes, | 211 base::Bind(&SyncBackendHostCore::DoInitialProcessControlTypes, |
| 215 weak_ptr_factory_.GetWeakPtr()), | 212 weak_ptr_factory_.GetWeakPtr()), |
| 216 base::Closure()); | 213 base::Closure()); |
| 217 } | 214 } |
| 218 | 215 |
| 219 void SyncBackendHostCore::OnConnectionStatusChange(ConnectionStatus status) { | 216 void SyncBackendHostCore::OnConnectionStatusChange(ConnectionStatus status) { |
| 220 if (!sync_loop_) | 217 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 221 return; | |
| 222 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 223 host_.Call(FROM_HERE, | 218 host_.Call(FROM_HERE, |
| 224 &SyncBackendHostImpl::HandleConnectionStatusChangeOnFrontendLoop, | 219 &SyncBackendHostImpl::HandleConnectionStatusChangeOnFrontendLoop, |
| 225 status); | 220 status); |
| 226 } | 221 } |
| 227 | 222 |
| 228 void SyncBackendHostCore::OnPassphraseRequired( | 223 void SyncBackendHostCore::OnPassphraseRequired( |
| 229 PassphraseRequiredReason reason, | 224 PassphraseRequiredReason reason, |
| 230 const sync_pb::EncryptedData& pending_keys) { | 225 const sync_pb::EncryptedData& pending_keys) { |
| 231 if (!sync_loop_) | 226 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 232 return; | |
| 233 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 234 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseRequired, reason, | 227 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseRequired, reason, |
| 235 pending_keys); | 228 pending_keys); |
| 236 } | 229 } |
| 237 | 230 |
| 238 void SyncBackendHostCore::OnPassphraseAccepted() { | 231 void SyncBackendHostCore::OnPassphraseAccepted() { |
| 239 if (!sync_loop_) | 232 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 240 return; | |
| 241 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 242 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseAccepted); | 233 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseAccepted); |
| 243 } | 234 } |
| 244 | 235 |
| 245 void SyncBackendHostCore::OnBootstrapTokenUpdated( | 236 void SyncBackendHostCore::OnBootstrapTokenUpdated( |
| 246 const std::string& bootstrap_token, | 237 const std::string& bootstrap_token, |
| 247 BootstrapTokenType type) { | 238 BootstrapTokenType type) { |
| 248 if (!sync_loop_) | 239 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 249 return; | |
| 250 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 251 host_.Call(FROM_HERE, &SyncBackendHostImpl::PersistEncryptionBootstrapToken, | 240 host_.Call(FROM_HERE, &SyncBackendHostImpl::PersistEncryptionBootstrapToken, |
| 252 bootstrap_token, type); | 241 bootstrap_token, type); |
| 253 } | 242 } |
| 254 | 243 |
| 255 void SyncBackendHostCore::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | 244 void SyncBackendHostCore::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
| 256 bool encrypt_everything) { | 245 bool encrypt_everything) { |
| 257 if (!sync_loop_) | 246 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 258 return; | |
| 259 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 260 // NOTE: We're in a transaction. | 247 // NOTE: We're in a transaction. |
| 261 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptedTypesChanged, | 248 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptedTypesChanged, |
| 262 encrypted_types, encrypt_everything); | 249 encrypted_types, encrypt_everything); |
| 263 } | 250 } |
| 264 | 251 |
| 265 void SyncBackendHostCore::OnEncryptionComplete() { | 252 void SyncBackendHostCore::OnEncryptionComplete() { |
| 266 if (!sync_loop_) | 253 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 267 return; | |
| 268 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 269 // NOTE: We're in a transaction. | 254 // NOTE: We're in a transaction. |
| 270 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptionComplete); | 255 host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptionComplete); |
| 271 } | 256 } |
| 272 | 257 |
| 273 void SyncBackendHostCore::OnCryptographerStateChanged( | 258 void SyncBackendHostCore::OnCryptographerStateChanged( |
| 274 Cryptographer* cryptographer) { | 259 Cryptographer* cryptographer) { |
| 275 // Do nothing. | 260 // Do nothing. |
| 276 } | 261 } |
| 277 | 262 |
| 278 void SyncBackendHostCore::OnPassphraseTypeChanged(PassphraseType type, | 263 void SyncBackendHostCore::OnPassphraseTypeChanged(PassphraseType type, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 ModelType type, | 297 ModelType type, |
| 313 const StatusCounters& counters) { | 298 const StatusCounters& counters) { |
| 314 host_.Call( | 299 host_.Call( |
| 315 FROM_HERE, | 300 FROM_HERE, |
| 316 &SyncBackendHostImpl::HandleDirectoryStatusCountersUpdatedOnFrontendLoop, | 301 &SyncBackendHostImpl::HandleDirectoryStatusCountersUpdatedOnFrontendLoop, |
| 317 type, counters); | 302 type, counters); |
| 318 } | 303 } |
| 319 | 304 |
| 320 void SyncBackendHostCore::OnActionableError( | 305 void SyncBackendHostCore::OnActionableError( |
| 321 const SyncProtocolError& sync_error) { | 306 const SyncProtocolError& sync_error) { |
| 322 if (!sync_loop_) | 307 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 323 return; | |
| 324 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 325 host_.Call(FROM_HERE, | 308 host_.Call(FROM_HERE, |
| 326 &SyncBackendHostImpl::HandleActionableErrorEventOnFrontendLoop, | 309 &SyncBackendHostImpl::HandleActionableErrorEventOnFrontendLoop, |
| 327 sync_error); | 310 sync_error); |
| 328 } | 311 } |
| 329 | 312 |
| 330 void SyncBackendHostCore::OnMigrationRequested(ModelTypeSet types) { | 313 void SyncBackendHostCore::OnMigrationRequested(ModelTypeSet types) { |
| 331 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 314 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 332 host_.Call(FROM_HERE, | 315 host_.Call(FROM_HERE, |
| 333 &SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop, | 316 &SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop, |
| 334 types); | 317 types); |
| 335 } | 318 } |
| 336 | 319 |
| 337 void SyncBackendHostCore::OnProtocolEvent(const ProtocolEvent& event) { | 320 void SyncBackendHostCore::OnProtocolEvent(const ProtocolEvent& event) { |
| 338 if (forward_protocol_events_) { | 321 if (forward_protocol_events_) { |
| 339 std::unique_ptr<ProtocolEvent> event_clone(event.Clone()); | 322 std::unique_ptr<ProtocolEvent> event_clone(event.Clone()); |
| 340 host_.Call(FROM_HERE, | 323 host_.Call(FROM_HERE, |
| 341 &SyncBackendHostImpl::HandleProtocolEventOnFrontendLoop, | 324 &SyncBackendHostImpl::HandleProtocolEventOnFrontendLoop, |
| 342 base::Passed(std::move(event_clone))); | 325 base::Passed(std::move(event_clone))); |
| 343 } | 326 } |
| 344 } | 327 } |
| 345 | 328 |
| 346 void SyncBackendHostCore::DoOnInvalidatorStateChange(InvalidatorState state) { | 329 void SyncBackendHostCore::DoOnInvalidatorStateChange(InvalidatorState state) { |
| 347 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 330 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 348 sync_manager_->SetInvalidatorEnabled(state == INVALIDATIONS_ENABLED); | 331 sync_manager_->SetInvalidatorEnabled(state == INVALIDATIONS_ENABLED); |
| 349 } | 332 } |
| 350 | 333 |
| 351 void SyncBackendHostCore::DoOnIncomingInvalidation( | 334 void SyncBackendHostCore::DoOnIncomingInvalidation( |
| 352 const ObjectIdInvalidationMap& invalidation_map) { | 335 const ObjectIdInvalidationMap& invalidation_map) { |
| 353 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 336 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 354 | 337 |
| 355 ObjectIdSet ids = invalidation_map.GetObjectIds(); | 338 ObjectIdSet ids = invalidation_map.GetObjectIds(); |
| 356 for (const invalidation::ObjectId& object_id : ids) { | 339 for (const invalidation::ObjectId& object_id : ids) { |
| 357 ModelType type; | 340 ModelType type; |
| 358 if (!NotificationTypeToRealModelType(object_id.name(), &type)) { | 341 if (!NotificationTypeToRealModelType(object_id.name(), &type)) { |
| 359 DLOG(WARNING) << "Notification has invalid id: " | 342 DLOG(WARNING) << "Notification has invalid id: " |
| 360 << ObjectIdToString(object_id); | 343 << ObjectIdToString(object_id); |
| 361 } else { | 344 } else { |
| 362 SingleObjectInvalidationSet invalidation_set = | 345 SingleObjectInvalidationSet invalidation_set = |
| 363 invalidation_map.ForObject(object_id); | 346 invalidation_map.ForObject(object_id); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 380 } | 363 } |
| 381 } | 364 } |
| 382 } | 365 } |
| 383 | 366 |
| 384 host_.Call(FROM_HERE, &SyncBackendHostImpl::UpdateInvalidationVersions, | 367 host_.Call(FROM_HERE, &SyncBackendHostImpl::UpdateInvalidationVersions, |
| 385 last_invalidation_versions_); | 368 last_invalidation_versions_); |
| 386 } | 369 } |
| 387 | 370 |
| 388 void SyncBackendHostCore::DoInitialize( | 371 void SyncBackendHostCore::DoInitialize( |
| 389 std::unique_ptr<DoInitializeOptions> options) { | 372 std::unique_ptr<DoInitializeOptions> options) { |
| 390 DCHECK(!sync_loop_); | 373 sync_task_runner_ = std::move(options->sync_task_runner); |
| 391 sync_loop_ = options->sync_loop; | |
| 392 DCHECK(sync_loop_); | |
| 393 | 374 |
| 394 // Finish initializing the HttpBridgeFactory. We do this here because | 375 // Finish initializing the HttpBridgeFactory. We do this here because |
| 395 // building the user agent may block on some platforms. | 376 // building the user agent may block on some platforms. |
| 396 options->http_bridge_factory->Init(options->sync_user_agent, | 377 options->http_bridge_factory->Init(options->sync_user_agent, |
| 397 base::Bind(&BindFetcherToDataTracker)); | 378 base::Bind(&BindFetcherToDataTracker)); |
| 398 | 379 |
| 399 // Blow away the partial or corrupt sync data folder before doing any more | 380 // Blow away the partial or corrupt sync data folder before doing any more |
| 400 // initialization, if necessary. | 381 // initialization, if necessary. |
| 401 if (options->delete_sync_data_folder) { | 382 if (options->delete_sync_data_folder) { |
| 402 DeleteSyncDataFolder(); | 383 DeleteSyncDataFolder(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 args.engine_components_factory = | 417 args.engine_components_factory = |
| 437 std::move(options->engine_components_factory); | 418 std::move(options->engine_components_factory); |
| 438 args.encryptor = &encryptor_; | 419 args.encryptor = &encryptor_; |
| 439 args.unrecoverable_error_handler = options->unrecoverable_error_handler; | 420 args.unrecoverable_error_handler = options->unrecoverable_error_handler; |
| 440 args.report_unrecoverable_error_function = | 421 args.report_unrecoverable_error_function = |
| 441 options->report_unrecoverable_error_function; | 422 options->report_unrecoverable_error_function; |
| 442 args.cancelation_signal = &stop_syncing_signal_; | 423 args.cancelation_signal = &stop_syncing_signal_; |
| 443 args.saved_nigori_state = std::move(options->saved_nigori_state); | 424 args.saved_nigori_state = std::move(options->saved_nigori_state); |
| 444 sync_manager_->Init(&args); | 425 sync_manager_->Init(&args); |
| 445 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 426 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 446 this, "SyncDirectory", sync_loop_->task_runner()); | 427 this, "SyncDirectory", sync_task_runner_); |
| 447 } | 428 } |
| 448 | 429 |
| 449 void SyncBackendHostCore::DoUpdateCredentials( | 430 void SyncBackendHostCore::DoUpdateCredentials( |
| 450 const SyncCredentials& credentials) { | 431 const SyncCredentials& credentials) { |
| 451 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 432 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
|
skym
2016/11/30 18:45:23
Seems like this class could get away with a Thread
maxbogue
2016/11/30 20:05:06
Done. Except I used ThreadTaskRunnerHandle::Get()
| |
| 452 // UpdateCredentials can be called during backend initialization, possibly | 433 // UpdateCredentials can be called during backend initialization, possibly |
| 453 // when backend initialization has failed but hasn't notified the UI thread | 434 // when backend initialization has failed but hasn't notified the UI thread |
| 454 // yet. In that case, the sync manager may have been destroyed on the sync | 435 // yet. In that case, the sync manager may have been destroyed on the sync |
| 455 // thread before this task was executed, so we do nothing. | 436 // thread before this task was executed, so we do nothing. |
| 456 if (sync_manager_) { | 437 if (sync_manager_) { |
| 457 sync_manager_->UpdateCredentials(credentials); | 438 sync_manager_->UpdateCredentials(credentials); |
| 458 } | 439 } |
| 459 } | 440 } |
| 460 | 441 |
| 461 void SyncBackendHostCore::DoStartSyncing( | 442 void SyncBackendHostCore::DoStartSyncing( |
| 462 const ModelSafeRoutingInfo& routing_info, | 443 const ModelSafeRoutingInfo& routing_info, |
| 463 base::Time last_poll_time) { | 444 base::Time last_poll_time) { |
| 464 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 445 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 465 sync_manager_->StartSyncingNormally(routing_info, last_poll_time); | 446 sync_manager_->StartSyncingNormally(routing_info, last_poll_time); |
| 466 } | 447 } |
| 467 | 448 |
| 468 void SyncBackendHostCore::DoSetEncryptionPassphrase( | 449 void SyncBackendHostCore::DoSetEncryptionPassphrase( |
| 469 const std::string& passphrase, | 450 const std::string& passphrase, |
| 470 bool is_explicit) { | 451 bool is_explicit) { |
| 471 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 452 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 472 sync_manager_->GetEncryptionHandler()->SetEncryptionPassphrase(passphrase, | 453 sync_manager_->GetEncryptionHandler()->SetEncryptionPassphrase(passphrase, |
| 473 is_explicit); | 454 is_explicit); |
| 474 } | 455 } |
| 475 | 456 |
| 476 void SyncBackendHostCore::DoInitialProcessControlTypes() { | 457 void SyncBackendHostCore::DoInitialProcessControlTypes() { |
| 477 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 458 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 478 | 459 |
| 479 DVLOG(1) << "Initilalizing Control Types"; | 460 DVLOG(1) << "Initilalizing Control Types"; |
| 480 | 461 |
| 481 // Initialize encryption. | 462 // Initialize encryption. |
| 482 sync_manager_->GetEncryptionHandler()->Init(); | 463 sync_manager_->GetEncryptionHandler()->Init(); |
| 483 | 464 |
| 484 // Note: experiments are currently handled via SBH::AddExperimentalTypes, | 465 // Note: experiments are currently handled via SBH::AddExperimentalTypes, |
| 485 // which is called at the end of every sync cycle. | 466 // which is called at the end of every sync cycle. |
| 486 // TODO(zea): eventually add an experiment handler and initialize it here. | 467 // TODO(zea): eventually add an experiment handler and initialize it here. |
| 487 | 468 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 504 js_backend_, debug_info_listener_, | 485 js_backend_, debug_info_listener_, |
| 505 base::Passed(sync_manager_->GetModelTypeConnectorProxy()), | 486 base::Passed(sync_manager_->GetModelTypeConnectorProxy()), |
| 506 sync_manager_->cache_guid()); | 487 sync_manager_->cache_guid()); |
| 507 | 488 |
| 508 js_backend_.Reset(); | 489 js_backend_.Reset(); |
| 509 debug_info_listener_.Reset(); | 490 debug_info_listener_.Reset(); |
| 510 } | 491 } |
| 511 | 492 |
| 512 void SyncBackendHostCore::DoSetDecryptionPassphrase( | 493 void SyncBackendHostCore::DoSetDecryptionPassphrase( |
| 513 const std::string& passphrase) { | 494 const std::string& passphrase) { |
| 514 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 495 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 515 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase(passphrase); | 496 sync_manager_->GetEncryptionHandler()->SetDecryptionPassphrase(passphrase); |
| 516 } | 497 } |
| 517 | 498 |
| 518 void SyncBackendHostCore::DoEnableEncryptEverything() { | 499 void SyncBackendHostCore::DoEnableEncryptEverything() { |
| 519 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 500 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 520 sync_manager_->GetEncryptionHandler()->EnableEncryptEverything(); | 501 sync_manager_->GetEncryptionHandler()->EnableEncryptEverything(); |
| 521 } | 502 } |
| 522 | 503 |
| 523 void SyncBackendHostCore::ShutdownOnUIThread() { | 504 void SyncBackendHostCore::ShutdownOnUIThread() { |
| 524 // This will cut short any blocking network tasks, cut short any in-progress | 505 // This will cut short any blocking network tasks, cut short any in-progress |
| 525 // sync cycles, and prevent the creation of new blocking network tasks and new | 506 // sync cycles, and prevent the creation of new blocking network tasks and new |
| 526 // sync cycles. If there was an in-progress network request, it would have | 507 // sync cycles. If there was an in-progress network request, it would have |
| 527 // had a reference to the RequestContextGetter. This reference will be | 508 // had a reference to the RequestContextGetter. This reference will be |
| 528 // dropped by the time this function returns. | 509 // dropped by the time this function returns. |
| 529 // | 510 // |
| 530 // It is safe to call this even if Sync's backend classes have not been | 511 // It is safe to call this even if Sync's backend classes have not been |
| 531 // initialized yet. Those classes will receive the message when the sync | 512 // initialized yet. Those classes will receive the message when the sync |
| 532 // thread finally getes around to constructing them. | 513 // thread finally getes around to constructing them. |
| 533 stop_syncing_signal_.Signal(); | 514 stop_syncing_signal_.Signal(); |
| 534 | 515 |
| 535 // This will drop the HttpBridgeFactory's reference to the | 516 // This will drop the HttpBridgeFactory's reference to the |
| 536 // RequestContextGetter. Once this has been called, the HttpBridgeFactory can | 517 // RequestContextGetter. Once this has been called, the HttpBridgeFactory can |
| 537 // no longer be used to create new HttpBridge instances. We can get away with | 518 // no longer be used to create new HttpBridge instances. We can get away with |
| 538 // this because the stop_syncing_signal_ has already been signalled, which | 519 // this because the stop_syncing_signal_ has already been signalled, which |
| 539 // guarantees that the ServerConnectionManager will no longer attempt to | 520 // guarantees that the ServerConnectionManager will no longer attempt to |
| 540 // create new connections. | 521 // create new connections. |
| 541 release_request_context_signal_.Signal(); | 522 release_request_context_signal_.Signal(); |
| 542 } | 523 } |
| 543 | 524 |
| 544 void SyncBackendHostCore::DoShutdown(ShutdownReason reason) { | 525 void SyncBackendHostCore::DoShutdown(ShutdownReason reason) { |
| 545 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 526 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 546 | 527 |
| 547 DoDestroySyncManager(reason); | 528 DoDestroySyncManager(reason); |
| 548 | 529 |
| 549 registrar_ = nullptr; | 530 registrar_ = nullptr; |
| 550 | 531 |
| 551 if (reason == DISABLE_SYNC) | 532 if (reason == DISABLE_SYNC) |
| 552 DeleteSyncDataFolder(); | 533 DeleteSyncDataFolder(); |
| 553 | 534 |
| 554 host_.Reset(); | 535 host_.Reset(); |
| 555 weak_ptr_factory_.InvalidateWeakPtrs(); | 536 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 556 } | 537 } |
| 557 | 538 |
| 558 void SyncBackendHostCore::DoDestroySyncManager(ShutdownReason reason) { | 539 void SyncBackendHostCore::DoDestroySyncManager(ShutdownReason reason) { |
| 559 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 540 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 560 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 541 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| 561 this); | 542 this); |
| 562 if (sync_manager_) { | 543 if (sync_manager_) { |
| 563 DisableDirectoryTypeDebugInfoForwarding(); | 544 DisableDirectoryTypeDebugInfoForwarding(); |
| 564 save_changes_timer_.reset(); | 545 save_changes_timer_.reset(); |
| 565 sync_manager_->RemoveObserver(this); | 546 sync_manager_->RemoveObserver(this); |
| 566 sync_manager_->ShutdownOnSyncThread(reason); | 547 sync_manager_->ShutdownOnSyncThread(reason); |
| 567 sync_manager_.reset(); | 548 sync_manager_.reset(); |
| 568 } | 549 } |
| 569 } | 550 } |
| 570 | 551 |
| 571 void SyncBackendHostCore::DoConfigureSyncer( | 552 void SyncBackendHostCore::DoConfigureSyncer( |
| 572 ConfigureReason reason, | 553 ConfigureReason reason, |
| 573 const DoConfigureSyncerTypes& config_types, | 554 const DoConfigureSyncerTypes& config_types, |
| 574 const ModelSafeRoutingInfo routing_info, | 555 const ModelSafeRoutingInfo routing_info, |
| 575 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 556 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, |
| 576 const base::Closure& retry_callback) { | 557 const base::Closure& retry_callback) { |
| 577 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 558 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 578 DCHECK(!ready_task.is_null()); | 559 DCHECK(!ready_task.is_null()); |
| 579 DCHECK(!retry_callback.is_null()); | 560 DCHECK(!retry_callback.is_null()); |
| 580 base::Closure chained_ready_task(base::Bind( | 561 base::Closure chained_ready_task(base::Bind( |
| 581 &SyncBackendHostCore::DoFinishConfigureDataTypes, | 562 &SyncBackendHostCore::DoFinishConfigureDataTypes, |
| 582 weak_ptr_factory_.GetWeakPtr(), config_types.to_download, ready_task)); | 563 weak_ptr_factory_.GetWeakPtr(), config_types.to_download, ready_task)); |
| 583 base::Closure chained_retry_task( | 564 base::Closure chained_retry_task( |
| 584 base::Bind(&SyncBackendHostCore::DoRetryConfiguration, | 565 base::Bind(&SyncBackendHostCore::DoRetryConfiguration, |
| 585 weak_ptr_factory_.GetWeakPtr(), retry_callback)); | 566 weak_ptr_factory_.GetWeakPtr(), retry_callback)); |
| 586 sync_manager_->ConfigureSyncer(reason, config_types.to_download, | 567 sync_manager_->ConfigureSyncer(reason, config_types.to_download, |
| 587 config_types.to_purge, config_types.to_journal, | 568 config_types.to_purge, config_types.to_journal, |
| 588 config_types.to_unapply, routing_info, | 569 config_types.to_unapply, routing_info, |
| 589 chained_ready_task, chained_retry_task); | 570 chained_ready_task, chained_retry_task); |
| 590 } | 571 } |
| 591 | 572 |
| 592 void SyncBackendHostCore::DoFinishConfigureDataTypes( | 573 void SyncBackendHostCore::DoFinishConfigureDataTypes( |
| 593 ModelTypeSet types_to_config, | 574 ModelTypeSet types_to_config, |
| 594 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { | 575 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task) { |
| 595 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 576 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 596 | 577 |
| 597 // Update the enabled types for the bridge and sync manager. | 578 // Update the enabled types for the bridge and sync manager. |
| 598 ModelSafeRoutingInfo routing_info; | 579 ModelSafeRoutingInfo routing_info; |
| 599 registrar_->GetModelSafeRoutingInfo(&routing_info); | 580 registrar_->GetModelSafeRoutingInfo(&routing_info); |
| 600 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); | 581 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); |
| 601 enabled_types.RemoveAll(ProxyTypes()); | 582 enabled_types.RemoveAll(ProxyTypes()); |
| 602 | 583 |
| 603 const ModelTypeSet failed_configuration_types = | 584 const ModelTypeSet failed_configuration_types = |
| 604 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); | 585 Difference(types_to_config, sync_manager_->InitialSyncEndedTypes()); |
| 605 const ModelTypeSet succeeded_configuration_types = | 586 const ModelTypeSet succeeded_configuration_types = |
| 606 Difference(types_to_config, failed_configuration_types); | 587 Difference(types_to_config, failed_configuration_types); |
| 607 host_.Call(FROM_HERE, | 588 host_.Call(FROM_HERE, |
| 608 &SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop, | 589 &SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop, |
| 609 enabled_types, succeeded_configuration_types, | 590 enabled_types, succeeded_configuration_types, |
| 610 failed_configuration_types, ready_task); | 591 failed_configuration_types, ready_task); |
| 611 } | 592 } |
| 612 | 593 |
| 613 void SyncBackendHostCore::DoRetryConfiguration( | 594 void SyncBackendHostCore::DoRetryConfiguration( |
| 614 const base::Closure& retry_callback) { | 595 const base::Closure& retry_callback) { |
| 615 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 596 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 616 host_.Call(FROM_HERE, &SyncBackendHostImpl::RetryConfigurationOnFrontendLoop, | 597 host_.Call(FROM_HERE, &SyncBackendHostImpl::RetryConfigurationOnFrontendLoop, |
| 617 retry_callback); | 598 retry_callback); |
| 618 } | 599 } |
| 619 | 600 |
| 620 void SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding() { | 601 void SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding() { |
| 621 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 602 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 622 forward_protocol_events_ = true; | 603 forward_protocol_events_ = true; |
| 623 | 604 |
| 624 if (sync_manager_) { | 605 if (sync_manager_) { |
| 625 // Grab our own copy of the buffered events. | 606 // Grab our own copy of the buffered events. |
| 626 // The buffer is not modified by this operation. | 607 // The buffer is not modified by this operation. |
| 627 std::vector<std::unique_ptr<ProtocolEvent>> buffered_events = | 608 std::vector<std::unique_ptr<ProtocolEvent>> buffered_events = |
| 628 sync_manager_->GetBufferedProtocolEvents(); | 609 sync_manager_->GetBufferedProtocolEvents(); |
| 629 | 610 |
| 630 // Send them all over the fence to the host. | 611 // Send them all over the fence to the host. |
| 631 for (auto& event : buffered_events) { | 612 for (auto& event : buffered_events) { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 656 if (!forward_type_info_) | 637 if (!forward_type_info_) |
| 657 return; | 638 return; |
| 658 | 639 |
| 659 forward_type_info_ = false; | 640 forward_type_info_ = false; |
| 660 | 641 |
| 661 if (sync_manager_->HasDirectoryTypeDebugInfoObserver(this)) | 642 if (sync_manager_->HasDirectoryTypeDebugInfoObserver(this)) |
| 662 sync_manager_->UnregisterDirectoryTypeDebugInfoObserver(this); | 643 sync_manager_->UnregisterDirectoryTypeDebugInfoObserver(this); |
| 663 } | 644 } |
| 664 | 645 |
| 665 void SyncBackendHostCore::DeleteSyncDataFolder() { | 646 void SyncBackendHostCore::DeleteSyncDataFolder() { |
| 666 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 647 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 667 if (base::DirectoryExists(sync_data_folder_path_)) { | 648 if (base::DirectoryExists(sync_data_folder_path_)) { |
| 668 if (!base::DeleteFile(sync_data_folder_path_, true)) | 649 if (!base::DeleteFile(sync_data_folder_path_, true)) |
| 669 SLOG(DFATAL) << "Could not delete the Sync Data folder."; | 650 SLOG(DFATAL) << "Could not delete the Sync Data folder."; |
| 670 } | 651 } |
| 671 } | 652 } |
| 672 | 653 |
| 673 void SyncBackendHostCore::StartSavingChanges() { | 654 void SyncBackendHostCore::StartSavingChanges() { |
| 674 // We may already be shut down. | 655 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 675 if (!sync_loop_) | |
| 676 return; | |
| 677 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | |
| 678 DCHECK(!save_changes_timer_.get()); | 656 DCHECK(!save_changes_timer_.get()); |
| 679 save_changes_timer_ = base::MakeUnique<base::RepeatingTimer>(); | 657 save_changes_timer_ = base::MakeUnique<base::RepeatingTimer>(); |
| 680 save_changes_timer_->Start( | 658 save_changes_timer_->Start( |
| 681 FROM_HERE, base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), | 659 FROM_HERE, base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), |
| 682 this, &SyncBackendHostCore::SaveChanges); | 660 this, &SyncBackendHostCore::SaveChanges); |
| 683 } | 661 } |
| 684 | 662 |
| 685 void SyncBackendHostCore::SaveChanges() { | 663 void SyncBackendHostCore::SaveChanges() { |
| 686 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 664 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 687 sync_manager_->SaveChanges(); | 665 sync_manager_->SaveChanges(); |
| 688 } | 666 } |
| 689 | 667 |
| 690 void SyncBackendHostCore::DoClearServerData( | 668 void SyncBackendHostCore::DoClearServerData( |
| 691 const SyncManager::ClearServerDataCallback& frontend_callback) { | 669 const SyncManager::ClearServerDataCallback& frontend_callback) { |
| 692 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 670 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 693 const SyncManager::ClearServerDataCallback callback = | 671 const SyncManager::ClearServerDataCallback callback = |
| 694 base::Bind(&SyncBackendHostCore::ClearServerDataDone, | 672 base::Bind(&SyncBackendHostCore::ClearServerDataDone, |
| 695 weak_ptr_factory_.GetWeakPtr(), frontend_callback); | 673 weak_ptr_factory_.GetWeakPtr(), frontend_callback); |
| 696 sync_manager_->ClearServerData(callback); | 674 sync_manager_->ClearServerData(callback); |
| 697 } | 675 } |
| 698 | 676 |
| 699 void SyncBackendHostCore::DoOnCookieJarChanged(bool account_mismatch, | 677 void SyncBackendHostCore::DoOnCookieJarChanged(bool account_mismatch, |
| 700 bool empty_jar) { | 678 bool empty_jar) { |
| 701 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 679 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 702 sync_manager_->OnCookieJarChanged(account_mismatch, empty_jar); | 680 sync_manager_->OnCookieJarChanged(account_mismatch, empty_jar); |
| 703 } | 681 } |
| 704 | 682 |
| 705 void SyncBackendHostCore::ClearServerDataDone( | 683 void SyncBackendHostCore::ClearServerDataDone( |
| 706 const base::Closure& frontend_callback) { | 684 const base::Closure& frontend_callback) { |
| 707 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 685 DCHECK(sync_task_runner_->BelongsToCurrentThread()); |
| 708 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, | 686 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, |
| 709 frontend_callback); | 687 frontend_callback); |
| 710 } | 688 } |
| 711 | 689 |
| 712 } // namespace syncer | 690 } // namespace syncer |
| OLD | NEW |