| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 base::Bind( | 299 base::Bind( |
| 300 &base::subtle::TaskClosureAdapter::Run, | 300 &base::subtle::TaskClosureAdapter::Run, |
| 301 new base::subtle::TaskClosureAdapter(task, &should_leak_tasks_)), | 301 new base::subtle::TaskClosureAdapter(task, &should_leak_tasks_)), |
| 302 from_here, | 302 from_here, |
| 303 CalculateDelayedRuntime(delay_ms), false); | 303 CalculateDelayedRuntime(delay_ms), false); |
| 304 AddToIncomingQueue(&pending_task); | 304 AddToIncomingQueue(&pending_task); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void MessageLoop::PostTask( | 307 void MessageLoop::PostTask( |
| 308 const tracked_objects::Location& from_here, const base::Closure& task) { | 308 const tracked_objects::Location& from_here, const base::Closure& task) { |
| 309 CHECK(!task.is_null()); | 309 CHECK(!task.is_null()) << from_here.ToString(); |
| 310 PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), true); | 310 PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), true); |
| 311 AddToIncomingQueue(&pending_task); | 311 AddToIncomingQueue(&pending_task); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void MessageLoop::PostDelayedTask( | 314 void MessageLoop::PostDelayedTask( |
| 315 const tracked_objects::Location& from_here, const base::Closure& task, | 315 const tracked_objects::Location& from_here, const base::Closure& task, |
| 316 int64 delay_ms) { | 316 int64 delay_ms) { |
| 317 CHECK(!task.is_null()); | 317 CHECK(!task.is_null()) << from_here.ToString(); |
| 318 PendingTask pending_task(task, from_here, | 318 PendingTask pending_task(task, from_here, |
| 319 CalculateDelayedRuntime(delay_ms), true); | 319 CalculateDelayedRuntime(delay_ms), true); |
| 320 AddToIncomingQueue(&pending_task); | 320 AddToIncomingQueue(&pending_task); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void MessageLoop::PostNonNestableTask( | 323 void MessageLoop::PostNonNestableTask( |
| 324 const tracked_objects::Location& from_here, const base::Closure& task) { | 324 const tracked_objects::Location& from_here, const base::Closure& task) { |
| 325 CHECK(!task.is_null()); | 325 CHECK(!task.is_null()) << from_here.ToString(); |
| 326 PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), false); | 326 PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), false); |
| 327 AddToIncomingQueue(&pending_task); | 327 AddToIncomingQueue(&pending_task); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void MessageLoop::PostNonNestableDelayedTask( | 330 void MessageLoop::PostNonNestableDelayedTask( |
| 331 const tracked_objects::Location& from_here, const base::Closure& task, | 331 const tracked_objects::Location& from_here, const base::Closure& task, |
| 332 int64 delay_ms) { | 332 int64 delay_ms) { |
| 333 CHECK(!task.is_null()); | 333 CHECK(!task.is_null()) << from_here.ToString(); |
| 334 PendingTask pending_task(task, from_here, | 334 PendingTask pending_task(task, from_here, |
| 335 CalculateDelayedRuntime(delay_ms), false); | 335 CalculateDelayedRuntime(delay_ms), false); |
| 336 AddToIncomingQueue(&pending_task); | 336 AddToIncomingQueue(&pending_task); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void MessageLoop::Run() { | 339 void MessageLoop::Run() { |
| 340 AutoRunState save_state(this); | 340 AutoRunState save_state(this); |
| 341 RunHandler(); | 341 RunHandler(); |
| 342 } | 342 } |
| 343 | 343 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 Watcher *delegate) { | 859 Watcher *delegate) { |
| 860 return pump_libevent()->WatchFileDescriptor( | 860 return pump_libevent()->WatchFileDescriptor( |
| 861 fd, | 861 fd, |
| 862 persistent, | 862 persistent, |
| 863 static_cast<base::MessagePumpLibevent::Mode>(mode), | 863 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 864 controller, | 864 controller, |
| 865 delegate); | 865 delegate); |
| 866 } | 866 } |
| 867 | 867 |
| 868 #endif | 868 #endif |
| OLD | NEW |