OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ | 5 #ifndef COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ | 6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Should only be called after Initialize to start the actual association. | 78 // Should only be called after Initialize to start the actual association. |
79 // |types_to_associate| should be subset of |desired_types| in Initialize(). | 79 // |types_to_associate| should be subset of |desired_types| in Initialize(). |
80 // When this is completed, |OnModelAssociationDone| will be invoked. | 80 // When this is completed, |OnModelAssociationDone| will be invoked. |
81 void StartAssociationAsync(const syncer::ModelTypeSet& types_to_associate); | 81 void StartAssociationAsync(const syncer::ModelTypeSet& types_to_associate); |
82 | 82 |
83 // This is used for TESTING PURPOSE ONLY. The test case can inspect | 83 // This is used for TESTING PURPOSE ONLY. The test case can inspect |
84 // and modify the timer. | 84 // and modify the timer. |
85 // TODO(sync) : This would go away if we made this class be able to do | 85 // TODO(sync) : This would go away if we made this class be able to do |
86 // Dependency injection. crbug.com/129212. | 86 // Dependency injection. crbug.com/129212. |
87 base::OneShotTimer<ModelAssociationManager>* GetTimerForTesting(); | 87 base::OneShotTimer* GetTimerForTesting(); |
88 | 88 |
89 State state() const { return state_; } | 89 State state() const { return state_; } |
90 | 90 |
91 private: | 91 private: |
92 // Called at the end of association to reset state to prepare for next | 92 // Called at the end of association to reset state to prepare for next |
93 // round of association. | 93 // round of association. |
94 void ResetForNextAssociation(); | 94 void ResetForNextAssociation(); |
95 | 95 |
96 // Called by Initialize() to stop types that are not in |desired_types_|. | 96 // Called by Initialize() to stop types that are not in |desired_types_|. |
97 void StopDisabledTypes(); | 97 void StopDisabledTypes(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // types. | 142 // types. |
143 base::TimeTicks association_start_time_; | 143 base::TimeTicks association_start_time_; |
144 | 144 |
145 // Set of all registered controllers. | 145 // Set of all registered controllers. |
146 const DataTypeController::TypeMap* controllers_; | 146 const DataTypeController::TypeMap* controllers_; |
147 | 147 |
148 // The processor in charge of handling model association results. | 148 // The processor in charge of handling model association results. |
149 ModelAssociationManagerDelegate* delegate_; | 149 ModelAssociationManagerDelegate* delegate_; |
150 | 150 |
151 // Timer to track and limit how long a datatype takes to model associate. | 151 // Timer to track and limit how long a datatype takes to model associate. |
152 base::OneShotTimer<ModelAssociationManager> timer_; | 152 base::OneShotTimer timer_; |
153 | 153 |
154 DataTypeManager::ConfigureStatus configure_status_; | 154 DataTypeManager::ConfigureStatus configure_status_; |
155 | 155 |
156 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; | 156 base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_; |
157 | 157 |
158 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); | 158 DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); |
159 }; | 159 }; |
160 | 160 |
161 } // namespace sync_driver | 161 } // namespace sync_driver |
162 | 162 |
163 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ | 163 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ |
OLD | NEW |