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

Unified Diff: components/sync/engine/ui_model_worker.h

Issue 2782573002: [Sync] Refactor ModelSafeWorker::DoWorkAndWaitUntilDone() to avoid code duplication. (Closed)
Patch Set: self-review Created 3 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
« no previous file with comments | « components/sync/engine/passive_model_worker.cc ('k') | components/sync/engine/ui_model_worker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/engine/ui_model_worker.h
diff --git a/components/sync/engine/ui_model_worker.h b/components/sync/engine/ui_model_worker.h
index 2306a39c52e652a3f9281a175c0b5d0cf0cf0bba..bff75a8e464d9c42db24abf32eb212993c0468c0 100644
--- a/components/sync/engine/ui_model_worker.h
+++ b/components/sync/engine/ui_model_worker.h
@@ -7,9 +7,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/sequence_checker.h"
#include "base/single_thread_task_runner.h"
-#include "base/synchronization/waitable_event.h"
#include "components/sync/engine/model_safe_worker.h"
namespace syncer {
@@ -22,33 +20,17 @@ class UIModelWorker : public ModelSafeWorker {
explicit UIModelWorker(scoped_refptr<base::SingleThreadTaskRunner> ui_thread);
// ModelSafeWorker implementation.
- void RequestStop() override;
ModelSafeGroup GetModelSafeGroup() override;
bool IsOnModelThread() override;
- protected:
- SyncerError DoWorkAndWaitUntilDoneImpl(const WorkCallback& work) override;
-
private:
~UIModelWorker() override;
+ void ScheduleWork(base::OnceClosure work) override;
+
// A reference to the UI thread's task runner.
const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
- // Signaled when a task posted by DoWorkAndWaitUntilDoneImpl() is deleted,
- // i.e. after it runs or when it is abandoned. Reset at the beginning of every
- // DoWorkAndWaitUntilDoneImpl() call.
- base::WaitableEvent work_done_or_abandoned_;
-
- // Signaled from RequestStop(). When this is signaled,
- // DoWorkAndWaitUntilDoneImpl() returns immediately. This is needed to prevent
- // the UI thread from joining the sync thread while it is waiting for a
- // WorkCallback to run on the UI thread. See crbug.com/663600.
- base::WaitableEvent stop_requested_;
-
- // Verifies that calls to DoWorkAndWaitUntilDoneImpl() are sequenced.
- base::SequenceChecker sequence_checker_;
-
DISALLOW_COPY_AND_ASSIGN(UIModelWorker);
};
« no previous file with comments | « components/sync/engine/passive_model_worker.cc ('k') | components/sync/engine/ui_model_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698