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_INCOMING_TASK_QUEUE_H_ | 5 #ifndef BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ |
6 #define BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ | 6 #define BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // require high resolution timers. | 50 // require high resolution timers. |
51 int ReloadWorkQueue(TaskQueue* work_queue); | 51 int ReloadWorkQueue(TaskQueue* work_queue); |
52 | 52 |
53 // Disconnects |this| from the parent message loop. | 53 // Disconnects |this| from the parent message loop. |
54 void WillDestroyCurrentMessageLoop(); | 54 void WillDestroyCurrentMessageLoop(); |
55 | 55 |
56 // This should be called when the message loop becomes ready for | 56 // This should be called when the message loop becomes ready for |
57 // scheduling work. | 57 // scheduling work. |
58 void StartScheduling(); | 58 void StartScheduling(); |
59 | 59 |
| 60 // Returns the delay for the most recently added task. |
| 61 TimeTicks GetNewlyAddedTaskDelay(); |
| 62 |
60 private: | 63 private: |
61 friend class RefCountedThreadSafe<IncomingTaskQueue>; | 64 friend class RefCountedThreadSafe<IncomingTaskQueue>; |
62 virtual ~IncomingTaskQueue(); | 65 virtual ~IncomingTaskQueue(); |
63 | 66 |
64 // Calculates the time at which a PendingTask should run. | 67 // Calculates the time at which a PendingTask should run. |
65 TimeTicks CalculateDelayedRuntime(TimeDelta delay); | 68 TimeTicks CalculateDelayedRuntime(TimeDelta delay); |
66 | 69 |
67 // Adds a task to |incoming_queue_|. The caller retains ownership of | 70 // Adds a task to |incoming_queue_|. The caller retains ownership of |
68 // |pending_task|, but this function will reset the value of | 71 // |pending_task|, but this function will reset the value of |
69 // |pending_task->task|. This is needed to ensure that the posting call stack | 72 // |pending_task->task|. This is needed to ensure that the posting call stack |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // False until StartScheduling() is called. | 105 // False until StartScheduling() is called. |
103 bool is_ready_for_scheduling_; | 106 bool is_ready_for_scheduling_; |
104 | 107 |
105 DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue); | 108 DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue); |
106 }; | 109 }; |
107 | 110 |
108 } // namespace internal | 111 } // namespace internal |
109 } // namespace base | 112 } // namespace base |
110 | 113 |
111 #endif // BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ | 114 #endif // BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ |
OLD | NEW |