Chromium Code Reviews| Index: base/message_loop/message_loop.cc |
| diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc |
| index cfa86d98ce4351137eb9d222af17ed5e7fc30780..12649f85470be716e5418874ffae75dedde8b799 100644 |
| --- a/base/message_loop/message_loop.cc |
| +++ b/base/message_loop/message_loop.cc |
| @@ -133,9 +133,10 @@ MessageLoop::MessageLoop(scoped_ptr<MessagePump> pump) |
| } |
| MessageLoop::~MessageLoop() { |
| - // current() could be NULL if this message loop is destructed before it is |
| - // bound to a thread. |
| - DCHECK(current() == this || !current()); |
| + // If |pump_| is non-null, this message loop should be the current one on this |
| + // thread. Otherwise, this loop is being destructed before it was bound to a |
| + // thread, so a different message loop (or no loop at all) may be current. |
| + DCHECK((pump_ && current() == this) || current() != this); |
|
danakj
2016/01/06 21:03:22
This would still pass if pump_ && current() != thi
Sami
2016/01/07 10:46:10
Ah, right you are. Fixed, thanks.
|
| // iOS just attaches to the loop, it doesn't Run it. |
| // TODO(stuartmorgan): Consider wiring up a Detach(). |
| @@ -177,7 +178,8 @@ MessageLoop::~MessageLoop() { |
| task_runner_ = NULL; |
| // OK, now make it so that no one can find us. |
| - lazy_tls_ptr.Pointer()->Set(NULL); |
| + if (current() == this) |
|
danakj
2016/01/06 21:03:22
Yay for tests :o
Sami
2016/01/07 10:46:10
They're the best.
|
| + lazy_tls_ptr.Pointer()->Set(nullptr); |
| } |
| // static |