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