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 | |
63 private: | 60 private: |
64 friend class RefCountedThreadSafe<IncomingTaskQueue>; | 61 friend class RefCountedThreadSafe<IncomingTaskQueue>; |
65 virtual ~IncomingTaskQueue(); | 62 virtual ~IncomingTaskQueue(); |
66 | 63 |
67 // Calculates the time at which a PendingTask should run. | 64 // Calculates the time at which a PendingTask should run. |
68 TimeTicks CalculateDelayedRuntime(TimeDelta delay); | 65 TimeTicks CalculateDelayedRuntime(TimeDelta delay); |
69 | 66 |
70 // Adds a task to |incoming_queue_|. The caller retains ownership of | 67 // Adds a task to |incoming_queue_|. The caller retains ownership of |
71 // |pending_task|, but this function will reset the value of | 68 // |pending_task|, but this function will reset the value of |
72 // |pending_task->task|. This is needed to ensure that the posting call stack | 69 // |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... |
105 // False until StartScheduling() is called. | 102 // False until StartScheduling() is called. |
106 bool is_ready_for_scheduling_; | 103 bool is_ready_for_scheduling_; |
107 | 104 |
108 DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue); | 105 DISALLOW_COPY_AND_ASSIGN(IncomingTaskQueue); |
109 }; | 106 }; |
110 | 107 |
111 } // namespace internal | 108 } // namespace internal |
112 } // namespace base | 109 } // namespace base |
113 | 110 |
114 #endif // BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ | 111 #endif // BASE_MESSAGE_LOOP_INCOMING_TASK_QUEUE_H_ |
OLD | NEW |