OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ | 5 #ifndef CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ |
6 #define CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ | 6 #define CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/raster/tile_task_worker_pool.h" | 11 #include "cc/raster/tile_task_worker_pool.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 class ContextProvider; | 14 class ContextProvider; |
15 class GpuRasterizer; | 15 class GpuRasterizer; |
16 class ResourceProvider; | 16 class ResourceProvider; |
17 | 17 |
18 class CC_EXPORT GpuTileTaskWorkerPool : public TileTaskWorkerPool, | 18 class CC_EXPORT GpuTileTaskWorkerPool : public TileTaskWorkerPool, |
19 public RasterBufferProvider { | 19 public RasterBufferProvider { |
20 public: | 20 public: |
21 ~GpuTileTaskWorkerPool() override; | 21 ~GpuTileTaskWorkerPool() override; |
22 | 22 |
23 static std::unique_ptr<TileTaskWorkerPool> Create( | 23 static std::unique_ptr<TileTaskWorkerPool> Create( |
24 base::SequencedTaskRunner* task_runner, | |
25 TaskGraphRunner* task_graph_runner, | |
26 ContextProvider* context_provider, | 24 ContextProvider* context_provider, |
27 ResourceProvider* resource_provider, | 25 ResourceProvider* resource_provider, |
28 bool use_distance_field_text, | 26 bool use_distance_field_text, |
29 int gpu_rasterization_msaa_sample_count); | 27 int gpu_rasterization_msaa_sample_count); |
30 | 28 |
31 // Overridden from TileTaskWorkerPool: | 29 // Overridden from TileTaskWorkerPool: |
32 void Shutdown() override; | 30 void BarrierToSyncResources() override; |
33 void ScheduleTasks(TaskGraph* graph) override; | |
34 void CheckForCompletedTasks() override; | |
35 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 31 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
36 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 32 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
37 RasterBufferProvider* AsRasterBufferProvider() override; | 33 RasterBufferProvider* AsRasterBufferProvider() override; |
38 | 34 |
39 // Overridden from RasterBufferProvider: | 35 // Overridden from RasterBufferProvider: |
40 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 36 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
41 const Resource* resource, | 37 const Resource* resource, |
42 uint64_t resource_content_id, | 38 uint64_t resource_content_id, |
43 uint64_t previous_content_id) override; | 39 uint64_t previous_content_id) override; |
44 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 40 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
45 | 41 |
46 private: | 42 private: |
47 GpuTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | 43 GpuTileTaskWorkerPool(ContextProvider* context_provider, |
48 TaskGraphRunner* task_graph_runner, | |
49 ContextProvider* context_provider, | |
50 ResourceProvider* resource_provider, | 44 ResourceProvider* resource_provider, |
51 bool use_distance_field_text, | 45 bool use_distance_field_text, |
52 int gpu_rasterization_msaa_sample_count); | 46 int gpu_rasterization_msaa_sample_count); |
53 | 47 |
54 void CompleteTasks(const Task::Vector& tasks); | |
55 | |
56 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
57 TaskGraphRunner* task_graph_runner_; | |
58 const NamespaceToken namespace_token_; | |
59 std::unique_ptr<GpuRasterizer> rasterizer_; | 48 std::unique_ptr<GpuRasterizer> rasterizer_; |
60 | 49 |
61 Task::Vector completed_tasks_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(GpuTileTaskWorkerPool); | 50 DISALLOW_COPY_AND_ASSIGN(GpuTileTaskWorkerPool); |
64 }; | 51 }; |
65 | 52 |
66 } // namespace cc | 53 } // namespace cc |
67 | 54 |
68 #endif // CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ | 55 #endif // CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |