OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | |
6 #define CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | |
7 | |
8 #include "cc/resources/tile_task_runner.h" | |
9 #include "ui/gfx/geometry/rect.h" | |
10 #include "ui/gfx/geometry/size.h" | |
11 | |
12 namespace base { | |
13 class SequencedTaskRunner; | |
14 } | |
15 | |
16 namespace cc { | |
17 class RasterSource; | |
18 class RenderingStatsInstrumentation; | |
19 | |
20 class CC_EXPORT TileTaskWorkerPool { | |
21 public: | |
22 static unsigned kBenchmarkTaskPriority; | |
23 static unsigned kTaskSetFinishedTaskPriorityBase; | |
24 static unsigned kTileTaskPriorityBase; | |
25 | |
26 TileTaskWorkerPool(); | |
27 virtual ~TileTaskWorkerPool(); | |
28 | |
29 // Utility function that can be used to create a "Task set finished" task that | |
30 // posts |callback| to |task_runner| when run. | |
31 static scoped_refptr<TileTask> CreateTaskSetFinishedTask( | |
32 base::SequencedTaskRunner* task_runner, | |
33 const base::Closure& callback); | |
34 | |
35 // Utility function that can be used to call ::ScheduleOnOriginThread() for | |
36 // each task in |graph|. | |
37 static void ScheduleTasksOnOriginThread(TileTaskClient* client, | |
38 TaskGraph* graph); | |
39 | |
40 // Utility function that can be used to build a task graph. Inserts a node | |
41 // that represents |task| in |graph|. See TaskGraph definition for valid | |
42 // |priority| values. | |
43 static void InsertNodeForTask(TaskGraph* graph, | |
44 TileTask* task, | |
45 unsigned priority, | |
46 size_t dependencies); | |
47 | |
48 // Utility function that can be used to build a task graph. Inserts nodes that | |
49 // represent |task| and all its image decode dependencies in |graph|. | |
50 static void InsertNodesForRasterTask( | |
51 TaskGraph* graph, | |
52 RasterTask* task, | |
53 const ImageDecodeTask::Vector& decode_tasks, | |
54 unsigned priority); | |
55 | |
56 // Utility function that will create a temporary bitmap and copy pixels to | |
57 // |memory| when necessary. | |
58 static void PlaybackToMemory(void* memory, | |
59 ResourceFormat format, | |
60 const gfx::Size& size, | |
61 int stride, | |
62 const RasterSource* raster_source, | |
63 const gfx::Rect& rect, | |
64 float scale); | |
65 | |
66 // Type-checking downcast routine. | |
67 virtual TileTaskRunner* AsTileTaskRunner() = 0; | |
68 }; | |
69 | |
70 } // namespace cc | |
71 | |
72 #endif // CC_RESOURCES_TILE_TASK_WORKER_POOL_H_ | |
OLD | NEW |