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

Unified Diff: chrome/browser/sync/glue/ui_model_worker.h

Issue 14046031: Worker changes to prepare for lock-free shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/ui_model_worker.h
diff --git a/chrome/browser/sync/glue/ui_model_worker.h b/chrome/browser/sync/glue/ui_model_worker.h
index 8704ec4b836c0170ca42cfbb895e8f30932a58aa..95d136af40fcfe687af9c399de7265da2baab259 100644
--- a/chrome/browser/sync/glue/ui_model_worker.h
+++ b/chrome/browser/sync/glue/ui_model_worker.h
@@ -24,7 +24,7 @@ namespace browser_sync {
// after the actual syncer pthread has exited.
class UIModelWorker : public syncer::ModelSafeWorker {
public:
- UIModelWorker();
+ UIModelWorker(syncer::WorkerObserver* observer);
// Called by the UI thread on shutdown of the sync service. Blocks until
// the UIModelWorker has safely met termination conditions, namely that
@@ -33,8 +33,7 @@ class UIModelWorker : public syncer::ModelSafeWorker {
void Stop();
// syncer::ModelSafeWorker implementation. Called on syncapi SyncerThread.
- virtual syncer::SyncerError DoWorkAndWaitUntilDone(
- const syncer::WorkCallback& work) OVERRIDE;
+ virtual void RegisterForLoopDestruction() OVERRIDE;
virtual syncer::ModelSafeGroup GetModelSafeGroup() OVERRIDE;
// Upon receiving this idempotent call, the syncer::ModelSafeWorker can
@@ -47,6 +46,11 @@ class UIModelWorker : public syncer::ModelSafeWorker {
// Called on ui loop.
void OnTaskCompleted() { pending_work_.Reset(); }
+ protected:
+ virtual syncer::SyncerError DoWorkAndWaitUntilDone(
+ const syncer::WorkCallback& work,
+ base::WaitableEvent* work_done) OVERRIDE;
+
private:
// The life-cycle of a UIModelWorker in three states.
enum State {
@@ -66,6 +70,10 @@ class UIModelWorker : public syncer::ModelSafeWorker {
virtual ~UIModelWorker();
+ void CallDoWorkAndSignalCallback(const syncer::WorkCallback& work,
+ base::WaitableEvent* work_done,
+ syncer::SyncerError* error_info);
+
// This is set by the UI thread, but is not explicitly thread safe, so only
// read this value from other threads when you know it is absolutely safe.
State state_;

Powered by Google App Engine
This is Rietveld 408576698