| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | |
| 6 #define CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "cc/output/context_provider.h" | |
| 12 #include "cc/raster/tile_task_worker_pool.h" | |
| 13 #include "cc/resources/resource_provider.h" | |
| 14 | |
| 15 namespace cc { | |
| 16 struct StagingBuffer; | |
| 17 class StagingBufferPool; | |
| 18 class ResourcePool; | |
| 19 | |
| 20 class CC_EXPORT OneCopyTileTaskWorkerPool : public TileTaskWorkerPool, | |
| 21 public RasterBufferProvider { | |
| 22 public: | |
| 23 ~OneCopyTileTaskWorkerPool() override; | |
| 24 | |
| 25 static std::unique_ptr<TileTaskWorkerPool> Create( | |
| 26 base::SequencedTaskRunner* task_runner, | |
| 27 TaskGraphRunner* task_graph_runner, | |
| 28 ContextProvider* context_provider, | |
| 29 ResourceProvider* resource_provider, | |
| 30 int max_copy_texture_chromium_size, | |
| 31 bool use_partial_raster, | |
| 32 int max_staging_buffer_usage_in_bytes, | |
| 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 // Playback raster source and copy result into |resource|. | |
| 51 void PlaybackAndCopyOnWorkerThread( | |
| 52 const Resource* resource, | |
| 53 ResourceProvider::ScopedWriteLockGL* resource_lock, | |
| 54 const RasterSource* raster_source, | |
| 55 const gfx::Rect& raster_full_rect, | |
| 56 const gfx::Rect& raster_dirty_rect, | |
| 57 float scale, | |
| 58 const RasterSource::PlaybackSettings& playback_settings, | |
| 59 uint64_t previous_content_id, | |
| 60 uint64_t new_content_id); | |
| 61 | |
| 62 protected: | |
| 63 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | |
| 64 TaskGraphRunner* task_graph_runner, | |
| 65 ResourceProvider* resource_provider, | |
| 66 int max_copy_texture_chromium_size, | |
| 67 bool use_partial_raster, | |
| 68 int max_staging_buffer_usage_in_bytes, | |
| 69 ResourceFormat preferred_tile_format); | |
| 70 | |
| 71 private: | |
| 72 void PlaybackToStagingBuffer( | |
| 73 StagingBuffer* staging_buffer, | |
| 74 const Resource* resource, | |
| 75 const RasterSource* raster_source, | |
| 76 const gfx::Rect& raster_full_rect, | |
| 77 const gfx::Rect& raster_dirty_rect, | |
| 78 float scale, | |
| 79 const RasterSource::PlaybackSettings& playback_settings, | |
| 80 uint64_t previous_content_id, | |
| 81 uint64_t new_content_id); | |
| 82 void CopyOnWorkerThread(StagingBuffer* staging_buffer, | |
| 83 const Resource* resource, | |
| 84 ResourceProvider::ScopedWriteLockGL* resource_lock, | |
| 85 const RasterSource* raster_source, | |
| 86 uint64_t previous_content_id, | |
| 87 uint64_t new_content_id); | |
| 88 | |
| 89 TaskGraphRunner* task_graph_runner_; | |
| 90 const NamespaceToken namespace_token_; | |
| 91 ResourceProvider* const resource_provider_; | |
| 92 const int max_bytes_per_copy_operation_; | |
| 93 bool use_partial_raster_; | |
| 94 | |
| 95 // Context lock must be acquired when accessing this member. | |
| 96 int bytes_scheduled_since_last_flush_; | |
| 97 | |
| 98 ResourceFormat preferred_tile_format_; | |
| 99 std::unique_ptr<StagingBufferPool> staging_pool_; | |
| 100 | |
| 101 Task::Vector completed_tasks_; | |
| 102 | |
| 103 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | |
| 104 }; | |
| 105 | |
| 106 } // namespace cc | |
| 107 | |
| 108 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | |
| OLD | NEW |