Chromium Code Reviews| Index: remoting/base/stoppable.cc |
| diff --git a/remoting/base/stoppable.cc b/remoting/base/stoppable.cc |
| index 99acba4c06d6cbecd32db96df5838572d11669cb..0dbfd1e9a37ebde8ce5d455696cd5eb3a7049c73 100644 |
| --- a/remoting/base/stoppable.cc |
| +++ b/remoting/base/stoppable.cc |
| @@ -4,6 +4,7 @@ |
| #include "remoting/base/stoppable.h" |
| +#include "base/bind.h" |
| #include "base/message_loop.h" |
| #include "base/single_thread_task_runner.h" |
| @@ -22,7 +23,11 @@ Stoppable::~Stoppable() { |
| } |
| void Stoppable::Stop() { |
| - DCHECK(task_runner_->BelongsToCurrentThread()); |
| + if (!task_runner_->BelongsToCurrentThread()) { |
| + task_runner_->PostTask(FROM_HERE, base::Bind(&Stoppable::Stop, |
| + base::Unretained(this))); |
|
Wez
2012/08/21 00:18:57
Using base::Unretained here means that multiple St
alexeypa (please no reviews)
2012/08/21 17:16:36
Indeed, your are right. Stop() should not be ever
|
| + return; |
| + } |
| if (state_ == kRunning) { |
| state_ = kStopping; |