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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 DCHECK(pump_); | 297 DCHECK(pump_); |
298 RunLoop run_loop; | 298 RunLoop run_loop; |
299 run_loop.RunUntilIdle(); | 299 run_loop.RunUntilIdle(); |
300 } | 300 } |
301 | 301 |
302 void MessageLoop::QuitWhenIdle() { | 302 void MessageLoop::QuitWhenIdle() { |
303 DCHECK_EQ(this, current()); | 303 DCHECK_EQ(this, current()); |
304 if (run_loop_) { | 304 if (run_loop_) { |
305 run_loop_->quit_when_idle_received_ = true; | 305 run_loop_->quit_when_idle_received_ = true; |
306 } else { | 306 } else { |
307 // We don't assert that run_loop_ is valid for custom message pumps. Some, | 307 NOTREACHED() << "Must be inside Run to call Quit"; |
308 // for example MojoMessagePump, might have shutdown already based on other | |
309 // shutdown signals. | |
310 if (type_ != MessageLoop::TYPE_CUSTOM) { | |
311 NOTREACHED() << "Must be inside Run to call Quit"; | |
312 } | |
313 } | 308 } |
314 } | 309 } |
315 | 310 |
316 void MessageLoop::QuitNow() { | 311 void MessageLoop::QuitNow() { |
317 DCHECK_EQ(this, current()); | 312 DCHECK_EQ(this, current()); |
318 if (run_loop_) { | 313 if (run_loop_) { |
319 pump_->Quit(); | 314 pump_->Quit(); |
320 } else { | 315 } else { |
321 NOTREACHED() << "Must be inside Run to call Quit"; | 316 NOTREACHED() << "Must be inside Run to call Quit"; |
322 } | 317 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 persistent, | 752 persistent, |
758 mode, | 753 mode, |
759 controller, | 754 controller, |
760 delegate); | 755 delegate); |
761 } | 756 } |
762 #endif | 757 #endif |
763 | 758 |
764 #endif // !defined(OS_NACL_SFI) | 759 #endif // !defined(OS_NACL_SFI) |
765 | 760 |
766 } // namespace base | 761 } // namespace base |
OLD | NEW |