| 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 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // Called to process any delayed non-nestable tasks. | 377 // Called to process any delayed non-nestable tasks. |
| 378 bool ProcessNextDelayedNonNestableTask(); | 378 bool ProcessNextDelayedNonNestableTask(); |
| 379 | 379 |
| 380 // Calls RunTask or queues the pending_task on the deferred task list if it | 380 // Calls RunTask or queues the pending_task on the deferred task list if it |
| 381 // cannot be run right now. Returns true if the task was run. | 381 // cannot be run right now. Returns true if the task was run. |
| 382 bool DeferOrRunPendingTask(PendingTask pending_task); | 382 bool DeferOrRunPendingTask(PendingTask pending_task); |
| 383 | 383 |
| 384 // Adds the pending task to delayed_work_queue_. | 384 // Adds the pending task to delayed_work_queue_. |
| 385 void AddToDelayedWorkQueue(PendingTask pending_task); | 385 void AddToDelayedWorkQueue(PendingTask pending_task); |
| 386 | 386 |
| 387 bool SweepDelayedWorkQueue(); |
| 388 |
| 387 // Delete tasks that haven't run yet without running them. Used in the | 389 // Delete tasks that haven't run yet without running them. Used in the |
| 388 // destructor to make sure all the task's destructors get called. Returns | 390 // destructor to make sure all the task's destructors get called. Returns |
| 389 // true if some work was done. | 391 // true if some work was done. |
| 390 bool DeletePendingTasks(); | 392 bool DeletePendingTasks(); |
| 391 | 393 |
| 392 // Loads tasks from the incoming queue to |work_queue_| if the latter is | 394 // Loads tasks from the incoming queue to |work_queue_| if the latter is |
| 393 // empty. | 395 // empty. |
| 394 void ReloadWorkQueue(); | 396 void ReloadWorkQueue(); |
| 395 | 397 |
| 396 // Wakes up the message pump. Can be called on any thread. The caller is | 398 // Wakes up the message pump. Can be called on any thread. The caller is |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 611 |
| 610 // Do not add any member variables to MessageLoopForIO! This is important b/c | 612 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 611 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 613 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 612 // data that you need should be stored on the MessageLoop's pump_ instance. | 614 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 613 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 615 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 614 "MessageLoopForIO should not have extra member variables"); | 616 "MessageLoopForIO should not have extra member variables"); |
| 615 | 617 |
| 616 } // namespace base | 618 } // namespace base |
| 617 | 619 |
| 618 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 620 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |