| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 for (size_t i = 0; i < arraysize(kStartOrder); i++) { | 162 for (size_t i = 0; i < arraysize(kStartOrder); i++) { |
| 163 ModelType type = kStartOrder[i]; | 163 ModelType type = kStartOrder[i]; |
| 164 if (!desired_types_.Has(type)) | 164 if (!desired_types_.Has(type)) |
| 165 continue; | 165 continue; |
| 166 | 166 |
| 167 DCHECK(controllers_->find(type) != controllers_->end()); | 167 DCHECK(controllers_->find(type) != controllers_->end()); |
| 168 DataTypeController* dtc = controllers_->find(type)->second.get(); | 168 DataTypeController* dtc = controllers_->find(type)->second.get(); |
| 169 if (dtc->state() == DataTypeController::NOT_RUNNING) { | 169 if (dtc->state() == DataTypeController::NOT_RUNNING) { |
| 170 DCHECK(!loaded_types_.Has(dtc->type())); | 170 DCHECK(!loaded_types_.Has(dtc->type())); |
| 171 DCHECK(!associated_types_.Has(dtc->type())); | 171 DCHECK(!associated_types_.Has(dtc->type())); |
| 172 delegate_->OnSingleDataTypeWillStart(dtc->type()); | |
| 173 dtc->LoadModels(base::Bind(&ModelAssociationManager::ModelLoadCallback, | 172 dtc->LoadModels(base::Bind(&ModelAssociationManager::ModelLoadCallback, |
| 174 weak_ptr_factory_.GetWeakPtr())); | 173 weak_ptr_factory_.GetWeakPtr())); |
| 175 } | 174 } |
| 176 } | 175 } |
| 177 NotifyDelegateIfReadyForConfigure(); | 176 NotifyDelegateIfReadyForConfigure(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 void ModelAssociationManager::StartAssociationAsync( | 179 void ModelAssociationManager::StartAssociationAsync( |
| 181 const ModelTypeSet& types_to_associate) { | 180 const ModelTypeSet& types_to_associate) { |
| 182 DCHECK_EQ(INITIALIZED, state_); | 181 DCHECK_EQ(INITIALIZED, state_); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // At least one type is not ready. | 408 // At least one type is not ready. |
| 410 return; | 409 return; |
| 411 } | 410 } |
| 412 } | 411 } |
| 413 | 412 |
| 414 notified_about_ready_for_configure_ = true; | 413 notified_about_ready_for_configure_ = true; |
| 415 delegate_->OnAllDataTypesReadyForConfigure(); | 414 delegate_->OnAllDataTypesReadyForConfigure(); |
| 416 } | 415 } |
| 417 | 416 |
| 418 } // namespace syncer | 417 } // namespace syncer |
| OLD | NEW |