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 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_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 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // DoWork callback is already scheduled. This method may be called from any | 112 // DoWork callback is already scheduled. This method may be called from any |
113 // thread. Once this call is made, DoWork should not be "starved" at least | 113 // thread. Once this call is made, DoWork should not be "starved" at least |
114 // until it returns a value of false. | 114 // until it returns a value of false. |
115 virtual void ScheduleWork() = 0; | 115 virtual void ScheduleWork() = 0; |
116 | 116 |
117 // Schedule a DoDelayedWork callback to happen at the specified time, | 117 // Schedule a DoDelayedWork callback to happen at the specified time, |
118 // cancelling any pending DoDelayedWork callback. This method may only be | 118 // cancelling any pending DoDelayedWork callback. This method may only be |
119 // used on the thread that called Run. | 119 // used on the thread that called Run. |
120 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; | 120 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; |
121 | 121 |
| 122 // Returns true if the pump needs ScheduleWork to be called every time |
| 123 // a task has been added to the incoming queue. |
| 124 // The value return by this function should be constant over the lifetime |
| 125 // of this, and the function could be called from any thread. |
| 126 virtual bool NeedsScheduleWorkPerTask(); |
| 127 |
122 protected: | 128 protected: |
123 virtual ~MessagePump(); | 129 virtual ~MessagePump(); |
124 friend class RefCountedThreadSafe<MessagePump>; | 130 friend class RefCountedThreadSafe<MessagePump>; |
125 }; | 131 }; |
126 | 132 |
127 } // namespace base | 133 } // namespace base |
128 | 134 |
129 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 135 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
OLD | NEW |