Cleanup: Remove kStartOrder from model_load_manager.cc
This was an explicit ordering of all ModelTypes, used to determine the order in which to kick off LoadModels() on all the controllers. However, the next layer (DataTypeManagerImpl) anyway waits until all types have finished loading before continuing with the next stage, so the order really makes no difference. Bug: 1102837 Change-Id: If1c60d9861655c3540218cb06a1f2285872720c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550671 Commit-Queue: Marc Treib <treib@chromium.org> Reviewed-by: Mikel Astiz <mastiz@chromium.org> Cr-Commit-Position: refs/heads/master@{#829660}
This commit is contained in:
@ -16,39 +16,6 @@
|
||||
|
||||
namespace syncer {
|
||||
|
||||
namespace {
|
||||
|
||||
static const ModelType kStartOrder[] = {
|
||||
NIGORI, // Listed for completeness.
|
||||
DEVICE_INFO,
|
||||
PROXY_TABS, // Listed for completeness.
|
||||
|
||||
// Kick off the loading of the non-UI types first so they can load in
|
||||
// parallel with the UI types.
|
||||
// TODO(crbug.com/1102837): Evaluate whether this still makes sense. Loading
|
||||
// is non-blocking, so the order of kicking things off shouldn't matter.
|
||||
PASSWORDS, AUTOFILL, AUTOFILL_PROFILE, AUTOFILL_WALLET_DATA,
|
||||
AUTOFILL_WALLET_METADATA, AUTOFILL_WALLET_OFFER, EXTENSION_SETTINGS,
|
||||
APP_SETTINGS, TYPED_URLS, HISTORY_DELETE_DIRECTIVES,
|
||||
|
||||
// Chrome OS settings affect the initial desktop appearance before the
|
||||
// browser window opens, so start them before browser data types.
|
||||
OS_PRIORITY_PREFERENCES, OS_PREFERENCES,
|
||||
|
||||
// UI thread data types.
|
||||
BOOKMARKS, PREFERENCES, PRIORITY_PREFERENCES, EXTENSIONS, APPS, APP_LIST,
|
||||
ARC_PACKAGE, READING_LIST, THEMES, SEARCH_ENGINES, SESSIONS, DICTIONARY,
|
||||
DEPRECATED_FAVICON_IMAGES, DEPRECATED_FAVICON_TRACKING, PRINTERS,
|
||||
USER_CONSENTS, USER_EVENTS, SHARING_MESSAGE, SUPERVISED_USER_SETTINGS,
|
||||
SUPERVISED_USER_ALLOWLISTS, SEND_TAB_TO_SELF, SECURITY_EVENTS, WEB_APPS,
|
||||
WIFI_CONFIGURATIONS};
|
||||
|
||||
static_assert(base::size(kStartOrder) ==
|
||||
ModelType::NUM_ENTRIES - FIRST_REAL_MODEL_TYPE,
|
||||
"When adding a new type, update kStartOrder.");
|
||||
|
||||
} // namespace
|
||||
|
||||
ModelLoadManager::ModelLoadManager(
|
||||
const DataTypeController::TypeMap* controllers,
|
||||
ModelLoadManagerDelegate* processor)
|
||||
@ -161,11 +128,10 @@ void ModelLoadManager::StopDatatypeImpl(
|
||||
}
|
||||
|
||||
void ModelLoadManager::LoadDesiredTypes() {
|
||||
// Load in kStartOrder.
|
||||
for (ModelType type : kStartOrder) {
|
||||
if (!desired_types_.Has(type))
|
||||
continue;
|
||||
|
||||
// Note: |desired_types_| might be modified during iteration (e.g. in
|
||||
// ModelLoadCallback()), so make a copy.
|
||||
const ModelTypeSet types = desired_types_;
|
||||
for (ModelType type : types) {
|
||||
auto dtc_iter = controllers_->find(type);
|
||||
DCHECK(dtc_iter != controllers_->end());
|
||||
DataTypeController* dtc = dtc_iter->second.get();
|
||||
|
@ -265,7 +265,6 @@ the next client restart.
|
||||
[`ChromeSyncClient::CreateDataTypeControllers`][CreateDataTypeControllers].
|
||||
* Add your KeyedService dependency to
|
||||
[`ProfileSyncServiceFactory`][ProfileSyncServiceFactory].
|
||||
* Add to the [start order list][kStartOrder].
|
||||
* Add an field for encrypted data to [`NigoriSpecifics`][NigoriSpecifics].
|
||||
* If your type should have its own toggle in sync settings, add an entry to
|
||||
the [`UserSelectableType`][UserSelectableType] enum, add a
|
||||
@ -285,7 +284,6 @@ the next client restart.
|
||||
[CreateCommonDataTypeControllers]: https://cs.chromium.org/search/?q="ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers"
|
||||
[CreateDataTypeControllers]: https://cs.chromium.org/search/?q="ChromeSyncClient::CreateDataTypeControllers"
|
||||
[ProfileSyncServiceFactory]: https://cs.chromium.org/search/?q=:ProfileSyncServiceFactory%5C(%5C)
|
||||
[kStartOrder]: https://cs.chromium.org/search/?q="kStartOrder[]"
|
||||
[NigoriSpecifics]: https://cs.chromium.org/chromium/src/components/sync/protocol/nigori_specifics.proto
|
||||
[UserSelectableType]: https://cs.chromium.org/chromium/src/components/sync/base/user_selectable_type.h?type=cs&q="enum+class+UserSelectableType"
|
||||
[pref_names]: https://cs.chromium.org/chromium/src/components/sync/base/pref_names.h
|
||||
|
Reference in New Issue
Block a user