| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "base/message_loop.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 void MessageLoop::QuitNow() { | 359 void MessageLoop::QuitNow() { |
| 360 DCHECK_EQ(this, current()); | 360 DCHECK_EQ(this, current()); |
| 361 if (state_) { | 361 if (state_) { |
| 362 pump_->Quit(); | 362 pump_->Quit(); |
| 363 } else { | 363 } else { |
| 364 NOTREACHED() << "Must be inside Run to call Quit"; | 364 NOTREACHED() << "Must be inside Run to call Quit"; |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 static void QuitCurrent() { |
| 369 MessageLoop::current()->Quit(); |
| 370 } |
| 371 |
| 368 // static | 372 // static |
| 369 base::Closure MessageLoop::QuitClosure() { | 373 base::Closure MessageLoop::QuitClosure() { |
| 370 return base::Bind(&MessageLoop::Quit, | 374 return base::Bind(&QuitCurrent); |
| 371 base::Unretained(MessageLoop::current())); | |
| 372 } | 375 } |
| 373 | 376 |
| 374 void MessageLoop::SetNestableTasksAllowed(bool allowed) { | 377 void MessageLoop::SetNestableTasksAllowed(bool allowed) { |
| 375 if (nestable_tasks_allowed_ != allowed) { | 378 if (nestable_tasks_allowed_ != allowed) { |
| 376 nestable_tasks_allowed_ = allowed; | 379 nestable_tasks_allowed_ = allowed; |
| 377 if (!nestable_tasks_allowed_) | 380 if (!nestable_tasks_allowed_) |
| 378 return; | 381 return; |
| 379 // Start the native pump if we are not already pumping. | 382 // Start the native pump if we are not already pumping. |
| 380 pump_->ScheduleWork(); | 383 pump_->ScheduleWork(); |
| 381 } | 384 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 Watcher *delegate) { | 870 Watcher *delegate) { |
| 868 return pump_libevent()->WatchFileDescriptor( | 871 return pump_libevent()->WatchFileDescriptor( |
| 869 fd, | 872 fd, |
| 870 persistent, | 873 persistent, |
| 871 static_cast<base::MessagePumpLibevent::Mode>(mode), | 874 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 872 controller, | 875 controller, |
| 873 delegate); | 876 delegate); |
| 874 } | 877 } |
| 875 | 878 |
| 876 #endif | 879 #endif |
| OLD | NEW |