| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 pump_->Quit(); | 328 pump_->Quit(); |
| 329 } else { | 329 } else { |
| 330 NOTREACHED() << "Must be inside Run to call Quit"; | 330 NOTREACHED() << "Must be inside Run to call Quit"; |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 static void QuitCurrent() { | 334 static void QuitCurrent() { |
| 335 MessageLoop::current()->Quit(); | 335 MessageLoop::current()->Quit(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 static void QuitNowCurrent() { |
| 339 MessageLoop::current()->QuitNow(); |
| 340 } |
| 341 |
| 338 // static | 342 // static |
| 339 base::Closure MessageLoop::QuitClosure() { | 343 base::Closure MessageLoop::QuitClosure() { |
| 340 return base::Bind(&QuitCurrent); | 344 return base::Bind(&QuitCurrent); |
| 341 } | 345 } |
| 342 | 346 |
| 347 // static |
| 348 base::Closure MessageLoop::QuitNowClosure() { |
| 349 return base::Bind(&QuitNowCurrent); |
| 350 } |
| 351 |
| 343 void MessageLoop::SetNestableTasksAllowed(bool allowed) { | 352 void MessageLoop::SetNestableTasksAllowed(bool allowed) { |
| 344 if (nestable_tasks_allowed_ != allowed) { | 353 if (nestable_tasks_allowed_ != allowed) { |
| 345 nestable_tasks_allowed_ = allowed; | 354 nestable_tasks_allowed_ = allowed; |
| 346 if (!nestable_tasks_allowed_) | 355 if (!nestable_tasks_allowed_) |
| 347 return; | 356 return; |
| 348 // Start the native pump if we are not already pumping. | 357 // Start the native pump if we are not already pumping. |
| 349 pump_->ScheduleWork(); | 358 pump_->ScheduleWork(); |
| 350 } | 359 } |
| 351 } | 360 } |
| 352 | 361 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 Watcher *delegate) { | 810 Watcher *delegate) { |
| 802 return pump_libevent()->WatchFileDescriptor( | 811 return pump_libevent()->WatchFileDescriptor( |
| 803 fd, | 812 fd, |
| 804 persistent, | 813 persistent, |
| 805 static_cast<base::MessagePumpLibevent::Mode>(mode), | 814 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 806 controller, | 815 controller, |
| 807 delegate); | 816 delegate); |
| 808 } | 817 } |
| 809 | 818 |
| 810 #endif | 819 #endif |
| OLD | NEW |