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 MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ | 5 #ifndef MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ |
6 #define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ | 6 #define MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // a task must be run or |non_blocking| is true, in which case it will also | 96 // a task must be run or |non_blocking| is true, in which case it will also |
97 // return if no task is registered and servicing at least one handle would | 97 // return if no task is registered and servicing at least one handle would |
98 // require blocking. Returns true if a RunLoopHandler was notified. | 98 // require blocking. Returns true if a RunLoopHandler was notified. |
99 bool Wait(bool non_blocking); | 99 bool Wait(bool non_blocking); |
100 | 100 |
101 // Notifies handlers of |error|. If |check| == CHECK_DEADLINE, this will | 101 // Notifies handlers of |error|. If |check| == CHECK_DEADLINE, this will |
102 // only notify handlers whose deadline has expired and skips the rest. | 102 // only notify handlers whose deadline has expired and skips the rest. |
103 // Returns true if a RunLoopHandler was notified. | 103 // Returns true if a RunLoopHandler was notified. |
104 bool NotifyHandlers(MojoResult error, CheckDeadline check); | 104 bool NotifyHandlers(MojoResult error, CheckDeadline check); |
105 | 105 |
106 // Removes the first invalid handle. This is called if MojoWaitMany() finds an | |
107 // invalid handle. Returns true if a RunLoopHandler was notified. | |
108 bool RemoveFirstInvalidHandle(const WaitState& wait_state); | |
109 | |
110 // Returns the state needed to pass to WaitMany(). | 106 // Returns the state needed to pass to WaitMany(). |
111 WaitState GetWaitState(bool non_blocking) const; | 107 WaitState GetWaitState(bool non_blocking) const; |
112 | 108 |
113 HandleToHandlerData handler_data_; | 109 HandleToHandlerData handler_data_; |
114 | 110 |
115 // If non-null we're running (inside Run()). Member references a value on the | 111 // If non-null we're running (inside Run()). Member references a value on the |
116 // stack. | 112 // stack. |
117 RunState* run_state_; | 113 RunState* run_state_; |
118 | 114 |
119 // An ever increasing value assigned to each HandlerData::id. Used to detect | 115 // An ever increasing value assigned to each HandlerData::id. Used to detect |
(...skipping 20 matching lines...) Expand all Loading... |
140 uint64_t next_sequence_number_; | 136 uint64_t next_sequence_number_; |
141 typedef std::priority_queue<PendingTask> DelayedTaskQueue; | 137 typedef std::priority_queue<PendingTask> DelayedTaskQueue; |
142 DelayedTaskQueue delayed_tasks_; | 138 DelayedTaskQueue delayed_tasks_; |
143 | 139 |
144 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); | 140 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); |
145 }; | 141 }; |
146 | 142 |
147 } // namespace mojo | 143 } // namespace mojo |
148 | 144 |
149 #endif // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ | 145 #endif // MOJO_PUBLIC_CPP_UTILITY_RUN_LOOP_H_ |
OLD | NEW |