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

Unified Diff: components/sync/engine/model_safe_worker.cc

Issue 2466313003: Remove ModelSafeWorker::work_done_or_stopped(). (Closed)
Patch Set: CR zea #11 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
« no previous file with comments | « components/sync/engine/model_safe_worker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/engine/model_safe_worker.cc
diff --git a/components/sync/engine/model_safe_worker.cc b/components/sync/engine/model_safe_worker.cc
index c9d2d38f3620ddd0e18ee4987cf87c37496bbe9d..6f41366bd1859816445d092b9ce5ea3b0b57e0be 100644
--- a/components/sync/engine/model_safe_worker.cc
+++ b/components/sync/engine/model_safe_worker.cc
@@ -73,8 +73,6 @@ std::string ModelSafeGroupToString(ModelSafeGroup group) {
ModelSafeWorker::ModelSafeWorker(WorkerLoopDestructionObserver* observer)
: stopped_(false),
- work_done_or_stopped_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED),
observer_(observer) {}
ModelSafeWorker::~ModelSafeWorker() {}
@@ -82,11 +80,9 @@ ModelSafeWorker::~ModelSafeWorker() {}
void ModelSafeWorker::RequestStop() {
base::AutoLock al(stopped_lock_);
- // Set stop flag but don't signal work_done_or_stopped_ to unblock sync loop
- // because the worker may be working and depending on sync command object
- // living on sync thread. This prevents any *further* tasks from being posted
- // to worker threads (see DoWorkAndWaitUntilDone below), but note that one
- // may already be posted.
+ // Set stop flag. This prevents any *further* tasks from being posted to
+ // worker threads (see DoWorkAndWaitUntilDone below), but note that one may
+ // already be posted.
stopped_ = true;
}
@@ -95,8 +91,6 @@ SyncerError ModelSafeWorker::DoWorkAndWaitUntilDone(const WorkCallback& work) {
base::AutoLock al(stopped_lock_);
if (stopped_)
return CANNOT_DO_WORK;
-
- CHECK(!work_done_or_stopped_.IsSignaled());
}
return DoWorkAndWaitUntilDoneImpl(work);
@@ -112,12 +106,6 @@ void ModelSafeWorker::WillDestroyCurrentMessageLoop() {
base::AutoLock al(stopped_lock_);
stopped_ = true;
- // Must signal to unblock syncer if it's waiting for a posted task to
- // finish. At this point, all pending tasks posted to the loop have been
- // destroyed (see MessageLoop::~MessageLoop). So syncer will be blocked
- // indefinitely without signaling here.
- work_done_or_stopped_.Signal();
-
DVLOG(1) << ModelSafeGroupToString(GetModelSafeGroup())
<< " worker stops on destruction of its working thread.";
}
« no previous file with comments | « components/sync/engine/model_safe_worker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698