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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2367843002: Support SequencedWorkerPool::FlushForTesting() with redirection to TaskScheduler. (Closed)
Patch Set: CR danakj #10 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 | « base/threading/sequenced_worker_pool.h ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | 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 01f3329599fce0e3e077e4c1995222a997045054..acc7e50633e163e2730e5f25d1224665f5731340 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -895,8 +895,6 @@ bool SequencedWorkerPool::Inner::IsRunningSequenceOnCurrentThread(
void SequencedWorkerPool::Inner::CleanupForTesting() {
DCHECK_NE(subtle::NoBarrier_Load(&g_all_pools_state),
AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER);
- DCHECK(!RunsTasksOnCurrentThread());
- base::ThreadRestrictions::ScopedAllowWait allow_wait;
AutoLock lock(lock_);
CHECK_EQ(CLEANUP_DONE, cleanup_state_);
if (shutdown_called_)
@@ -1598,7 +1596,15 @@ bool SequencedWorkerPool::RunsTasksOnCurrentThread() const {
}
void SequencedWorkerPool::FlushForTesting() {
- inner_->CleanupForTesting();
+ DCHECK(!RunsTasksOnCurrentThread());
+ base::ThreadRestrictions::ScopedAllowWait allow_wait;
+ if (subtle::NoBarrier_Load(&g_all_pools_state) ==
+ AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) {
+ // TODO(gab): Remove this if http://crbug.com/622400 fails.
+ TaskScheduler::GetInstance()->FlushForTesting();
+ } else {
+ inner_->CleanupForTesting();
+ }
}
void SequencedWorkerPool::SignalHasWorkForTesting() {
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698