Index: chrome/browser/sync/glue/model_association_manager.h |
diff --git a/chrome/browser/sync/glue/model_association_manager.h b/chrome/browser/sync/glue/model_association_manager.h |
index 1b45e584ff4915071445e4717238956c6007e1cc..ca904851de9a00c7765ef2dc3e9db73ab3a8ee6b 100755 |
--- a/chrome/browser/sync/glue/model_association_manager.h |
+++ b/chrome/browser/sync/glue/model_association_manager.h |
@@ -9,6 +9,7 @@ |
#include <list> |
#include "base/memory/weak_ptr.h" |
+#include "base/timer.h" |
#include "chrome/browser/sync/glue/data_type_manager.h" |
@@ -22,6 +23,11 @@ class ModelAssociationResultProcessor { |
public: |
virtual void OnModelAssociationDone( |
const DataTypeManager::ConfigureResult& result) = 0; |
+ |
+ // when types (that did not complete loading, during the previous |
+ // run of the configure) get loaded this callback is called to let the |
+ // DTM know and request a reconfigure. |
+ virtual void OnTypesLoaded() = 0; |
}; |
// The class that is responsible for model association. |
@@ -56,6 +62,11 @@ class ModelAssociationManager { |
// Stops any disabled types. |
void StopDisabledTypes(); |
+ // This is used for TESTING PURPOSE ONLY. When invoked will |
+ // simulate as though the timeout has been reached for datatype loading. |
+ // Achieves that by stopping the timer and calling the timeout callback. |
+ void TestSimulateDataTypeLoadTimeout(); |
+ |
private: |
enum State { |
// This is the state after |Initialize| is called. |
@@ -89,6 +100,15 @@ class ModelAssociationManager { |
// loaded. |
void StartAssociatingNextType(); |
+ // We have waited long enough and the model has not loaded yet. |
+ void ModelLoadTimedOut(); |
+ |
+ void HandleFailedTypes(DataTypeController::StartResult result, |
+ const SyncError& error); |
+ |
+ syncable::ModelTypeSet GetTypesWaitingToLoad(); |
+ |
+ |
State state_; |
syncable::ModelTypeSet desired_types_; |
std::list<SyncError> failed_datatypes_info_; |
@@ -117,6 +137,7 @@ class ModelAssociationManager { |
const DataTypeController::TypeMap* controllers_; |
ModelAssociationResultProcessor* result_processor_; |
base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; |
+ base::OneShotTimer<ModelAssociationManager> timer_; |
}; |
} // namespace browser_sync |
#endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ |