chrome: Remove unneeded dependencies on libxml.
[chromium-blink-merge.git] / cc / raster / gpu_tile_task_worker_pool.h
blob32a9d232550cc68e9105e0dde64b500b6cd86d6b
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
3 // found in the LICENSE file.
5 #ifndef CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_
6 #define CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_
8 #include "base/memory/weak_ptr.h"
9 #include "cc/raster/tile_task_runner.h"
10 #include "cc/raster/tile_task_worker_pool.h"
12 namespace cc {
13 class ContextProvider;
14 class GpuRasterizer;
15 class ResourceProvider;
17 class CC_EXPORT GpuTileTaskWorkerPool : public TileTaskWorkerPool,
18 public TileTaskRunner,
19 public TileTaskClient {
20 public:
21 ~GpuTileTaskWorkerPool() override;
23 static scoped_ptr<TileTaskWorkerPool> Create(
24 base::SequencedTaskRunner* task_runner,
25 TaskGraphRunner* task_graph_runner,
26 ContextProvider* context_provider,
27 ResourceProvider* resource_provider,
28 bool use_distance_field_text,
29 int gpu_rasterization_msaa_sample_count);
31 // Overridden from TileTaskWorkerPool:
32 TileTaskRunner* AsTileTaskRunner() override;
34 // Overridden from TileTaskRunner:
35 void SetClient(TileTaskRunnerClient* client) override;
36 void Shutdown() override;
37 void ScheduleTasks(TileTaskQueue* queue) override;
38 void CheckForCompletedTasks() override;
39 ResourceFormat GetResourceFormat() const override;
40 bool GetResourceRequiresSwizzle() const override;
42 // Overridden from TileTaskClient:
43 scoped_ptr<RasterBuffer> AcquireBufferForRaster(
44 const Resource* resource,
45 uint64_t resource_content_id,
46 uint64_t previous_content_id) override;
47 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
49 private:
50 GpuTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
51 TaskGraphRunner* task_graph_runner,
52 ContextProvider* context_provider,
53 ResourceProvider* resource_provider,
54 bool use_distance_field_text,
55 int gpu_rasterization_msaa_sample_count);
57 void OnTaskSetFinished(TaskSet task_set);
58 void CompleteTasks(const Task::Vector& tasks);
60 scoped_refptr<base::SequencedTaskRunner> task_runner_;
61 TaskGraphRunner* task_graph_runner_;
62 const NamespaceToken namespace_token_;
63 TileTaskRunnerClient* client_;
64 scoped_ptr<GpuRasterizer> rasterizer_;
66 TaskSetCollection tasks_pending_;
68 scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
70 // Task graph used when scheduling tasks and vector used to gather
71 // completed tasks.
72 TaskGraph graph_;
73 Task::Vector completed_tasks_;
75 base::WeakPtrFactory<GpuTileTaskWorkerPool>
76 task_set_finished_weak_ptr_factory_;
78 base::WeakPtrFactory<GpuTileTaskWorkerPool> weak_ptr_factory_;
80 DISALLOW_COPY_AND_ASSIGN(GpuTileTaskWorkerPool);
83 } // namespace cc
85 #endif // CC_RASTER_GPU_TILE_TASK_WORKER_POOL_H_