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