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

Side by Side Diff: content/renderer/raster_worker_pool.cc

Issue 1632923002: cc: Move more traces to be disabled-by-default around tile management. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/raster_worker_pool.h" 5 #include "content/renderer/raster_worker_pool.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 RasterWorkerPool::~RasterWorkerPool() {} 243 RasterWorkerPool::~RasterWorkerPool() {}
244 244
245 cc::NamespaceToken RasterWorkerPool::GetNamespaceToken() { 245 cc::NamespaceToken RasterWorkerPool::GetNamespaceToken() {
246 base::AutoLock lock(lock_); 246 base::AutoLock lock(lock_);
247 return work_queue_.GetNamespaceToken(); 247 return work_queue_.GetNamespaceToken();
248 } 248 }
249 249
250 void RasterWorkerPool::ScheduleTasks(cc::NamespaceToken token, 250 void RasterWorkerPool::ScheduleTasks(cc::NamespaceToken token,
251 cc::TaskGraph* graph) { 251 cc::TaskGraph* graph) {
252 TRACE_EVENT2("cc", "RasterWorkerPool::ScheduleTasks", "num_nodes", 252 TRACE_EVENT2("disabled-by-default-cc.debug",
253 "RasterWorkerPool::ScheduleTasks", "num_nodes",
253 graph->nodes.size(), "num_edges", graph->edges.size()); 254 graph->nodes.size(), "num_edges", graph->edges.size());
254 { 255 {
255 base::AutoLock lock(lock_); 256 base::AutoLock lock(lock_);
256 ScheduleTasksWithLockAcquired(token, graph); 257 ScheduleTasksWithLockAcquired(token, graph);
257 } 258 }
258 } 259 }
259 260
260 void RasterWorkerPool::ScheduleTasksWithLockAcquired(cc::NamespaceToken token, 261 void RasterWorkerPool::ScheduleTasksWithLockAcquired(cc::NamespaceToken token,
261 cc::TaskGraph* graph) { 262 cc::TaskGraph* graph) {
262 DCHECK(token.IsValid()); 263 DCHECK(token.IsValid());
263 DCHECK(!cc::TaskGraphWorkQueue::DependencyMismatch(graph)); 264 DCHECK(!cc::TaskGraphWorkQueue::DependencyMismatch(graph));
264 DCHECK(!shutdown_); 265 DCHECK(!shutdown_);
265 266
266 work_queue_.ScheduleTasks(token, graph); 267 work_queue_.ScheduleTasks(token, graph);
267 268
268 // If there is more work available, wake up the other worker threads. 269 // If there is more work available, wake up the other worker threads.
269 if (work_queue_.HasReadyToRunTasks()) 270 if (work_queue_.HasReadyToRunTasks())
270 has_ready_to_run_tasks_cv_.Broadcast(); 271 has_ready_to_run_tasks_cv_.Broadcast();
271 } 272 }
272 273
273 void RasterWorkerPool::WaitForTasksToFinishRunning(cc::NamespaceToken token) { 274 void RasterWorkerPool::WaitForTasksToFinishRunning(cc::NamespaceToken token) {
274 TRACE_EVENT0("cc", "RasterWorkerPool::WaitForTasksToFinishRunning"); 275 TRACE_EVENT0("disabled-by-default-cc.debug",
276 "RasterWorkerPool::WaitForTasksToFinishRunning");
275 277
276 DCHECK(token.IsValid()); 278 DCHECK(token.IsValid());
277 279
278 { 280 {
279 base::AutoLock lock(lock_); 281 base::AutoLock lock(lock_);
280 base::ThreadRestrictions::ScopedAllowWait allow_wait; 282 base::ThreadRestrictions::ScopedAllowWait allow_wait;
281 283
282 auto* task_namespace = work_queue_.GetNamespaceForToken(token); 284 auto* task_namespace = work_queue_.GetNamespaceForToken(token);
283 285
284 if (!task_namespace) 286 if (!task_namespace)
285 return; 287 return;
286 288
287 while (!work_queue_.HasFinishedRunningTasksInNamespace(task_namespace)) 289 while (!work_queue_.HasFinishedRunningTasksInNamespace(task_namespace))
288 has_namespaces_with_finished_running_tasks_cv_.Wait(); 290 has_namespaces_with_finished_running_tasks_cv_.Wait();
289 } 291 }
290 } 292 }
291 293
292 void RasterWorkerPool::CollectCompletedTasks( 294 void RasterWorkerPool::CollectCompletedTasks(
293 cc::NamespaceToken token, 295 cc::NamespaceToken token,
294 cc::Task::Vector* completed_tasks) { 296 cc::Task::Vector* completed_tasks) {
295 TRACE_EVENT0("cc", "RasterWorkerPool::CollectCompletedTasks"); 297 TRACE_EVENT0("disabled-by-default-cc.debug",
298 "RasterWorkerPool::CollectCompletedTasks");
296 299
297 { 300 {
298 base::AutoLock lock(lock_); 301 base::AutoLock lock(lock_);
299 CollectCompletedTasksWithLockAcquired(token, completed_tasks); 302 CollectCompletedTasksWithLockAcquired(token, completed_tasks);
300 } 303 }
301 } 304 }
302 305
303 void RasterWorkerPool::CollectCompletedTasksWithLockAcquired( 306 void RasterWorkerPool::CollectCompletedTasksWithLockAcquired(
304 cc::NamespaceToken token, 307 cc::NamespaceToken token,
305 cc::Task::Vector* completed_tasks) { 308 cc::Task::Vector* completed_tasks) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 359
357 // Overridden from cc::Task: 360 // Overridden from cc::Task:
358 void RasterWorkerPool::ClosureTask::RunOnWorkerThread() { 361 void RasterWorkerPool::ClosureTask::RunOnWorkerThread() {
359 closure_.Run(); 362 closure_.Run();
360 closure_.Reset(); 363 closure_.Reset();
361 } 364 }
362 365
363 RasterWorkerPool::ClosureTask::~ClosureTask() {} 366 RasterWorkerPool::ClosureTask::~ClosureTask() {}
364 367
365 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698