| 725 | } |
| 726 | |
| 727 | void DelayedTask::Run(ReactorThread* thread) { |
| 728 | DCHECK(thread_ == nullptr) << "Task has already been scheduled"; |
| 729 | DCHECK(thread->IsCurrentThread()); |
| 730 | DCHECK(!is_linked()) << "Should not be linked on pending_tasks_ anymore"; |
| 731 | |
| 732 | // Schedule the task to run later. |
| 733 | thread_ = thread; |
| 734 | timer_.set(thread->loop_); |
| 735 | timer_.set<DelayedTask, &DelayedTask::TimerHandler>(this); // NOLINT(*) |
| 736 | timer_.start(when_.ToSeconds(), // after |
| 737 | 0); // repeat |
| 738 | thread_->scheduled_tasks_.push_back(*this); |
| 739 | } |
| 740 | |
| 741 | void DelayedTask::Abort(const Status& abort_status) { |
| 742 | func_(abort_status); |
no test coverage detected