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