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 base::WaitableEvent working_loop_set_wait_; | 136 |
| 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_; |
137 }; | 143 }; |
138 | 144 |
139 // A map that details which ModelSafeGroup each ModelType | 145 // A map that details which ModelSafeGroup each ModelType |
140 // belongs to. Routing info can change in response to the user enabling / | 146 // belongs to. Routing info can change in response to the user enabling / |
141 // disabling sync for certain types, as well as model association completions. | 147 // disabling sync for certain types, as well as model association completions. |
142 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; | 148 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; |
143 | 149 |
144 // Caller takes ownership of return value. | 150 // Caller takes ownership of return value. |
145 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( | 151 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( |
146 const ModelSafeRoutingInfo& routing_info); | 152 const ModelSafeRoutingInfo& routing_info); |
147 | 153 |
148 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( | 154 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( |
149 const ModelSafeRoutingInfo& routing_info); | 155 const ModelSafeRoutingInfo& routing_info); |
150 | 156 |
151 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( | 157 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( |
152 const ModelSafeRoutingInfo& routing_info); | 158 const ModelSafeRoutingInfo& routing_info); |
153 | 159 |
154 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( | 160 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( |
155 const ModelType type, | 161 const ModelType type, |
156 const ModelSafeRoutingInfo& routes); | 162 const ModelSafeRoutingInfo& routes); |
157 | 163 |
158 } // namespace syncer | 164 } // namespace syncer |
159 | 165 |
160 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 166 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
OLD | NEW |