| 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_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| 6 #define CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void Shutdown() override; | 44 void Shutdown() override; |
| 45 | 45 |
| 46 // Playback raster source and copy result into |resource|. | 46 // Playback raster source and copy result into |resource|. |
| 47 void PlaybackAndCopyOnWorkerThread( | 47 void PlaybackAndCopyOnWorkerThread( |
| 48 const Resource* resource, | 48 const Resource* resource, |
| 49 ResourceProvider::ScopedWriteLockGL* resource_lock, | 49 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 50 const gpu::SyncToken& sync_token, | 50 const gpu::SyncToken& sync_token, |
| 51 const RasterSource* raster_source, | 51 const RasterSource* raster_source, |
| 52 const gfx::Rect& raster_full_rect, | 52 const gfx::Rect& raster_full_rect, |
| 53 const gfx::Rect& raster_dirty_rect, | 53 const gfx::Rect& raster_dirty_rect, |
| 54 const gfx::SizeF& scales, | 54 const ScaleTranslate2d& transform, |
| 55 const RasterSource::PlaybackSettings& playback_settings, | 55 const RasterSource::PlaybackSettings& playback_settings, |
| 56 uint64_t previous_content_id, | 56 uint64_t previous_content_id, |
| 57 uint64_t new_content_id); | 57 uint64_t new_content_id); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 class RasterBufferImpl : public RasterBuffer { | 60 class RasterBufferImpl : public RasterBuffer { |
| 61 public: | 61 public: |
| 62 RasterBufferImpl(OneCopyRasterBufferProvider* client, | 62 RasterBufferImpl(OneCopyRasterBufferProvider* client, |
| 63 ResourceProvider* resource_provider, | 63 ResourceProvider* resource_provider, |
| 64 const Resource* resource, | 64 const Resource* resource, |
| 65 uint64_t previous_content_id, | 65 uint64_t previous_content_id, |
| 66 bool async_worker_context_enabled); | 66 bool async_worker_context_enabled); |
| 67 ~RasterBufferImpl() override; | 67 ~RasterBufferImpl() override; |
| 68 | 68 |
| 69 // Overridden from RasterBuffer: | 69 // Overridden from RasterBuffer: |
| 70 void Playback( | 70 void Playback( |
| 71 const RasterSource* raster_source, | 71 const RasterSource* raster_source, |
| 72 const gfx::Rect& raster_full_rect, | 72 const gfx::Rect& raster_full_rect, |
| 73 const gfx::Rect& raster_dirty_rect, | 73 const gfx::Rect& raster_dirty_rect, |
| 74 uint64_t new_content_id, | 74 uint64_t new_content_id, |
| 75 const gfx::SizeF& scales, | 75 const ScaleTranslate2d& transform, |
| 76 const RasterSource::PlaybackSettings& playback_settings) override; | 76 const RasterSource::PlaybackSettings& playback_settings) override; |
| 77 | 77 |
| 78 void set_sync_token(const gpu::SyncToken& sync_token) { | 78 void set_sync_token(const gpu::SyncToken& sync_token) { |
| 79 sync_token_ = sync_token; | 79 sync_token_ = sync_token; |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 OneCopyRasterBufferProvider* client_; | 83 OneCopyRasterBufferProvider* client_; |
| 84 const Resource* resource_; | 84 const Resource* resource_; |
| 85 ResourceProvider::ScopedWriteLockGL lock_; | 85 ResourceProvider::ScopedWriteLockGL lock_; |
| 86 uint64_t previous_content_id_; | 86 uint64_t previous_content_id_; |
| 87 | 87 |
| 88 gpu::SyncToken sync_token_; | 88 gpu::SyncToken sync_token_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 90 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 void PlaybackToStagingBuffer( | 93 void PlaybackToStagingBuffer( |
| 94 StagingBuffer* staging_buffer, | 94 StagingBuffer* staging_buffer, |
| 95 const Resource* resource, | 95 const Resource* resource, |
| 96 const RasterSource* raster_source, | 96 const RasterSource* raster_source, |
| 97 const gfx::Rect& raster_full_rect, | 97 const gfx::Rect& raster_full_rect, |
| 98 const gfx::Rect& raster_dirty_rect, | 98 const gfx::Rect& raster_dirty_rect, |
| 99 const gfx::SizeF& scales, | 99 const ScaleTranslate2d& transform, |
| 100 sk_sp<SkColorSpace> dst_color_space, | 100 sk_sp<SkColorSpace> dst_color_space, |
| 101 const RasterSource::PlaybackSettings& playback_settings, | 101 const RasterSource::PlaybackSettings& playback_settings, |
| 102 uint64_t previous_content_id, | 102 uint64_t previous_content_id, |
| 103 uint64_t new_content_id); | 103 uint64_t new_content_id); |
| 104 void CopyOnWorkerThread(StagingBuffer* staging_buffer, | 104 void CopyOnWorkerThread(StagingBuffer* staging_buffer, |
| 105 ResourceProvider::ScopedWriteLockGL* resource_lock, | 105 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 106 const gpu::SyncToken& sync_token, | 106 const gpu::SyncToken& sync_token, |
| 107 const RasterSource* raster_source, | 107 const RasterSource* raster_source, |
| 108 uint64_t previous_content_id, | 108 uint64_t previous_content_id, |
| 109 uint64_t new_content_id); | 109 uint64_t new_content_id); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 124 const bool async_worker_context_enabled_; | 124 const bool async_worker_context_enabled_; |
| 125 | 125 |
| 126 std::set<RasterBufferImpl*> pending_raster_buffers_; | 126 std::set<RasterBufferImpl*> pending_raster_buffers_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); | 128 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace cc | 131 } // namespace cc |
| 132 | 132 |
| 133 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 133 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |