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

Side by Side Diff: components/sync/driver/glue/sync_backend_registrar.h

Issue 2507913002: [Sync] Remove some unnecessary typedefs in SyncBackendRegistrar. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | components/sync/driver/glue/sync_backend_registrar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_ 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void OnChangesApplied(ModelType model_type, 109 void OnChangesApplied(ModelType model_type,
110 int64_t model_version, 110 int64_t model_version,
111 const BaseTransaction* trans, 111 const BaseTransaction* trans,
112 const ImmutableChangeRecordList& changes) override; 112 const ImmutableChangeRecordList& changes) override;
113 void OnChangesComplete(ModelType model_type) override; 113 void OnChangesComplete(ModelType model_type) override;
114 114
115 void GetWorkers(std::vector<scoped_refptr<ModelSafeWorker>>* out); 115 void GetWorkers(std::vector<scoped_refptr<ModelSafeWorker>>* out);
116 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out); 116 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out);
117 117
118 private: 118 private:
119 typedef std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker>> WorkerMap;
120 typedef std::map<ModelType, ChangeProcessor*> ProcessorMap;
121
122 // Add a worker for |group| to the worker map if one is successfully created 119 // Add a worker for |group| to the worker map if one is successfully created
123 // by |worker_factory|. 120 // by |worker_factory|.
124 void MaybeAddWorker(ModelSafeWorkerFactory worker_factory, 121 void MaybeAddWorker(ModelSafeWorkerFactory worker_factory,
125 ModelSafeGroup group); 122 ModelSafeGroup group);
126 123
127 // Returns the change processor for the given model, or null if none 124 // Returns the change processor for the given model, or null if none
128 // exists. Must be called from |group|'s native thread. 125 // exists. Must be called from |group|'s native thread.
129 ChangeProcessor* GetProcessor(ModelType type) const; 126 ChangeProcessor* GetProcessor(ModelType type) const;
130 127
131 // Must be called with |lock_| held. Simply returns the change 128 // Must be called with |lock_| held. Simply returns the change
(...skipping 13 matching lines...) Expand all
145 // Name used for debugging. 142 // Name used for debugging.
146 const std::string name_; 143 const std::string name_;
147 144
148 // Checker for the UI thread (where this object is constructed). 145 // Checker for the UI thread (where this object is constructed).
149 base::ThreadChecker ui_thread_checker_; 146 base::ThreadChecker ui_thread_checker_;
150 147
151 // Protects all variables below. 148 // Protects all variables below.
152 mutable base::Lock lock_; 149 mutable base::Lock lock_;
153 150
154 // Workers created by this SyncBackendRegistrar. 151 // Workers created by this SyncBackendRegistrar.
155 WorkerMap workers_; 152 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker>> workers_;
156
157 ModelSafeRoutingInfo routing_info_;
158 153
159 // The change processors that handle the different data types. 154 // The change processors that handle the different data types.
160 ProcessorMap processors_; 155 std::map<ModelType, ChangeProcessor*> processors_;
156
157 // Maps ModelType to ModelSafeGroup.
158 ModelSafeRoutingInfo routing_info_;
161 159
162 // The types that were enabled as of the last configuration. Updated on each 160 // The types that were enabled as of the last configuration. Updated on each
163 // call to ConfigureDataTypes as well as SetInitialTypes. 161 // call to ConfigureDataTypes as well as SetInitialTypes.
164 ModelTypeSet last_configured_types_; 162 ModelTypeSet last_configured_types_;
165 163
166 // Set of types with non-blocking implementation (as opposed to directory 164 // Set of types with non-blocking implementation (as opposed to directory
167 // based). 165 // based).
168 ModelTypeSet non_blocking_types_; 166 ModelTypeSet non_blocking_types_;
169 167
170 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); 168 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar);
171 }; 169 };
172 170
173 } // namespace syncer 171 } // namespace syncer
174 172
175 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_ 173 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_REGISTRAR_H_
OLDNEW
« no previous file with comments | « no previous file | components/sync/driver/glue/sync_backend_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698