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

Unified Diff: components/sync/driver/glue/ui_model_worker.h

Issue 2496723003: [Sync] Signal UIModelWorker to abort on sync shutdown. (Closed)
Patch Set: Created 4 years, 1 month 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: components/sync/driver/glue/ui_model_worker.h
diff --git a/components/sync/driver/glue/ui_model_worker.h b/components/sync/driver/glue/ui_model_worker.h
index c3f76946a1fe0fa0b0e44eab19723e1bc047d1e0..8b8cfc8925ab6dd0134fd07655b9cb54257e011d 100644
--- a/components/sync/driver/glue/ui_model_worker.h
+++ b/components/sync/driver/glue/ui_model_worker.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
+#include "base/synchronization/waitable_event.h"
#include "components/sync/engine/model_safe_worker.h"
namespace syncer {
@@ -17,9 +18,11 @@ namespace syncer {
// from the MessageLoop home to the native model.
class UIModelWorker : public ModelSafeWorker {
public:
- explicit UIModelWorker(scoped_refptr<base::SingleThreadTaskRunner> ui_thread);
+ explicit UIModelWorker(
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread);
- // ModelSafeWorker implementation. Called on syncapi SyncerThread.
+ // ModelSafeWorker implementation.
+ void RequestStop() override;
ModelSafeGroup GetModelSafeGroup() override;
bool IsOnModelThread() override;
@@ -32,6 +35,10 @@ class UIModelWorker : public ModelSafeWorker {
// A reference to the UI thread's task runner.
const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
+ // Signal set when work on native thread is done, aborted due to the thread
+ // being torn down, or aborted do to sync stopping.
Nicolas Zea 2016/11/10 22:27:07 typo: do -> due
Nicolas Zea 2016/11/10 22:27:07 nit: i think it's worth explaining why we need thi
maxbogue 2016/11/12 03:19:52 Done.
maxbogue 2016/11/12 03:19:52 Done.
+ base::WaitableEvent work_done_or_abandoned_;
+
DISALLOW_COPY_AND_ASSIGN(UIModelWorker);
};
« no previous file with comments | « no previous file | components/sync/driver/glue/ui_model_worker.cc » ('j') | components/sync/driver/glue/ui_model_worker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698