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 // TODO(flackr): This posts idle tasks as regular tasks. We need to create |
127 // to inline GC, which might cause jank. | 127 // an idle task runner with the semantics we want for the compositor thread |
128 return nullptr; | 128 // which runs them after the current frame has been drawn before the next |
| 129 // vsync. https://crbug.com/609532 |
| 130 return make_scoped_refptr(new SingleThreadIdleTaskRunner( |
| 131 thread_->task_runner(), thread_->task_runner(), this, |
| 132 "compositor.scheduler")); |
129 } | 133 } |
130 | 134 |
131 bool CompositorWorkerScheduler::CanExceedIdleDeadlineIfRequired() const { | 135 bool CompositorWorkerScheduler::CanExceedIdleDeadlineIfRequired() const { |
132 return false; | 136 return false; |
133 } | 137 } |
134 | 138 |
135 bool CompositorWorkerScheduler::ShouldYieldForHighPriorityWork() { | 139 bool CompositorWorkerScheduler::ShouldYieldForHighPriorityWork() { |
136 return false; | 140 return false; |
137 } | 141 } |
138 | 142 |
139 void CompositorWorkerScheduler::AddTaskObserver( | 143 void CompositorWorkerScheduler::AddTaskObserver( |
140 base::MessageLoop::TaskObserver* task_observer) { | 144 base::MessageLoop::TaskObserver* task_observer) { |
141 thread_->message_loop()->AddTaskObserver(task_observer); | 145 thread_->message_loop()->AddTaskObserver(task_observer); |
142 } | 146 } |
143 | 147 |
144 void CompositorWorkerScheduler::RemoveTaskObserver( | 148 void CompositorWorkerScheduler::RemoveTaskObserver( |
145 base::MessageLoop::TaskObserver* task_observer) { | 149 base::MessageLoop::TaskObserver* task_observer) { |
146 thread_->message_loop()->RemoveTaskObserver(task_observer); | 150 thread_->message_loop()->RemoveTaskObserver(task_observer); |
147 } | 151 } |
148 | 152 |
149 void CompositorWorkerScheduler::Shutdown() {} | 153 void CompositorWorkerScheduler::Shutdown() {} |
150 | 154 |
| 155 void CompositorWorkerScheduler::OnIdleTaskPosted() {} |
| 156 |
| 157 base::TimeTicks CompositorWorkerScheduler::WillProcessIdleTask() { |
| 158 // TODO(flackr): Return the next frame time as the deadline instead. |
| 159 // TODO(flackr): Ensure that oilpan GC does happen on the compositor thread |
| 160 // even though we will have no long idle periods. https://crbug.com/609531 |
| 161 return base::TimeTicks::Now() + base::TimeDelta::FromMillisecondsD(16.7); |
| 162 } |
| 163 |
| 164 void CompositorWorkerScheduler::DidProcessIdleTask() {} |
| 165 |
151 } // namespace scheduler | 166 } // namespace scheduler |
OLD | NEW |