Commit c018801b authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

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: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829660}
parent 3b237eb6
...@@ -16,39 +16,6 @@ ...@@ -16,39 +16,6 @@
namespace syncer { 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( ModelLoadManager::ModelLoadManager(
const DataTypeController::TypeMap* controllers, const DataTypeController::TypeMap* controllers,
ModelLoadManagerDelegate* processor) ModelLoadManagerDelegate* processor)
...@@ -161,11 +128,10 @@ void ModelLoadManager::StopDatatypeImpl( ...@@ -161,11 +128,10 @@ void ModelLoadManager::StopDatatypeImpl(
} }
void ModelLoadManager::LoadDesiredTypes() { void ModelLoadManager::LoadDesiredTypes() {
// Load in kStartOrder. // Note: |desired_types_| might be modified during iteration (e.g. in
for (ModelType type : kStartOrder) { // ModelLoadCallback()), so make a copy.
if (!desired_types_.Has(type)) const ModelTypeSet types = desired_types_;
continue; for (ModelType type : types) {
auto dtc_iter = controllers_->find(type); auto dtc_iter = controllers_->find(type);
DCHECK(dtc_iter != controllers_->end()); DCHECK(dtc_iter != controllers_->end());
DataTypeController* dtc = dtc_iter->second.get(); DataTypeController* dtc = dtc_iter->second.get();
......
...@@ -265,7 +265,6 @@ the next client restart. ...@@ -265,7 +265,6 @@ the next client restart.
[`ChromeSyncClient::CreateDataTypeControllers`][CreateDataTypeControllers]. [`ChromeSyncClient::CreateDataTypeControllers`][CreateDataTypeControllers].
* Add your KeyedService dependency to * Add your KeyedService dependency to
[`ProfileSyncServiceFactory`][ProfileSyncServiceFactory]. [`ProfileSyncServiceFactory`][ProfileSyncServiceFactory].
* Add to the [start order list][kStartOrder].
* Add an field for encrypted data to [`NigoriSpecifics`][NigoriSpecifics]. * Add an field for encrypted data to [`NigoriSpecifics`][NigoriSpecifics].
* If your type should have its own toggle in sync settings, add an entry to * If your type should have its own toggle in sync settings, add an entry to
the [`UserSelectableType`][UserSelectableType] enum, add a the [`UserSelectableType`][UserSelectableType] enum, add a
...@@ -285,7 +284,6 @@ the next client restart. ...@@ -285,7 +284,6 @@ the next client restart.
[CreateCommonDataTypeControllers]: https://cs.chromium.org/search/?q="ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers" [CreateCommonDataTypeControllers]: https://cs.chromium.org/search/?q="ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers"
[CreateDataTypeControllers]: https://cs.chromium.org/search/?q="ChromeSyncClient::CreateDataTypeControllers" [CreateDataTypeControllers]: https://cs.chromium.org/search/?q="ChromeSyncClient::CreateDataTypeControllers"
[ProfileSyncServiceFactory]: https://cs.chromium.org/search/?q=:ProfileSyncServiceFactory%5C(%5C) [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 [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" [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 [pref_names]: https://cs.chromium.org/chromium/src/components/sync/base/pref_names.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment