| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 dependencies++; | 191 dependencies++; |
| 192 | 192 |
| 193 // Add decode task if it doesn't already exists in graph. | 193 // Add decode task if it doesn't already exists in graph. |
| 194 TaskGraph::Node::Vector::iterator decode_it = | 194 TaskGraph::Node::Vector::iterator decode_it = |
| 195 std::find_if(graph->nodes.begin(), graph->nodes.end(), | 195 std::find_if(graph->nodes.begin(), graph->nodes.end(), |
| 196 [decode_task](const TaskGraph::Node& node) { | 196 [decode_task](const TaskGraph::Node& node) { |
| 197 return node.task == decode_task; | 197 return node.task == decode_task; |
| 198 }); | 198 }); |
| 199 | 199 |
| 200 // Tasks are inserted in priority order, so existing decode tasks should | 200 // In rare circumstances, a low priority task may come in before a high |
| 201 // already be FOREGROUND if this is a high priority task. | 201 // priority task. In these cases, upgrade any low-priority dependencies of |
| 202 DCHECK(decode_it == graph->nodes.end() || !high_priority || | 202 // the current task. |
| 203 static_cast<uint16_t>(TASK_CATEGORY_FOREGROUND) == | 203 // TODO(ericrk): Task iterators should be updated to avoid this. |
| 204 decode_it->category); | 204 // crbug.com/594851 |
| 205 if (decode_it != graph->nodes.end() && high_priority && |
| 206 decode_it->category != decode_task_category) { |
| 207 decode_it->category = decode_task_category; |
| 208 } |
| 205 | 209 |
| 206 if (decode_it == graph->nodes.end()) { | 210 if (decode_it == graph->nodes.end()) { |
| 207 InsertNodeForTask(graph, decode_task, decode_task_category, priority, 0u); | 211 InsertNodeForTask(graph, decode_task, decode_task_category, priority, 0u); |
| 208 } | 212 } |
| 209 | 213 |
| 210 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); | 214 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); |
| 211 } | 215 } |
| 212 | 216 |
| 213 InsertNodeForTask(graph, raster_task, raster_task_category, priority, | 217 InsertNodeForTask(graph, raster_task, raster_task_category, priority, |
| 214 dependencies); | 218 dependencies); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 TaskGraph::Edge(task, required_for_activation_done_task.get())); | 769 TaskGraph::Edge(task, required_for_activation_done_task.get())); |
| 766 } | 770 } |
| 767 if (tile->required_for_draw()) { | 771 if (tile->required_for_draw()) { |
| 768 required_for_draw_count++; | 772 required_for_draw_count++; |
| 769 graph_.edges.push_back( | 773 graph_.edges.push_back( |
| 770 TaskGraph::Edge(task, required_for_draw_done_task.get())); | 774 TaskGraph::Edge(task, required_for_draw_done_task.get())); |
| 771 } | 775 } |
| 772 all_count++; | 776 all_count++; |
| 773 graph_.edges.push_back(TaskGraph::Edge(task, all_done_task.get())); | 777 graph_.edges.push_back(TaskGraph::Edge(task, all_done_task.get())); |
| 774 | 778 |
| 779 // A tile is high priority if it is either blocking future compositing |
| 780 // (required for draw or required for activation), or if it has a priority |
| 781 // bin of NOW for another reason (low resolution tiles). |
| 775 bool high_priority = | 782 bool high_priority = |
| 776 tile->required_for_draw() || tile->required_for_activation(); | 783 tile->required_for_draw() || tile->required_for_activation() || |
| 784 prioritized_tile.priority().priority_bin == TilePriority::NOW; |
| 777 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++, | 785 InsertNodesForRasterTask(&graph_, task, task->dependencies(), priority++, |
| 778 use_gpu_rasterization_, high_priority); | 786 use_gpu_rasterization_, high_priority); |
| 779 } | 787 } |
| 780 | 788 |
| 781 // Insert nodes for our task completion tasks. We enqueue these using | 789 // Insert nodes for our task completion tasks. We enqueue these using |
| 782 // FOREGROUND priority as they are relatively quick tasks and we'd like | 790 // FOREGROUND priority as they are relatively quick tasks and we'd like |
| 783 // to trigger our callbacks quickly to aid in scheduling. | 791 // to trigger our callbacks quickly to aid in scheduling. |
| 784 InsertNodeForTask(&graph_, required_for_activation_done_task.get(), | 792 InsertNodeForTask(&graph_, required_for_activation_done_task.get(), |
| 785 TASK_CATEGORY_FOREGROUND, | 793 TASK_CATEGORY_FOREGROUND, |
| 786 kRequiredForActivationDoneTaskPriority, | 794 kRequiredForActivationDoneTaskPriority, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 void TileManager::Signals::reset() { | 1212 void TileManager::Signals::reset() { |
| 1205 ready_to_activate = false; | 1213 ready_to_activate = false; |
| 1206 did_notify_ready_to_activate = false; | 1214 did_notify_ready_to_activate = false; |
| 1207 ready_to_draw = false; | 1215 ready_to_draw = false; |
| 1208 did_notify_ready_to_draw = false; | 1216 did_notify_ready_to_draw = false; |
| 1209 all_tile_tasks_completed = false; | 1217 all_tile_tasks_completed = false; |
| 1210 did_notify_all_tile_tasks_completed = false; | 1218 did_notify_all_tile_tasks_completed = false; |
| 1211 } | 1219 } |
| 1212 | 1220 |
| 1213 } // namespace cc | 1221 } // namespace cc |
| OLD | NEW |