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..7882f69798d61c101fdcbd13d06ee7ec29781079 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 { |
@@ -19,7 +20,8 @@ class UIModelWorker : public ModelSafeWorker { |
public: |
explicit UIModelWorker(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 +34,12 @@ 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 due to sync stopping. This is needed because |
+ // the UI thread joins the sync thread at shutdown, which creates a deadlock |
+ // if the sync thread is waiting on the UI thread. See crbug.com/663600. |
+ base::WaitableEvent work_done_or_abandoned_; |
+ |
DISALLOW_COPY_AND_ASSIGN(UIModelWorker); |
}; |