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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2343803004: Remove outdated TODO in SequencedWorkerPool::Inner::IsRunningSequenceOnCurrentThread(). (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index d8884dbf38fa996938037b1264827e9f728fd8c0..334d65a44e8d295db7e9df7c4ef78fcabb589c3b 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -879,13 +879,12 @@ bool SequencedWorkerPool::Inner::RunsTasksOnCurrentThread() const {
bool SequencedWorkerPool::Inner::IsRunningSequenceOnCurrentThread(
SequenceToken sequence_token) const {
+ DCHECK(sequence_token.IsValid());
fdoray 2016/09/15 15:57:13 This is always called from PoolSequencedTaskRunner
+
AutoLock lock(lock_);
+
if (subtle::NoBarrier_Load(&g_all_pools_state) ==
AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) {
- // TODO(gab): This currently only verifies that the current thread is a
danakj 2016/09/15 18:31:09 Isn't SequencedWorkerPool::Inner::RunsTasksOnCurre
fdoray 2016/09/15 18:39:23 |sequenced_task_runner_map_| contains TaskSchedule
danakj 2016/09/15 18:41:26 Thanks for the context! LGTM
- // thread on which a task bound to |sequence_token| *could* run, but it
- // doesn't verify that the current is *currently running* a task bound to
- // |sequence_token|.
const auto sequenced_task_runner_it =
sequenced_task_runner_map_.find(sequence_token.id_);
return sequenced_task_runner_it != sequenced_task_runner_map_.end() &&
@@ -893,9 +892,7 @@ bool SequencedWorkerPool::Inner::IsRunningSequenceOnCurrentThread(
} else {
ThreadMap::const_iterator found =
threads_.find(PlatformThread::CurrentId());
- if (found == threads_.end())
- return false;
- return found->second->is_processing_task() &&
+ return found != threads_.end() && found->second->is_processing_task() &&
sequence_token.Equals(found->second->task_sequence_token());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698