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

Side by Side Diff: chrome/browser/sync/glue/model_association_manager.h

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 30 matching lines...) Expand all
41 class ModelAssociationManager { 41 class ModelAssociationManager {
42 public: 42 public:
43 ModelAssociationManager(const DataTypeController::TypeMap* controllers, 43 ModelAssociationManager(const DataTypeController::TypeMap* controllers,
44 ModelAssociationResultProcessor* processor); 44 ModelAssociationResultProcessor* processor);
45 virtual ~ModelAssociationManager(); 45 virtual ~ModelAssociationManager();
46 46
47 // Initializes the state to do the model association in future. This 47 // Initializes the state to do the model association in future. This
48 // should be called before communicating with sync server. A subsequent call 48 // should be called before communicating with sync server. A subsequent call
49 // of Initialize is only allowed if the ModelAssociationManager has invoked 49 // of Initialize is only allowed if the ModelAssociationManager has invoked
50 // |OnModelAssociationDone| on the |ModelAssociationResultProcessor|. 50 // |OnModelAssociationDone| on the |ModelAssociationResultProcessor|.
51 void Initialize(syncable::ModelTypeSet desired_types); 51 void Initialize(syncer::ModelTypeSet desired_types);
52 52
53 // Can be called at any time. Synchronously stops all datatypes. 53 // Can be called at any time. Synchronously stops all datatypes.
54 void Stop(); 54 void Stop();
55 55
56 // Should only be called after Initialize. 56 // Should only be called after Initialize.
57 // Starts the actual association. When this is completed 57 // Starts the actual association. When this is completed
58 // |OnModelAssociationDone| would be called invoked. 58 // |OnModelAssociationDone| would be called invoked.
59 void StartAssociationAsync(); 59 void StartAssociationAsync();
60 60
61 // It is valid to call this only when we are initialized to configure 61 // It is valid to call this only when we are initialized to configure
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 syncer::SyncError& error); 100 const syncer::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, syncer::SyncError error); 104 void ModelLoadCallback(syncer::ModelType type, syncer::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 syncer::SyncError& error); 117 const syncer::SyncError& error);
118 118
119 syncable::ModelTypeSet GetTypesWaitingToLoad(); 119 syncer::ModelTypeSet GetTypesWaitingToLoad();
120 120
121 121
122 State state_; 122 State state_;
123 syncable::ModelTypeSet desired_types_; 123 syncer::ModelTypeSet desired_types_;
124 std::list<syncer::SyncError> failed_datatypes_info_; 124 std::list<syncer::SyncError> failed_datatypes_info_;
125 std::map<syncable::ModelType, int> start_order_; 125 std::map<syncer::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_|
135 // Step 2 : |LoadModelForNextType| - |needs_start_| -> |pending_model_load_| 135 // Step 2 : |LoadModelForNextType| - |needs_start_| -> |pending_model_load_|
(...skipping 24 matching lines...) Expand all
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__
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.cc ('k') | chrome/browser/sync/glue/model_association_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698