OLD | NEW |
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 SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // is to be destroyed so no more work can be done. | 126 // is to be destroyed so no more work can be done. |
127 base::WaitableEvent work_done_or_stopped_; | 127 base::WaitableEvent work_done_or_stopped_; |
128 | 128 |
129 // Notified when working thread of the worker is to be destroyed. | 129 // Notified when working thread of the worker is to be destroyed. |
130 WorkerLoopDestructionObserver* observer_; | 130 WorkerLoopDestructionObserver* observer_; |
131 | 131 |
132 // Remember working loop for posting task to unregister destruction | 132 // Remember working loop for posting task to unregister destruction |
133 // observation from sync thread when shutting down sync. | 133 // observation from sync thread when shutting down sync. |
134 base::Lock working_loop_lock_; | 134 base::Lock working_loop_lock_; |
135 base::MessageLoop* working_loop_; | 135 base::MessageLoop* working_loop_; |
136 | 136 base::WaitableEvent working_loop_set_wait_; |
137 // Callback passed with UnregisterForLoopDestruction. Normally this | |
138 // remains unset/unused and is stored only if |working_loop_| isn't | |
139 // initialized by the time UnregisterForLoopDestruction is called. | |
140 // It is safe to copy and thread safe. | |
141 // See comments in model_safe_worker.cc for more details. | |
142 base::Callback<void(ModelSafeGroup)> unregister_done_callback_; | |
143 }; | 137 }; |
144 | 138 |
145 // A map that details which ModelSafeGroup each ModelType | 139 // A map that details which ModelSafeGroup each ModelType |
146 // belongs to. Routing info can change in response to the user enabling / | 140 // belongs to. Routing info can change in response to the user enabling / |
147 // disabling sync for certain types, as well as model association completions. | 141 // disabling sync for certain types, as well as model association completions. |
148 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; | 142 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; |
149 | 143 |
150 // Caller takes ownership of return value. | 144 // Caller takes ownership of return value. |
151 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( | 145 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( |
152 const ModelSafeRoutingInfo& routing_info); | 146 const ModelSafeRoutingInfo& routing_info); |
153 | 147 |
154 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( | 148 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( |
155 const ModelSafeRoutingInfo& routing_info); | 149 const ModelSafeRoutingInfo& routing_info); |
156 | 150 |
157 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( | 151 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( |
158 const ModelSafeRoutingInfo& routing_info); | 152 const ModelSafeRoutingInfo& routing_info); |
159 | 153 |
160 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( | 154 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( |
161 const ModelType type, | 155 const ModelType type, |
162 const ModelSafeRoutingInfo& routes); | 156 const ModelSafeRoutingInfo& routes); |
163 | 157 |
164 } // namespace syncer | 158 } // namespace syncer |
165 | 159 |
166 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 160 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
OLD | NEW |