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