OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/scheduler/child/compositor_worker_scheduler.h" | 5 #include "components/scheduler/child/compositor_worker_scheduler.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 | 9 |
10 namespace scheduler { | 10 namespace scheduler { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 116 |
117 scoped_refptr<TaskQueue> CompositorWorkerScheduler::DefaultTaskRunner() { | 117 scoped_refptr<TaskQueue> CompositorWorkerScheduler::DefaultTaskRunner() { |
118 // TODO(sad): Implement a more robust scheduler that can do idle tasks for GC | 118 // TODO(sad): Implement a more robust scheduler that can do idle tasks for GC |
119 // without regressing performance of the rest of the system. | 119 // without regressing performance of the rest of the system. |
120 return make_scoped_refptr( | 120 return make_scoped_refptr( |
121 new CompositorWorkerTaskRunnerWrapper(thread_->task_runner())); | 121 new CompositorWorkerTaskRunnerWrapper(thread_->task_runner())); |
122 } | 122 } |
123 | 123 |
124 scoped_refptr<scheduler::SingleThreadIdleTaskRunner> | 124 scoped_refptr<scheduler::SingleThreadIdleTaskRunner> |
125 CompositorWorkerScheduler::IdleTaskRunner() { | 125 CompositorWorkerScheduler::IdleTaskRunner() { |
126 // TODO(sad): Not having a task-runner for idle tasks means v8 has to fallback | 126 return make_scoped_refptr(new SingleThreadIdleTaskRunner( |
127 // to inline GC, which might cause jank. | 127 thread_->task_runner(), thread_->task_runner(), this, |
Sami
2016/05/05 14:56:08
This is posting idle tasks as regular tasks which
flackr
2016/05/05 15:13:15
See comment below, this is just an interim workaro
Ian Vollick
2016/05/05 16:09:18
Yep, making idle tasks have the same priority as r
Sami
2016/05/05 16:53:39
A big fat TODO is probably fine as long as this is
Sami
2016/05/05 16:53:39
That's fine -- idle work is designed to be indefin
flackr
2016/05/05 18:36:00
Added a big fat TODO.
| |
128 return nullptr; | 128 "compositor.scheduler")); |
129 } | 129 } |
130 | 130 |
131 bool CompositorWorkerScheduler::CanExceedIdleDeadlineIfRequired() const { | 131 bool CompositorWorkerScheduler::CanExceedIdleDeadlineIfRequired() const { |
132 return false; | 132 return false; |
133 } | 133 } |
134 | 134 |
135 bool CompositorWorkerScheduler::ShouldYieldForHighPriorityWork() { | 135 bool CompositorWorkerScheduler::ShouldYieldForHighPriorityWork() { |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 void CompositorWorkerScheduler::AddTaskObserver( | 139 void CompositorWorkerScheduler::AddTaskObserver( |
140 base::MessageLoop::TaskObserver* task_observer) { | 140 base::MessageLoop::TaskObserver* task_observer) { |
141 thread_->message_loop()->AddTaskObserver(task_observer); | 141 thread_->message_loop()->AddTaskObserver(task_observer); |
142 } | 142 } |
143 | 143 |
144 void CompositorWorkerScheduler::RemoveTaskObserver( | 144 void CompositorWorkerScheduler::RemoveTaskObserver( |
145 base::MessageLoop::TaskObserver* task_observer) { | 145 base::MessageLoop::TaskObserver* task_observer) { |
146 thread_->message_loop()->RemoveTaskObserver(task_observer); | 146 thread_->message_loop()->RemoveTaskObserver(task_observer); |
147 } | 147 } |
148 | 148 |
149 void CompositorWorkerScheduler::Shutdown() {} | 149 void CompositorWorkerScheduler::Shutdown() {} |
150 | 150 |
151 void CompositorWorkerScheduler::OnIdleTaskPosted() {} | |
152 | |
153 base::TimeTicks CompositorWorkerScheduler::WillProcessIdleTask() { | |
154 // TODO(flackr): Return the next frame time as the deadline instead. | |
155 return base::TimeTicks::Now() + base::TimeDelta::FromMillisecondsD(16.7); | |
Sami
2016/05/05 14:56:08
This would give all idle tasks 16ms to run, which
flackr
2016/05/05 15:13:15
The idle task runner seems to be necessary in orde
Sami
2016/05/05 16:53:39
One thing rmcilroy@ pointed out was that oilpan do
flackr
2016/05/05 18:36:00
Added a big fat TODO :-)
| |
156 } | |
157 | |
158 void CompositorWorkerScheduler::DidProcessIdleTask() {} | |
159 | |
151 } // namespace scheduler | 160 } // namespace scheduler |
OLD | NEW |