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

Unified Diff: components/sync/driver/data_type_manager_impl.h

Issue 2563423005: [Sync] Move ConfigureDataTypes logic into DataTypeManagerImpl. (Closed)
Patch Set: Rebase on Pavel's change. 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 side-by-side diff with in-line comments
Download patch
Index: components/sync/driver/data_type_manager_impl.h
diff --git a/components/sync/driver/data_type_manager_impl.h b/components/sync/driver/data_type_manager_impl.h
index dd6f3ce45280171ce066d0f54b1c812986047be7..63fa3b8bcada870c262500ff4debc27a083ef399 100644
--- a/components/sync/driver/data_type_manager_impl.h
+++ b/components/sync/driver/data_type_manager_impl.h
@@ -72,7 +72,30 @@ class DataTypeManagerImpl : public DataTypeManager,
return &model_association_manager_;
}
+ protected:
+ // Returns the priority types (control + priority user types).
+ // Virtual for overriding during tests.
+ virtual ModelTypeSet GetPriorityTypes() const;
+
+ // The set of types that are enabled inside the sync engine.
+ ModelTypeSet engine_types_;
pavely 2017/01/05 21:32:19 This set represents types which don't need to be d
maxbogue 2017/01/06 18:55:58 I've gone with downloaded_types_, which I think is
+
private:
+ enum DataTypeConfigState {
+ CONFIGURE_ACTIVE, // Actively being configured. Data of such types
+ // will be downloaded if not present locally.
+ CONFIGURE_INACTIVE, // Already configured or to be configured in future.
+ // Data of such types is left as it is, no
+ // downloading or purging.
+ CONFIGURE_CLEAN, // Actively being configured but requiring unapply
+ // and GetUpdates first (e.g. for persistence errors).
+ DISABLED, // Not syncing. Disabled by user.
+ FATAL, // Not syncing due to unrecoverable error.
+ CRYPTO, // Not syncing due to a cryptographer error.
+ UNREADY, // Not syncing due to transient error.
+ };
+ using DataTypeConfigStateMap = std::map<ModelType, DataTypeConfigState>;
+
// Helper enum for identifying which types within a priority group to
// associate.
enum AssociationGroup {
@@ -87,15 +110,24 @@ class DataTypeManagerImpl : public DataTypeManager,
UNREADY_AT_CONFIG,
};
- friend class TestDataTypeManager;
+ // Return model types in |state_map| that match |state|.
+ static ModelTypeSet GetDataTypesInState(
+ DataTypeConfigState state,
+ const DataTypeConfigStateMap& state_map);
+
+ // Set state of |types| in |state_map| to |state|.
+ static void SetDataTypesState(DataTypeConfigState state,
+ ModelTypeSet types,
+ DataTypeConfigStateMap* state_map);
+
+ // Perform a configuration using our local information and inform the
+ // configurer of the result. Returns the set of types that were already ready
+ // for association.
+ ModelTypeSet ConfigureDataTypes();
pavely 2017/01/05 21:32:19 Name "ConfigureDataTypes" can be confused with Con
maxbogue 2017/01/06 18:55:58 Done.
// Abort configuration and stop all data types due to configuration errors.
void Abort(ConfigureStatus status);
- // Returns the priority types (control + priority user types).
- // Virtual for overriding during tests.
- virtual ModelTypeSet GetPriorityTypes() const;
-
// Divide |types| into sets by their priorities and return the sets from
// high priority to low priority.
TypeSetPriorityList PrioritizeTypes(const ModelTypeSet& types);
@@ -123,7 +155,7 @@ class DataTypeManagerImpl : public DataTypeManager,
// Calls data type controllers of requested types to register with backend.
void RegisterTypesWithBackend();
- ModelTypeConfigurer::DataTypeConfigStateMap BuildDataTypeConfigStateMap(
+ DataTypeConfigStateMap BuildDataTypeConfigStateMap(
const ModelTypeSet& types_being_configured) const;
// Start download of next set of types in |download_types_queue_| (if

Powered by Google App Engine
This is Rietveld 408576698