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

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: Addressed CR feedback 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 // Callback passed with UnregisterForLoopDestruction. Normally this
Nicolas Zea 2014/10/17 16:16:52 nit: newline above
137 // remains unset/unused and is stored only if |working_loop_| isn't
138 // initialized by the time UnregisterForLoopDestruction is called.
139 // It is safe to copy and thread safe.
140 // See comments in model_safe_worker.cc for more details.
141 base::Callback<void(ModelSafeGroup)> unregister_done_callback_;
137 }; 142 };
138 143
139 // A map that details which ModelSafeGroup each ModelType 144 // A map that details which ModelSafeGroup each ModelType
140 // belongs to. Routing info can change in response to the user enabling / 145 // belongs to. Routing info can change in response to the user enabling /
141 // disabling sync for certain types, as well as model association completions. 146 // disabling sync for certain types, as well as model association completions.
142 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; 147 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo;
143 148
144 // Caller takes ownership of return value. 149 // Caller takes ownership of return value.
145 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue( 150 SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelSafeRoutingInfoToValue(
146 const ModelSafeRoutingInfo& routing_info); 151 const ModelSafeRoutingInfo& routing_info);
147 152
148 SYNC_EXPORT std::string ModelSafeRoutingInfoToString( 153 SYNC_EXPORT std::string ModelSafeRoutingInfoToString(
149 const ModelSafeRoutingInfo& routing_info); 154 const ModelSafeRoutingInfo& routing_info);
150 155
151 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( 156 SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes(
152 const ModelSafeRoutingInfo& routing_info); 157 const ModelSafeRoutingInfo& routing_info);
153 158
154 SYNC_EXPORT ModelSafeGroup GetGroupForModelType( 159 SYNC_EXPORT ModelSafeGroup GetGroupForModelType(
155 const ModelType type, 160 const ModelType type,
156 const ModelSafeRoutingInfo& routes); 161 const ModelSafeRoutingInfo& routes);
157 162
158 } // namespace syncer 163 } // namespace syncer
159 164
160 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ 165 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/ui_model_worker.cc ('k') | sync/internal_api/public/engine/model_safe_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698