Chromium Code Reviews| Index: base/threading/thread.cc |
| diff --git a/base/threading/thread.cc b/base/threading/thread.cc |
| index 6181ba66918304d713d79dcbc3e0970276e9ea07..761bc871885ede525866ca4a6c3e6226cb0e3005 100644 |
| --- a/base/threading/thread.cc |
| +++ b/base/threading/thread.cc |
| @@ -144,6 +144,18 @@ bool Thread::WaitUntilThreadStarted() const { |
| return true; |
| } |
| +void Thread::FlushForTesting() { |
|
danakj
2016/09/15 18:09:33
I'd prefer a free function in base/test/ actually.
gab
2016/09/15 20:18:33
Maybe discoverability is a reason? i.e. I just rea
|
| + DCHECK(owning_sequence_checker_.CalledOnValidSequence()); |
| + if (!message_loop_) |
| + return; |
| + |
| + WaitableEvent done(WaitableEvent::ResetPolicy::AUTOMATIC, |
| + WaitableEvent::InitialState::NOT_SIGNALED); |
| + task_runner()->PostTask(FROM_HERE, |
| + Bind(&WaitableEvent::Signal, Unretained(&done))); |
| + done.Wait(); |
| +} |
| + |
| void Thread::Stop() { |
| DCHECK(joinable_); |