OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/tiles/tile_manager.h" | 5 #include "cc/tiles/tile_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 uint16_t priority, | 147 uint16_t priority, |
148 size_t dependencies) { | 148 size_t dependencies) { |
149 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(), | 149 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(), |
150 [task](const TaskGraph::Node& node) { | 150 [task](const TaskGraph::Node& node) { |
151 return node.task == task; | 151 return node.task == task; |
152 }) == graph->nodes.end()); | 152 }) == graph->nodes.end()); |
153 graph->nodes.push_back( | 153 graph->nodes.push_back( |
154 TaskGraph::Node(task, category, priority, dependencies)); | 154 TaskGraph::Node(task, category, priority, dependencies)); |
155 } | 155 } |
156 | 156 |
| 157 void InsertNodeForDecodeTask(TaskGraph* graph, |
| 158 ImageDecodeTask* task, |
| 159 uint16_t category, |
| 160 uint16_t priority) { |
| 161 uint32_t dependency_count = 0u; |
| 162 auto* dependency = task->dependency().get(); |
| 163 if (dependency && !dependency->HasCompleted()) { |
| 164 InsertNodeForDecodeTask(graph, dependency, category, priority); |
| 165 graph->edges.push_back(TaskGraph::Edge(dependency, task)); |
| 166 dependency_count = 1u; |
| 167 } |
| 168 InsertNodeForTask(graph, task, task->SupportsConcurrentExecution() |
| 169 ? category |
| 170 : TASK_CATEGORY_NONCONCURRENT_FOREGROUND, |
| 171 priority, dependency_count); |
| 172 } |
| 173 |
157 void InsertNodesForRasterTask(TaskGraph* graph, | 174 void InsertNodesForRasterTask(TaskGraph* graph, |
158 RasterTask* raster_task, | 175 RasterTask* raster_task, |
159 const ImageDecodeTask::Vector& decode_tasks, | 176 const ImageDecodeTask::Vector& decode_tasks, |
160 size_t priority, | 177 size_t priority, |
161 bool use_gpu_rasterization, | 178 bool use_gpu_rasterization, |
162 bool high_priority) { | 179 bool high_priority) { |
163 size_t dependencies = 0u; | 180 size_t dependencies = 0u; |
164 | 181 |
165 // Determine the TaskCategory for raster tasks - if a task uses GPU, it | 182 // Determine the TaskCategory for raster tasks - if a task uses GPU, it |
166 // cannot run concurrently and is assigned | 183 // cannot run concurrently and is assigned |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // priority task. In these cases, upgrade any low-priority dependencies of | 218 // priority task. In these cases, upgrade any low-priority dependencies of |
202 // the current task. | 219 // the current task. |
203 // TODO(ericrk): Task iterators should be updated to avoid this. | 220 // TODO(ericrk): Task iterators should be updated to avoid this. |
204 // crbug.com/594851 | 221 // crbug.com/594851 |
205 if (decode_it != graph->nodes.end() && high_priority && | 222 if (decode_it != graph->nodes.end() && high_priority && |
206 decode_it->category != decode_task_category) { | 223 decode_it->category != decode_task_category) { |
207 decode_it->category = decode_task_category; | 224 decode_it->category = decode_task_category; |
208 } | 225 } |
209 | 226 |
210 if (decode_it == graph->nodes.end()) { | 227 if (decode_it == graph->nodes.end()) { |
211 InsertNodeForTask(graph, decode_task, decode_task_category, priority, 0u); | 228 InsertNodeForDecodeTask(graph, decode_task, decode_task_category, |
| 229 priority); |
212 } | 230 } |
213 | 231 |
214 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); | 232 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); |
215 } | 233 } |
216 | 234 |
217 InsertNodeForTask(graph, raster_task, raster_task_category, priority, | 235 InsertNodeForTask(graph, raster_task, raster_task_category, priority, |
218 dependencies); | 236 dependencies); |
219 } | 237 } |
220 | 238 |
221 class TaskSetFinishedTaskImpl : public TileTask { | 239 class TaskSetFinishedTaskImpl : public TileTask { |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 void TileManager::Signals::reset() { | 1230 void TileManager::Signals::reset() { |
1213 ready_to_activate = false; | 1231 ready_to_activate = false; |
1214 did_notify_ready_to_activate = false; | 1232 did_notify_ready_to_activate = false; |
1215 ready_to_draw = false; | 1233 ready_to_draw = false; |
1216 did_notify_ready_to_draw = false; | 1234 did_notify_ready_to_draw = false; |
1217 all_tile_tasks_completed = false; | 1235 all_tile_tasks_completed = false; |
1218 did_notify_all_tile_tasks_completed = false; | 1236 did_notify_all_tile_tasks_completed = false; |
1219 } | 1237 } |
1220 | 1238 |
1221 } // namespace cc | 1239 } // namespace cc |
OLD | NEW |