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

Side by Side Diff: components/sync/driver/model_association_manager.cc

Issue 2641523004: [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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 <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
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());
maxbogue 2017/01/18 01:24:11 Do you need to thread this call through DataTypeMa
pavely 2017/01/18 20:18:07 All the code that deals with registering types is
172 dtc->LoadModels(base::Bind(&ModelAssociationManager::ModelLoadCallback, 173 dtc->LoadModels(base::Bind(&ModelAssociationManager::ModelLoadCallback,
173 weak_ptr_factory_.GetWeakPtr())); 174 weak_ptr_factory_.GetWeakPtr()));
174 } 175 }
175 } 176 }
176 NotifyDelegateIfReadyForConfigure(); 177 NotifyDelegateIfReadyForConfigure();
177 } 178 }
178 179
179 void ModelAssociationManager::StartAssociationAsync( 180 void ModelAssociationManager::StartAssociationAsync(
180 const ModelTypeSet& types_to_associate) { 181 const ModelTypeSet& types_to_associate) {
181 DCHECK_EQ(INITIALIZED, state_); 182 DCHECK_EQ(INITIALIZED, state_);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // At least one type is not ready. 409 // At least one type is not ready.
409 return; 410 return;
410 } 411 }
411 } 412 }
412 413
413 notified_about_ready_for_configure_ = true; 414 notified_about_ready_for_configure_ = true;
414 delegate_->OnAllDataTypesReadyForConfigure(); 415 delegate_->OnAllDataTypesReadyForConfigure();
415 } 416 }
416 417
417 } // namespace syncer 418 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698