OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 DCHECK(pump_); | 293 DCHECK(pump_); |
294 RunLoop run_loop; | 294 RunLoop run_loop; |
295 run_loop.RunUntilIdle(); | 295 run_loop.RunUntilIdle(); |
296 } | 296 } |
297 | 297 |
298 void MessageLoop::QuitWhenIdle() { | 298 void MessageLoop::QuitWhenIdle() { |
299 DCHECK_EQ(this, current()); | 299 DCHECK_EQ(this, current()); |
300 if (run_loop_) { | 300 if (run_loop_) { |
301 run_loop_->quit_when_idle_received_ = true; | 301 run_loop_->quit_when_idle_received_ = true; |
302 } else { | 302 } else { |
303 NOTREACHED() << "Must be inside Run to call Quit"; | 303 // We don't assert that run_loop_ is valid for custom message pumps. Some, |
| 304 // for example MojoMessagePump, might have shutdown already based on other |
| 305 // shutdown signals. |
| 306 if (type_ != MessageLoop::TYPE_CUSTOM) { |
| 307 NOTREACHED() << "Must be inside Run to call Quit"; |
| 308 } |
304 } | 309 } |
305 } | 310 } |
306 | 311 |
307 void MessageLoop::QuitNow() { | 312 void MessageLoop::QuitNow() { |
308 DCHECK_EQ(this, current()); | 313 DCHECK_EQ(this, current()); |
309 if (run_loop_) { | 314 if (run_loop_) { |
310 pump_->Quit(); | 315 pump_->Quit(); |
311 } else { | 316 } else { |
312 NOTREACHED() << "Must be inside Run to call Quit"; | 317 NOTREACHED() << "Must be inside Run to call Quit"; |
313 } | 318 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 persistent, | 753 persistent, |
749 mode, | 754 mode, |
750 controller, | 755 controller, |
751 delegate); | 756 delegate); |
752 } | 757 } |
753 #endif | 758 #endif |
754 | 759 |
755 #endif // !defined(OS_NACL_SFI) | 760 #endif // !defined(OS_NACL_SFI) |
756 | 761 |
757 } // namespace base | 762 } // namespace base |
OLD | NEW |