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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/numerics/safe_conversions.h" | 15 #include "base/numerics/safe_conversions.h" |
16 #include "base/trace_event/trace_event_argument.h" | 16 #include "base/trace_event/trace_event_argument.h" |
17 #include "cc/base/histograms.h" | 17 #include "cc/base/histograms.h" |
18 #include "cc/debug/devtools_instrumentation.h" | 18 #include "cc/debug/devtools_instrumentation.h" |
19 #include "cc/debug/frame_viewer_instrumentation.h" | 19 #include "cc/debug/frame_viewer_instrumentation.h" |
20 #include "cc/debug/traced_value.h" | 20 #include "cc/debug/traced_value.h" |
21 #include "cc/layers/picture_layer_impl.h" | 21 #include "cc/layers/picture_layer_impl.h" |
22 #include "cc/raster/raster_buffer.h" | 22 #include "cc/raster/raster_buffer.h" |
| 23 #include "cc/raster/task_category.h" |
23 #include "cc/raster/tile_task_runner.h" | 24 #include "cc/raster/tile_task_runner.h" |
24 #include "cc/tiles/tile.h" | 25 #include "cc/tiles/tile.h" |
25 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
26 | 27 |
27 namespace cc { | 28 namespace cc { |
28 namespace { | 29 namespace { |
29 | 30 |
30 // Flag to indicate whether we should try and detect that | 31 // Flag to indicate whether we should try and detect that |
31 // a tile is of solid color. | 32 // a tile is of solid color. |
32 const bool kUseColorEstimator = true; | 33 const bool kUseColorEstimator = true; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 size_t kTileTaskPriorityBase = 10u; | 165 size_t kTileTaskPriorityBase = 10u; |
165 | 166 |
166 void InsertNodeForTask(TaskGraph* graph, | 167 void InsertNodeForTask(TaskGraph* graph, |
167 TileTask* task, | 168 TileTask* task, |
168 size_t priority, | 169 size_t priority, |
169 size_t dependencies) { | 170 size_t dependencies) { |
170 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(), | 171 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(), |
171 [task](const TaskGraph::Node& node) { | 172 [task](const TaskGraph::Node& node) { |
172 return node.task == task; | 173 return node.task == task; |
173 }) == graph->nodes.end()); | 174 }) == graph->nodes.end()); |
174 graph->nodes.push_back(TaskGraph::Node(task, priority, dependencies)); | 175 |
| 176 // TODO(ericrk): Add in more logic around category selection. |
| 177 graph->nodes.push_back( |
| 178 TaskGraph::Node(task, TASK_CATEGORY_HIGH_PRIORITY /* category */, |
| 179 priority, dependencies)); |
175 } | 180 } |
176 | 181 |
177 void InsertNodesForRasterTask(TaskGraph* graph, | 182 void InsertNodesForRasterTask(TaskGraph* graph, |
178 RasterTask* raster_task, | 183 RasterTask* raster_task, |
179 const ImageDecodeTask::Vector& decode_tasks, | 184 const ImageDecodeTask::Vector& decode_tasks, |
180 size_t priority) { | 185 size_t priority) { |
181 size_t dependencies = 0u; | 186 size_t dependencies = 0u; |
182 | 187 |
183 // Insert image decode tasks. | 188 // Insert image decode tasks. |
184 for (ImageDecodeTask::Vector::const_iterator it = decode_tasks.begin(); | 189 for (ImageDecodeTask::Vector::const_iterator it = decode_tasks.begin(); |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 void TileManager::Signals::reset() { | 1169 void TileManager::Signals::reset() { |
1165 ready_to_activate = false; | 1170 ready_to_activate = false; |
1166 did_notify_ready_to_activate = false; | 1171 did_notify_ready_to_activate = false; |
1167 ready_to_draw = false; | 1172 ready_to_draw = false; |
1168 did_notify_ready_to_draw = false; | 1173 did_notify_ready_to_draw = false; |
1169 all_tile_tasks_completed = false; | 1174 all_tile_tasks_completed = false; |
1170 did_notify_all_tile_tasks_completed = false; | 1175 did_notify_all_tile_tasks_completed = false; |
1171 } | 1176 } |
1172 | 1177 |
1173 } // namespace cc | 1178 } // namespace cc |
OLD | NEW |