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 "base/threading/platform_thread.h" |
9 #include "cc/resources/tile_task_runner.h" | 9 #include "cc/resources/tile_task_runner.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class SequencedTaskRunner; | 14 class SequencedTaskRunner; |
15 } | 15 } |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 class RasterSource; | 18 class RasterSource; |
19 class RenderingStatsInstrumentation; | 19 class RenderingStatsInstrumentation; |
20 | 20 |
21 class CC_EXPORT TileTaskWorkerPool { | 21 class CC_EXPORT TileTaskWorkerPool { |
22 public: | 22 public: |
| 23 static const int kDefaultSubNamespace = 0; |
| 24 static const int kDefaultMaxConcurrentTasks = 16; |
| 25 |
23 static unsigned kBenchmarkTaskPriority; | 26 static unsigned kBenchmarkTaskPriority; |
24 static unsigned kTaskSetFinishedTaskPriorityBase; | 27 static unsigned kTaskSetFinishedTaskPriorityBase; |
25 static unsigned kTileTaskPriorityBase; | 28 static unsigned kTileTaskPriorityBase; |
26 | 29 |
27 TileTaskWorkerPool(); | 30 TileTaskWorkerPool(); |
28 virtual ~TileTaskWorkerPool(); | 31 virtual ~TileTaskWorkerPool(); |
29 | 32 |
30 // Set the number of threads to use for the global TaskGraphRunner instance. | 33 // 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 | 34 // This can only be called once and must be called prior to |
32 // GetNumWorkerThreads(). | 35 // GetNumWorkerThreads(). |
(...skipping 18 matching lines...) Expand all Loading... |
51 // each task in |graph|. | 54 // each task in |graph|. |
52 static void ScheduleTasksOnOriginThread(TileTaskClient* client, | 55 static void ScheduleTasksOnOriginThread(TileTaskClient* client, |
53 TaskGraph* graph); | 56 TaskGraph* graph); |
54 | 57 |
55 // Utility function that can be used to build a task graph. Inserts a node | 58 // Utility function that can be used to build a task graph. Inserts a node |
56 // that represents |task| in |graph|. See TaskGraph definition for valid | 59 // that represents |task| in |graph|. See TaskGraph definition for valid |
57 // |priority| values. | 60 // |priority| values. |
58 static void InsertNodeForTask(TaskGraph* graph, | 61 static void InsertNodeForTask(TaskGraph* graph, |
59 TileTask* task, | 62 TileTask* task, |
60 unsigned priority, | 63 unsigned priority, |
61 size_t dependencies); | 64 size_t dependencies, |
| 65 int sub_namespace, |
| 66 int max_concurrent_tasks); |
62 | 67 |
63 // Utility function that can be used to build a task graph. Inserts nodes that | 68 // Utility function that can be used to build a task graph. Inserts nodes that |
64 // represent |task| and all its image decode dependencies in |graph|. | 69 // represent |task| and all its image decode dependencies in |graph|. |
65 static void InsertNodesForRasterTask( | 70 static void InsertNodesForRasterTask( |
66 TaskGraph* graph, | 71 TaskGraph* graph, |
67 RasterTask* task, | 72 RasterTask* task, |
68 const ImageDecodeTask::Vector& decode_tasks, | 73 const ImageDecodeTask::Vector& decode_tasks, |
69 unsigned priority); | 74 unsigned priority, |
| 75 int sub_namespace, |
| 76 int max_concurrent_tasks); |
70 | 77 |
71 // Utility function that will create a temporary bitmap and copy pixels to | 78 // Utility function that will create a temporary bitmap and copy pixels to |
72 // |memory| when necessary. | 79 // |memory| when necessary. |
73 static void PlaybackToMemory(void* memory, | 80 static void PlaybackToMemory(void* memory, |
74 ResourceFormat format, | 81 ResourceFormat format, |
75 const gfx::Size& size, | 82 const gfx::Size& size, |
76 int stride, | 83 int stride, |
77 const RasterSource* raster_source, | 84 const RasterSource* raster_source, |
78 const gfx::Rect& rect, | 85 const gfx::Rect& rect, |
79 float scale); | 86 float scale); |
80 | 87 |
81 // Type-checking downcast routine. | 88 // Type-checking downcast routine. |
82 virtual TileTaskRunner* AsTileTaskRunner() = 0; | 89 virtual TileTaskRunner* AsTileTaskRunner() = 0; |
83 }; | 90 }; |
84 | 91 |
85 } // namespace cc | 92 } // namespace cc |
86 | 93 |
87 #endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | 94 #endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |