Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: components/sync_driver/model_association_manager.cc

Issue 585643003: [Sync] Fix error handling during startup scenarios (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/model_association_manager.h" 5 #include "components/sync_driver/model_association_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ResetForNextAssociation(); 281 ResetForNextAssociation();
282 282
283 state_ = IDLE; 283 state_ = IDLE;
284 } 284 }
285 285
286 void ModelAssociationManager::ModelLoadCallback(syncer::ModelType type, 286 void ModelAssociationManager::ModelLoadCallback(syncer::ModelType type,
287 syncer::SyncError error) { 287 syncer::SyncError error) {
288 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for " 288 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for "
289 << syncer::ModelTypeToString(type); 289 << syncer::ModelTypeToString(type);
290 290
291 // This happens when slow loading type is disabled by new configuration.
292 if (!desired_types_.Has(type))
293 return;
294
295 DCHECK(!loaded_types_.Has(type));
296 if (error.IsSet()) { 291 if (error.IsSet()) {
297 syncer::SyncMergeResult local_merge_result(type); 292 syncer::SyncMergeResult local_merge_result(type);
298 local_merge_result.set_error(error); 293 local_merge_result.set_error(error);
299 TypeStartCallback(type, 294 TypeStartCallback(type,
300 base::TimeTicks::Now(), 295 base::TimeTicks::Now(),
301 DataTypeController::ASSOCIATION_FAILED, 296 DataTypeController::ASSOCIATION_FAILED,
302 local_merge_result, 297 local_merge_result,
303 syncer::SyncMergeResult(type)); 298 syncer::SyncMergeResult(type));
304 return; 299 return;
305 } 300 }
306 301
302 // This happens when slow loading type is disabled by new configuration.
303 if (!desired_types_.Has(type))
304 return;
305
306 DCHECK(!loaded_types_.Has(type));
307 loaded_types_.Put(type); 307 loaded_types_.Put(type);
308 if (associating_types_.Has(type)) { 308 if (associating_types_.Has(type)) {
309 DataTypeController* dtc = controllers_->find(type)->second.get(); 309 DataTypeController* dtc = controllers_->find(type)->second.get();
310 dtc->StartAssociating( 310 dtc->StartAssociating(
311 base::Bind(&ModelAssociationManager::TypeStartCallback, 311 base::Bind(&ModelAssociationManager::TypeStartCallback,
312 weak_ptr_factory_.GetWeakPtr(), 312 weak_ptr_factory_.GetWeakPtr(),
313 type, base::TimeTicks::Now())); 313 type, base::TimeTicks::Now()));
314 } 314 }
315 } 315 }
316 316
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 delegate_->OnModelAssociationDone(result); 409 delegate_->OnModelAssociationDone(result);
410 } 410 }
411 411
412 base::OneShotTimer<ModelAssociationManager>* 412 base::OneShotTimer<ModelAssociationManager>*
413 ModelAssociationManager::GetTimerForTesting() { 413 ModelAssociationManager::GetTimerForTesting() {
414 return &timer_; 414 return &timer_;
415 } 415 }
416 416
417 } // namespace sync_driver 417 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/fake_data_type_controller.cc ('k') | components/sync_driver/non_ui_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698