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

Side by Side Diff: sync/internal_api/public/engine/model_safe_worker.h

Issue 637413003: Sync: Avoid deadlock in SyncBackendRegistrar / ModelSafeWorker on sync backend shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed issues with the test Created 6 years, 2 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
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 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
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 base::Callback<void(ModelSafeGroup)> unregister_done_callback_;
Nicolas Zea 2014/10/17 00:04:02 nit: comment what this is for, and its thread safe
stanisc 2014/10/17 06:58:02 Done.
137 }; 137 };
138 138
139 // A map that details which ModelSafeGroup each ModelType 139 // A map that details which ModelSafeGroup each ModelType
140 // 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 /
141 // disabling sync for certain types, as well as model association completions. 141 // disabling sync for certain types, as well as model association completions.
142 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; 142 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo;
143 143
144 // Caller takes ownership of return value. 144 // Caller takes ownership of return value.
145 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( 145 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue(
146 const ModelSafeRoutingInfo& routing_info); 146 const ModelSafeRoutingInfo& routing_info);
147 147
148 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( 148 SYNC_EXPORT std::string ModelSafeRoutingInfoToString(
149 const ModelSafeRoutingInfo& routing_info); 149 const ModelSafeRoutingInfo& routing_info);
150 150
151 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( 151 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes(
152 const ModelSafeRoutingInfo& routing_info); 152 const ModelSafeRoutingInfo& routing_info);
153 153
154 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( 154 SYNC_EXPORT ModelSafeGroup GetGroupForModelType(
155 const ModelType type, 155 const ModelType type,
156 const ModelSafeRoutingInfo& routes); 156 const ModelSafeRoutingInfo& routes);
157 157
158 } // namespace syncer 158 } // namespace syncer
159 159
160 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ 160 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698