| 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 CONTENT_RENDERER_RASTER_WORKER_POOL_H_ | 5 #ifndef CONTENT_RENDERER_RASTER_WORKER_POOL_H_ |
| 6 #define CONTENT_RENDERER_RASTER_WORKER_POOL_H_ | 6 #define CONTENT_RENDERER_RASTER_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override; | 45 void WaitForTasksToFinishRunning(cc::NamespaceToken token) override; |
| 46 void CollectCompletedTasks(cc::NamespaceToken token, | 46 void CollectCompletedTasks(cc::NamespaceToken token, |
| 47 cc::Task::Vector* completed_tasks) override; | 47 cc::Task::Vector* completed_tasks) override; |
| 48 | 48 |
| 49 // Runs a task from one of the provided categories. Categories listed first | 49 // Runs a task from one of the provided categories. Categories listed first |
| 50 // have higher priority. | 50 // have higher priority. |
| 51 void Run(const std::vector<cc::TaskCategory>& categories); | 51 void Run(const std::vector<cc::TaskCategory>& categories); |
| 52 | 52 |
| 53 void FlushForTesting(); | 53 void FlushForTesting(); |
| 54 | 54 |
| 55 // Spawn |num_threads| number of threads and start running work on the | 55 // Spawn worker threads start running work on them. A seperate thread for |
| 56 // worker threads. | 56 // background work is always created and |num_foreground_threads| the number |
| 57 void Start(int num_threads, | 57 // of threads to use for foreground work. |
| 58 const base::SimpleThread::Options& thread_options); | 58 void Start(int num_foreground_threads); |
| 59 | 59 |
| 60 // Finish running all the posted tasks (and nested task posted by those tasks) | 60 // Finish running all the posted tasks (and nested task posted by those tasks) |
| 61 // of all the associated task runners. | 61 // of all the associated task runners. |
| 62 // Once all the tasks are executed the method blocks until the threads are | 62 // Once all the tasks are executed the method blocks until the threads are |
| 63 // terminated. | 63 // terminated. |
| 64 void Shutdown(); | 64 void Shutdown(); |
| 65 | 65 |
| 66 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; } | 66 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; } |
| 67 | 67 |
| 68 // Create a new sequenced task graph runner. | 68 // Create a new sequenced task graph runner. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Condition variable that is waited on by origin threads until a namespace | 130 // Condition variable that is waited on by origin threads until a namespace |
| 131 // has finished running all associated tasks. | 131 // has finished running all associated tasks. |
| 132 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; | 132 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; |
| 133 // Set during shutdown. Tells Run() to return when no more tasks are pending. | 133 // Set during shutdown. Tells Run() to return when no more tasks are pending. |
| 134 bool shutdown_; | 134 bool shutdown_; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace content | 137 } // namespace content |
| 138 | 138 |
| 139 #endif // CONTENT_RENDERER_RASTER_WORKER_POOL_H_ | 139 #endif // CONTENT_RENDERER_RASTER_WORKER_POOL_H_ |
| OLD | NEW |