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