| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 // Returns true if any requested types currently need to start model | 92 // Returns true if any requested types currently need to start model |
| 93 // association. If non-null, fills |needs_start| with all such controllers. | 93 // association. If non-null, fills |needs_start| with all such controllers. |
| 94 bool GetControllersNeedingStart( | 94 bool GetControllersNeedingStart( |
| 95 std::vector<DataTypeController*>* needs_start); | 95 std::vector<DataTypeController*>* needs_start); |
| 96 | 96 |
| 97 // Callback passed to each data type controller on starting association. This | 97 // Callback passed to each data type controller on starting association. This |
| 98 // callback will be invoked when the model association is done. | 98 // callback will be invoked when the model association is done. |
| 99 void TypeStartCallback(DataTypeController::StartResult result, | 99 void TypeStartCallback(DataTypeController::StartResult result, |
| 100 const SyncError& error); | 100 const csync::SyncError& error); |
| 101 | 101 |
| 102 // Callback that will be invoked when the models finish loading. This callback | 102 // Callback that will be invoked when the models finish loading. This callback |
| 103 // will be passed to |LoadModels| function. | 103 // will be passed to |LoadModels| function. |
| 104 void ModelLoadCallback(syncable::ModelType type, SyncError error); | 104 void ModelLoadCallback(syncable::ModelType type, csync::SyncError error); |
| 105 | 105 |
| 106 // Calls the |LoadModels| method on the next controller waiting to start. | 106 // Calls the |LoadModels| method on the next controller waiting to start. |
| 107 void LoadModelForNextType(); | 107 void LoadModelForNextType(); |
| 108 | 108 |
| 109 // Calls |StartAssociating| on the next available controller whose models are | 109 // Calls |StartAssociating| on the next available controller whose models are |
| 110 // loaded. | 110 // loaded. |
| 111 void StartAssociatingNextType(); | 111 void StartAssociatingNextType(); |
| 112 | 112 |
| 113 // When a type fails to load or fails associating this method is invoked to | 113 // When a type fails to load or fails associating this method is invoked to |
| 114 // do the book keeping and do the UMA reporting. | 114 // do the book keeping and do the UMA reporting. |
| 115 void AppendToFailedDatatypesAndLogError( | 115 void AppendToFailedDatatypesAndLogError( |
| 116 DataTypeController::StartResult result, | 116 DataTypeController::StartResult result, |
| 117 const SyncError& error); | 117 const csync::SyncError& error); |
| 118 | 118 |
| 119 syncable::ModelTypeSet GetTypesWaitingToLoad(); | 119 syncable::ModelTypeSet GetTypesWaitingToLoad(); |
| 120 | 120 |
| 121 | 121 |
| 122 State state_; | 122 State state_; |
| 123 syncable::ModelTypeSet desired_types_; | 123 syncable::ModelTypeSet desired_types_; |
| 124 std::list<SyncError> failed_datatypes_info_; | 124 std::list<csync::SyncError> failed_datatypes_info_; |
| 125 std::map<syncable::ModelType, int> start_order_; | 125 std::map<syncable::ModelType, int> start_order_; |
| 126 | 126 |
| 127 // This illustration explains the movement of one DTC through various lists. | 127 // This illustration explains the movement of one DTC through various lists. |
| 128 // Consider a dataype, say, BOOKMARKS which is NOT_RUNNING and will be | 128 // Consider a dataype, say, BOOKMARKS which is NOT_RUNNING and will be |
| 129 // configured now. | 129 // configured now. |
| 130 // Initially all lists are empty. BOOKMARKS is in the |controllers_| | 130 // Initially all lists are empty. BOOKMARKS is in the |controllers_| |
| 131 // map. Here is how the controller moves to various list | 131 // map. Here is how the controller moves to various list |
| 132 // (indicated by arrows). The first column is the method that causes the | 132 // (indicated by arrows). The first column is the method that causes the |
| 133 // transition. | 133 // transition. |
| 134 // Step 1 : |Initialize| - |controllers_| -> |needs_start_| | 134 // Step 1 : |Initialize| - |controllers_| -> |needs_start_| |
| (...skipping 25 matching lines...) Expand all Loading... |
| 160 | 160 |
| 161 // Set of all registered controllers. | 161 // Set of all registered controllers. |
| 162 const DataTypeController::TypeMap* controllers_; | 162 const DataTypeController::TypeMap* controllers_; |
| 163 ModelAssociationResultProcessor* result_processor_; | 163 ModelAssociationResultProcessor* result_processor_; |
| 164 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; | 164 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; |
| 165 base::OneShotTimer<ModelAssociationManager> timer_; | 165 base::OneShotTimer<ModelAssociationManager> timer_; |
| 166 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); | 166 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); |
| 167 }; | 167 }; |
| 168 } // namespace browser_sync | 168 } // namespace browser_sync |
| 169 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ | 169 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATION_MANAGER_H__ |
| OLD | NEW |