| OLD | NEW |
| 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 "cc/raster/synchronous_task_graph_runner.h" | 5 #include "cc/raster/synchronous_task_graph_runner.h" |
| 6 | 6 |
| 7 #include "base/threading/simple_thread.h" | 7 #include "base/threading/simple_thread.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 void SynchronousTaskGraphRunner::ScheduleTasks(NamespaceToken token, | 23 void SynchronousTaskGraphRunner::ScheduleTasks(NamespaceToken token, |
| 24 TaskGraph* graph) { | 24 TaskGraph* graph) { |
| 25 TRACE_EVENT2("cc", "SynchronousTaskGraphRunner::ScheduleTasks", "num_nodes", | 25 TRACE_EVENT2("cc", "SynchronousTaskGraphRunner::ScheduleTasks", "num_nodes", |
| 26 graph->nodes.size(), "num_edges", graph->edges.size()); | 26 graph->nodes.size(), "num_edges", graph->edges.size()); |
| 27 | 27 |
| 28 DCHECK(token.IsValid()); | 28 DCHECK(token.IsValid()); |
| 29 DCHECK(!TaskGraphWorkQueue::DependencyMismatch(graph)); | 29 DCHECK(!TaskGraphWorkQueue::DependencyMismatch(graph)); |
| 30 | 30 |
| 31 // SynchronousTaskGraphRunner does not care about categories. |
| 32 TaskGraphWorkQueue::UncategorizeTaskGraph(graph); |
| 33 |
| 31 work_queue_.ScheduleTasks(token, graph); | 34 work_queue_.ScheduleTasks(token, graph); |
| 32 } | 35 } |
| 33 | 36 |
| 34 void SynchronousTaskGraphRunner::WaitForTasksToFinishRunning( | 37 void SynchronousTaskGraphRunner::WaitForTasksToFinishRunning( |
| 35 NamespaceToken token) { | 38 NamespaceToken token) { |
| 36 TRACE_EVENT0("cc", "SynchronousTaskGraphRunner::WaitForTasksToFinishRunning"); | 39 TRACE_EVENT0("cc", "SynchronousTaskGraphRunner::WaitForTasksToFinishRunning"); |
| 37 | 40 |
| 38 DCHECK(token.IsValid()); | 41 DCHECK(token.IsValid()); |
| 39 auto* task_namespace = work_queue_.GetNamespaceForToken(token); | 42 auto* task_namespace = work_queue_.GetNamespaceForToken(token); |
| 40 | 43 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 } | 60 } |
| 58 | 61 |
| 59 void SynchronousTaskGraphRunner::RunUntilIdle() { | 62 void SynchronousTaskGraphRunner::RunUntilIdle() { |
| 60 while (work_queue_.HasReadyToRunTasks()) | 63 while (work_queue_.HasReadyToRunTasks()) |
| 61 RunTask(); | 64 RunTask(); |
| 62 } | 65 } |
| 63 | 66 |
| 64 void SynchronousTaskGraphRunner::RunTask() { | 67 void SynchronousTaskGraphRunner::RunTask() { |
| 65 TRACE_EVENT0("toplevel", "SynchronousTaskGraphRunner::RunTask"); | 68 TRACE_EVENT0("toplevel", "SynchronousTaskGraphRunner::RunTask"); |
| 66 | 69 |
| 67 auto prioritized_task = work_queue_.GetNextTaskToRun(); | 70 auto prioritized_task = work_queue_.GetNextTaskToRun(0u /* category */); |
| 68 | 71 |
| 69 Task* task = prioritized_task.task; | 72 Task* task = prioritized_task.task; |
| 70 task->WillRun(); | 73 task->WillRun(); |
| 71 task->RunOnWorkerThread(); | 74 task->RunOnWorkerThread(); |
| 72 task->DidRun(); | 75 task->DidRun(); |
| 73 | 76 |
| 74 work_queue_.CompleteTask(prioritized_task); | 77 work_queue_.CompleteTask(prioritized_task); |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace cc | 80 } // namespace cc |
| OLD | NEW |