Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" | |
| 6 | |
| 7 #include "base/location.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 IdleTaskDeadlineSupplier::~IdleTaskDeadlineSupplier() { | |
| 12 } | |
| 13 | |
| 14 SingleThreadIdleTaskRunner::SingleThreadIdleTaskRunner( | |
| 15 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 16 base::WeakPtr<IdleTaskDeadlineSupplier> deadline_supplier) | |
| 17 : task_runner_(task_runner), deadline_supplier_(deadline_supplier) { | |
| 18 } | |
| 19 | |
| 20 SingleThreadIdleTaskRunner::~SingleThreadIdleTaskRunner() { | |
| 21 } | |
| 22 | |
| 23 bool SingleThreadIdleTaskRunner::RunsTasksOnCurrentThread() const { | |
| 24 return task_runner_->RunsTasksOnCurrentThread(); | |
| 25 } | |
| 26 | |
| 27 void SingleThreadIdleTaskRunner::PostIdleTask( | |
| 28 const tracked_objects::Location& from_here, | |
| 29 const IdleTask& idle_task) { | |
| 30 task_runner_->PostTask( | |
| 31 from_here, | |
| 32 base::Bind(&SingleThreadIdleTaskRunner::RunTask, this, idle_task)); | |
| 33 } | |
| 34 | |
| 35 void SingleThreadIdleTaskRunner::RunTask(IdleTask idle_task) { | |
| 36 if (deadline_supplier_) { | |
|
no sievers
2014/10/30 23:40:51
Do we really want to cancel the task when the dead
rmcilroy
2014/11/03 19:02:53
Yes we should probably DCHECK - done.
no sievers
2014/11/03 22:19:01
Actually based on other comments it seems like Ren
rmcilroy
2014/11/04 02:22:19
The RendererSchedulerImpl could go away while anot
| |
| 37 idle_task.Run(deadline_supplier_->CurrentIdleTaskDeadline()); | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 } // namespace content | |
| OLD | NEW |