| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void Shutdown() override; | 45 void Shutdown() override; |
| 46 | 46 |
| 47 // Playback raster source and copy result into |resource|. | 47 // Playback raster source and copy result into |resource|. |
| 48 void PlaybackAndCopyOnWorkerThread( | 48 void PlaybackAndCopyOnWorkerThread( |
| 49 const Resource* resource, | 49 const Resource* resource, |
| 50 ResourceProvider::ScopedWriteLockGL* resource_lock, | 50 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 51 const gpu::SyncToken& sync_token, | 51 const gpu::SyncToken& sync_token, |
| 52 const RasterSource* raster_source, | 52 const RasterSource* raster_source, |
| 53 const gfx::Rect& raster_full_rect, | 53 const gfx::Rect& raster_full_rect, |
| 54 const gfx::Rect& raster_dirty_rect, | 54 const gfx::Rect& raster_dirty_rect, |
| 55 float scale, | 55 const ScaleTranslate2d& transform, |
| 56 const RasterSource::PlaybackSettings& playback_settings, | 56 const RasterSource::PlaybackSettings& playback_settings, |
| 57 uint64_t previous_content_id, | 57 uint64_t previous_content_id, |
| 58 uint64_t new_content_id); | 58 uint64_t new_content_id); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 class RasterBufferImpl : public RasterBuffer { | 61 class RasterBufferImpl : public RasterBuffer { |
| 62 public: | 62 public: |
| 63 RasterBufferImpl(OneCopyRasterBufferProvider* client, | 63 RasterBufferImpl(OneCopyRasterBufferProvider* client, |
| 64 ResourceProvider* resource_provider, | 64 ResourceProvider* resource_provider, |
| 65 const Resource* resource, | 65 const Resource* resource, |
| 66 uint64_t previous_content_id, | 66 uint64_t previous_content_id, |
| 67 bool async_worker_context_enabled); | 67 bool async_worker_context_enabled); |
| 68 ~RasterBufferImpl() override; | 68 ~RasterBufferImpl() override; |
| 69 | 69 |
| 70 // Overridden from RasterBuffer: | 70 // Overridden from RasterBuffer: |
| 71 void Playback( | 71 void Playback( |
| 72 const RasterSource* raster_source, | 72 const RasterSource* raster_source, |
| 73 const gfx::Rect& raster_full_rect, | 73 const gfx::Rect& raster_full_rect, |
| 74 const gfx::Rect& raster_dirty_rect, | 74 const gfx::Rect& raster_dirty_rect, |
| 75 uint64_t new_content_id, | 75 uint64_t new_content_id, |
| 76 float scale, | 76 const ScaleTranslate2d& transform, |
| 77 const RasterSource::PlaybackSettings& playback_settings) override; | 77 const RasterSource::PlaybackSettings& playback_settings) override; |
| 78 | 78 |
| 79 void set_sync_token(const gpu::SyncToken& sync_token) { | 79 void set_sync_token(const gpu::SyncToken& sync_token) { |
| 80 sync_token_ = sync_token; | 80 sync_token_ = sync_token; |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 OneCopyRasterBufferProvider* client_; | 84 OneCopyRasterBufferProvider* client_; |
| 85 const Resource* resource_; | 85 const Resource* resource_; |
| 86 ResourceProvider::ScopedWriteLockGL lock_; | 86 ResourceProvider::ScopedWriteLockGL lock_; |
| 87 uint64_t previous_content_id_; | 87 uint64_t previous_content_id_; |
| 88 | 88 |
| 89 gpu::SyncToken sync_token_; | 89 gpu::SyncToken sync_token_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 91 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 void PlaybackToStagingBuffer( | 94 void PlaybackToStagingBuffer( |
| 95 StagingBuffer* staging_buffer, | 95 StagingBuffer* staging_buffer, |
| 96 const Resource* resource, | 96 const Resource* resource, |
| 97 const RasterSource* raster_source, | 97 const RasterSource* raster_source, |
| 98 const gfx::Rect& raster_full_rect, | 98 const gfx::Rect& raster_full_rect, |
| 99 const gfx::Rect& raster_dirty_rect, | 99 const gfx::Rect& raster_dirty_rect, |
| 100 float scale, | 100 const ScaleTranslate2d& transform, |
| 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); |
| 110 gfx::BufferUsage StagingBufferUsage() const; | 110 gfx::BufferUsage StagingBufferUsage() const; |
| (...skipping 13 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 |