Chromium Code Reviews| 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()); |
| } |
| } |