| 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 #ifndef CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ | 5 #ifndef CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ |
| 6 #define CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ | 6 #define CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ |
| 7 | 7 |
| 8 #include "cc/raster/task_graph_runner.h" | 8 #include "cc/raster/task_graph_runner.h" |
| 9 #include "cc/raster/task_graph_work_queue.h" | 9 #include "cc/raster/task_graph_work_queue.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 // Implements a TaskGraphRunner which runs synchronously. This runner only runs | 13 // Implements a TaskGraphRunner which runs synchronously. This runner only runs |
| 14 // tasks when RunUntilIdle is called. | 14 // tasks when RunUntilIdle is called. |
| 15 class CC_EXPORT SynchronousTaskGraphRunner : public TaskGraphRunner { | 15 class CC_EXPORT SynchronousTaskGraphRunner : public TaskGraphRunner, |
| 16 public TaskGraphWorkQueueClient { |
| 16 public: | 17 public: |
| 17 SynchronousTaskGraphRunner(); | 18 SynchronousTaskGraphRunner(); |
| 18 ~SynchronousTaskGraphRunner() override; | 19 ~SynchronousTaskGraphRunner() override; |
| 19 | 20 |
| 20 // Overridden from TaskGraphRunner: | 21 // Overridden from TaskGraphRunner: |
| 21 NamespaceToken GetNamespaceToken() override; | 22 NamespaceToken GetNamespaceToken() override; |
| 22 void ScheduleTasks(NamespaceToken token, TaskGraph* graph) override; | 23 void ScheduleTasks(NamespaceToken token, TaskGraph* graph) override; |
| 23 void WaitForTasksToFinishRunning(NamespaceToken token) override; | 24 void WaitForTasksToFinishRunning(NamespaceToken token) override; |
| 24 void CollectCompletedTasks(NamespaceToken token, | 25 void CollectCompletedTasks(NamespaceToken token, |
| 25 Task::Vector* completed_tasks) override; | 26 Task::Vector* completed_tasks) override; |
| 26 | 27 |
| 28 // Overridden from TaskGraphWorkQueueClient: |
| 29 void AdjustWorkerPriorityForTask(Task* task, |
| 30 uint16_t old_category, |
| 31 uint16_t new_category) override {} |
| 32 |
| 27 // Runs all pending tasks from all namespaces. | 33 // Runs all pending tasks from all namespaces. |
| 28 void RunUntilIdle(); | 34 void RunUntilIdle(); |
| 29 | 35 |
| 30 private: | 36 private: |
| 31 // Returns true if there was a task to run. | 37 // Returns true if there was a task to run. |
| 32 bool RunTask(); | 38 bool RunTask(); |
| 33 | 39 |
| 34 // Stores the actual tasks to be run, sorted by priority. | 40 // Stores the actual tasks to be run, sorted by priority. |
| 35 TaskGraphWorkQueue work_queue_; | 41 TaskGraphWorkQueue work_queue_; |
| 36 }; | 42 }; |
| 37 | 43 |
| 38 } // namespace cc | 44 } // namespace cc |
| 39 | 45 |
| 40 #endif // CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ | 46 #endif // CC_RASTER_SYNCHRONOUS_TASK_GRAPH_RUNNER_H_ |
| OLD | NEW |