| Index: base/threading/sequenced_worker_pool.cc
|
| ===================================================================
|
| --- base/threading/sequenced_worker_pool.cc (revision 174239)
|
| +++ base/threading/sequenced_worker_pool.cc (working copy)
|
| @@ -389,7 +389,7 @@
|
| ConditionVariable has_work_cv_;
|
|
|
| // Condition variable that is waited on by non-worker threads (in
|
| - // FlushForTesting()) until IsIdle() goes to true.
|
| + // FlushForTesting()) until IsIdle() goes to true or Shutdown completes.
|
| ConditionVariable is_idle_cv_;
|
|
|
| // Condition variable that is waited on by non-worker threads (in
|
| @@ -610,8 +610,9 @@
|
| }
|
|
|
| void SequencedWorkerPool::Inner::FlushForTesting() {
|
| + base::ThreadRestrictions::ScopedAllowWait allow_wait;
|
| AutoLock lock(lock_);
|
| - while (!IsIdle())
|
| + while (!IsIdle() && !shutdown_called_)
|
| is_idle_cv_.Wait();
|
| }
|
|
|
| @@ -635,8 +636,10 @@
|
| SignalHasWork();
|
|
|
| // There are no pending or running tasks blocking shutdown, we're done.
|
| - if (CanShutdown())
|
| + if (CanShutdown()) {
|
| + is_idle_cv_.Signal();
|
| return;
|
| + }
|
| }
|
|
|
| // If we're here, then something is blocking shutdown. So wait for
|
| @@ -652,6 +655,7 @@
|
| AutoLock lock(lock_);
|
| while (!CanShutdown())
|
| can_shutdown_cv_.Wait();
|
| + is_idle_cv_.Signal();
|
| }
|
| UMA_HISTOGRAM_TIMES("SequencedWorkerPool.ShutdownDelayTime",
|
| TimeTicks::Now() - shutdown_wait_begin);
|
|
|