| OLD | NEW |
| 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 #ifndef CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | 5 #ifndef CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ |
| 6 #define CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | 6 #define CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include "base/threading/platform_thread.h" | |
| 9 #include "cc/resources/tile_task_runner.h" | 8 #include "cc/resources/tile_task_runner.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 12 | 11 |
| 13 namespace base { | 12 namespace base { |
| 14 class SequencedTaskRunner; | 13 class SequencedTaskRunner; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace cc { | 16 namespace cc { |
| 18 class RasterSource; | 17 class RasterSource; |
| 19 class RenderingStatsInstrumentation; | 18 class RenderingStatsInstrumentation; |
| 20 | 19 |
| 21 class CC_EXPORT TileTaskWorkerPool { | 20 class CC_EXPORT TileTaskWorkerPool { |
| 22 public: | 21 public: |
| 23 static unsigned kBenchmarkTaskPriority; | 22 static unsigned kBenchmarkTaskPriority; |
| 24 static unsigned kTaskSetFinishedTaskPriorityBase; | 23 static unsigned kTaskSetFinishedTaskPriorityBase; |
| 25 static unsigned kTileTaskPriorityBase; | 24 static unsigned kTileTaskPriorityBase; |
| 26 | 25 |
| 27 TileTaskWorkerPool(); | 26 TileTaskWorkerPool(); |
| 28 virtual ~TileTaskWorkerPool(); | 27 virtual ~TileTaskWorkerPool(); |
| 29 | 28 |
| 30 // Set the number of threads to use for the global TaskGraphRunner instance. | |
| 31 // This can only be called once and must be called prior to | |
| 32 // GetNumWorkerThreads(). | |
| 33 static void SetNumWorkerThreads(int num_threads); | |
| 34 | |
| 35 // Returns the number of threads used for the global TaskGraphRunner instance. | |
| 36 static int GetNumWorkerThreads(); | |
| 37 | |
| 38 // Set the priority of worker threads. | |
| 39 static void SetWorkerThreadPriority(base::ThreadPriority priority); | |
| 40 | |
| 41 // Returns a pointer to the global TaskGraphRunner instance. | |
| 42 static TaskGraphRunner* GetTaskGraphRunner(); | |
| 43 | |
| 44 // Utility function that can be used to create a "Task set finished" task that | 29 // Utility function that can be used to create a "Task set finished" task that |
| 45 // posts |callback| to |task_runner| when run. | 30 // posts |callback| to |task_runner| when run. |
| 46 static scoped_refptr<TileTask> CreateTaskSetFinishedTask( | 31 static scoped_refptr<TileTask> CreateTaskSetFinishedTask( |
| 47 base::SequencedTaskRunner* task_runner, | 32 base::SequencedTaskRunner* task_runner, |
| 48 const base::Closure& callback); | 33 const base::Closure& callback); |
| 49 | 34 |
| 50 // Utility function that can be used to call ::ScheduleOnOriginThread() for | 35 // Utility function that can be used to call ::ScheduleOnOriginThread() for |
| 51 // each task in |graph|. | 36 // each task in |graph|. |
| 52 static void ScheduleTasksOnOriginThread(TileTaskClient* client, | 37 static void ScheduleTasksOnOriginThread(TileTaskClient* client, |
| 53 TaskGraph* graph); | 38 TaskGraph* graph); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 78 const gfx::Rect& rect, | 63 const gfx::Rect& rect, |
| 79 float scale); | 64 float scale); |
| 80 | 65 |
| 81 // Type-checking downcast routine. | 66 // Type-checking downcast routine. |
| 82 virtual TileTaskRunner* AsTileTaskRunner() = 0; | 67 virtual TileTaskRunner* AsTileTaskRunner() = 0; |
| 83 }; | 68 }; |
| 84 | 69 |
| 85 } // namespace cc | 70 } // namespace cc |
| 86 | 71 |
| 87 #endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | 72 #endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ |
| OLD | NEW |