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_RASTER_ZERO_COPY_TILE_TASK_WORKER_POOL_H_ | |
6 #define CC_RASTER_ZERO_COPY_TILE_TASK_WORKER_POOL_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/values.h" | |
13 #include "cc/raster/tile_task_worker_pool.h" | |
14 | |
15 namespace base { | |
16 namespace trace_event { | |
17 class ConvertableToTraceFormat; | |
18 } | |
19 } | |
20 | |
21 namespace cc { | |
22 class ResourceProvider; | |
23 | |
24 class CC_EXPORT ZeroCopyTileTaskWorkerPool : public TileTaskWorkerPool, | |
25 public RasterBufferProvider { | |
26 public: | |
27 ~ZeroCopyTileTaskWorkerPool() override; | |
28 | |
29 static std::unique_ptr<TileTaskWorkerPool> Create( | |
30 base::SequencedTaskRunner* task_runner, | |
31 TaskGraphRunner* task_graph_runner, | |
32 ResourceProvider* resource_provider, | |
33 ResourceFormat preferred_tile_format); | |
34 | |
35 // Overridden from TileTaskWorkerPool: | |
36 void Shutdown() override; | |
37 void ScheduleTasks(TaskGraph* graph) override; | |
38 void CheckForCompletedTasks() override; | |
39 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | |
40 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | |
41 RasterBufferProvider* AsRasterBufferProvider() override; | |
42 | |
43 // Overridden from RasterBufferProvider: | |
44 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | |
45 const Resource* resource, | |
46 uint64_t resource_content_id, | |
47 uint64_t previous_content_id) override; | |
48 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | |
49 | |
50 protected: | |
51 ZeroCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | |
52 TaskGraphRunner* task_graph_runner, | |
53 ResourceProvider* resource_provider, | |
54 ResourceFormat preferred_tile_format); | |
55 | |
56 private: | |
57 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() | |
58 const; | |
59 | |
60 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
61 TaskGraphRunner* task_graph_runner_; | |
62 const NamespaceToken namespace_token_; | |
63 ResourceProvider* resource_provider_; | |
64 | |
65 ResourceFormat preferred_tile_format_; | |
66 | |
67 Task::Vector completed_tasks_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(ZeroCopyTileTaskWorkerPool); | |
70 }; | |
71 | |
72 } // namespace cc | |
73 | |
74 #endif // CC_RASTER_ZERO_COPY_TILE_TASK_WORKER_POOL_H_ | |
OLD | NEW |