Home | History | Annotate | Download | only in base

Lines Matching refs:Task

34 #include "talk/base/task.h"
56 void TaskRunner::StartTask(Task * task) {
57 tasks_.push_back(task);
59 // the task we just started could be about to timeout --
60 // make sure our "next timeout task" is correct
61 UpdateTaskTimeout(task, 0);
75 // Subsequent use of those task may cause data corruption or crashes.
101 Task* task = tasks_[i];
103 task->unique_id() == next_timeout_task_->unique_id()) {
109 deleting_task_ = task;
111 delete task;
119 std::vector<Task *>::iterator it;
122 reinterpret_cast<Task *>(NULL));
139 // see if our "next potentially timed-out task" has indeed timed out.
140 // If it has, wake it up, then queue up the next task in line
145 Task* old_timeout_task = NULL;
162 // this function gets called frequently -- when each task changes
165 // the next timeout-able task hasn't changed. The logic in this function
167 // effectively making the task scheduler O-1 instead of O-N
169 void TaskRunner::UpdateTaskTimeout(Task* task,
171 ASSERT(task != NULL);
174 task->unique_id() == next_timeout_task_->unique_id();
179 // if the relevant task has a timeout, then
181 // "about to timeout" task
182 if (task->timeout_time()) {
184 (task->timeout_time() <= next_timeout_task_->timeout_time())) {
185 next_timeout_task_ = task;
188 // otherwise, if the task doesn't have a timeout,
189 // and it used to be our "about to timeout" task,
191 // "about to timeout" task
192 RecalcNextTimeout(task);
203 void TaskRunner::RecalcNextTimeout(Task *exclude_task) {
214 Task *task = tasks_[i];
215 // if the task isn't complete, and it actually has a timeout time
216 if (!task->IsDone() && (task->timeout_time() > 0))
217 // if it doesn't match our "exclude" task
219 exclude_task->unique_id() != task->unique_id())
222 task->timeout_time() <= next_timeout_time) {
223 // set this task as our next-to-timeout
224 next_timeout_time = task->timeout_time();
225 next_timeout_task_ = task;