Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: cc/resources/tile_task_worker_pool.cc

Issue 943813002: cc: Add TaskGraphRunner sub-namespaces with task concurrency limits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resources/tile_task_worker_pool.h" 5 #include "cc/resources/tile_task_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 task->ScheduleOnOriginThread(client); 156 task->ScheduleOnOriginThread(client);
157 task->DidSchedule(); 157 task->DidSchedule();
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 // static 162 // static
163 void TileTaskWorkerPool::InsertNodeForTask(TaskGraph* graph, 163 void TileTaskWorkerPool::InsertNodeForTask(TaskGraph* graph,
164 TileTask* task, 164 TileTask* task,
165 unsigned priority, 165 unsigned priority,
166 size_t dependencies) { 166 size_t dependencies,
167 int sub_namespace,
168 int max_concurrent_tasks) {
167 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(), 169 DCHECK(std::find_if(graph->nodes.begin(), graph->nodes.end(),
168 TaskGraph::Node::TaskComparator(task)) == 170 TaskGraph::Node::TaskComparator(task)) ==
169 graph->nodes.end()); 171 graph->nodes.end());
170 graph->nodes.push_back(TaskGraph::Node(task, priority, dependencies)); 172 graph->nodes.push_back(TaskGraph::Node(task, priority, dependencies,
173 sub_namespace, max_concurrent_tasks));
171 } 174 }
172 175
173 // static 176 // static
174 void TileTaskWorkerPool::InsertNodesForRasterTask( 177 void TileTaskWorkerPool::InsertNodesForRasterTask(
175 TaskGraph* graph, 178 TaskGraph* graph,
176 RasterTask* raster_task, 179 RasterTask* raster_task,
177 const ImageDecodeTask::Vector& decode_tasks, 180 const ImageDecodeTask::Vector& decode_tasks,
178 unsigned priority) { 181 unsigned priority,
182 int sub_namespace,
183 int max_concurrent_tasks) {
179 size_t dependencies = 0u; 184 size_t dependencies = 0u;
180 185
181 // Insert image decode tasks. 186 // Insert image decode tasks.
182 for (ImageDecodeTask::Vector::const_iterator it = decode_tasks.begin(); 187 for (ImageDecodeTask::Vector::const_iterator it = decode_tasks.begin();
183 it != decode_tasks.end(); ++it) { 188 it != decode_tasks.end(); ++it) {
184 ImageDecodeTask* decode_task = it->get(); 189 ImageDecodeTask* decode_task = it->get();
185 190
186 // Skip if already decoded. 191 // Skip if already decoded.
187 if (decode_task->HasCompleted()) 192 if (decode_task->HasCompleted())
188 continue; 193 continue;
189 194
190 dependencies++; 195 dependencies++;
191 196
192 // Add decode task if it doesn't already exists in graph. 197 // Add decode task if it doesn't already exists in graph.
193 TaskGraph::Node::Vector::iterator decode_it = 198 TaskGraph::Node::Vector::iterator decode_it =
194 std::find_if(graph->nodes.begin(), graph->nodes.end(), 199 std::find_if(graph->nodes.begin(), graph->nodes.end(),
195 TaskGraph::Node::TaskComparator(decode_task)); 200 TaskGraph::Node::TaskComparator(decode_task));
196 if (decode_it == graph->nodes.end()) 201 if (decode_it == graph->nodes.end())
197 InsertNodeForTask(graph, decode_task, priority, 0u); 202 InsertNodeForTask(graph, decode_task, priority, 0u, kDefaultSubNamespace,
danakj 2015/02/23 18:45:01 when using the defaults can you leave a comment wh
203 kDefaultMaxConcurrentTasks);
198 204
199 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task)); 205 graph->edges.push_back(TaskGraph::Edge(decode_task, raster_task));
200 } 206 }
201 207
202 InsertNodeForTask(graph, raster_task, priority, dependencies); 208 InsertNodeForTask(graph, raster_task, priority, dependencies, sub_namespace,
209 max_concurrent_tasks);
203 } 210 }
204 211
205 static bool IsSupportedPlaybackToMemoryFormat(ResourceFormat format) { 212 static bool IsSupportedPlaybackToMemoryFormat(ResourceFormat format) {
206 switch (format) { 213 switch (format) {
207 case RGBA_4444: 214 case RGBA_4444:
208 case RGBA_8888: 215 case RGBA_8888:
209 case BGRA_8888: 216 case BGRA_8888:
210 return true; 217 return true;
211 case ALPHA_8: 218 case ALPHA_8:
212 case LUMINANCE_8: 219 case LUMINANCE_8:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the 270 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
264 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 271 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728
265 // is fixed. 272 // is fixed.
266 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); 273 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes());
267 DCHECK_EQ(0u, dst_row_bytes % 4); 274 DCHECK_EQ(0u, dst_row_bytes % 4);
268 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); 275 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0);
269 DCHECK_EQ(true, success); 276 DCHECK_EQ(true, success);
270 } 277 }
271 278
272 } // namespace cc 279 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698