| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 float scale, |
| 56 const gfx::Vector2dF& translation, |
| 56 const RasterSource::PlaybackSettings& playback_settings, | 57 const RasterSource::PlaybackSettings& playback_settings, |
| 57 uint64_t previous_content_id, | 58 uint64_t previous_content_id, |
| 58 uint64_t new_content_id); | 59 uint64_t new_content_id); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 class RasterBufferImpl : public RasterBuffer { | 62 class RasterBufferImpl : public RasterBuffer { |
| 62 public: | 63 public: |
| 63 RasterBufferImpl(OneCopyRasterBufferProvider* client, | 64 RasterBufferImpl(OneCopyRasterBufferProvider* client, |
| 64 ResourceProvider* resource_provider, | 65 ResourceProvider* resource_provider, |
| 65 const Resource* resource, | 66 const Resource* resource, |
| 66 uint64_t previous_content_id, | 67 uint64_t previous_content_id, |
| 67 bool async_worker_context_enabled); | 68 bool async_worker_context_enabled); |
| 68 ~RasterBufferImpl() override; | 69 ~RasterBufferImpl() override; |
| 69 | 70 |
| 70 // Overridden from RasterBuffer: | 71 // Overridden from RasterBuffer: |
| 71 void Playback( | 72 void Playback( |
| 72 const RasterSource* raster_source, | 73 const RasterSource* raster_source, |
| 73 const gfx::Rect& raster_full_rect, | 74 const gfx::Rect& raster_full_rect, |
| 74 const gfx::Rect& raster_dirty_rect, | 75 const gfx::Rect& raster_dirty_rect, |
| 75 uint64_t new_content_id, | 76 uint64_t new_content_id, |
| 76 float scale, | 77 float scale, |
| 78 const gfx::Vector2dF& translation, |
| 77 const RasterSource::PlaybackSettings& playback_settings) override; | 79 const RasterSource::PlaybackSettings& playback_settings) override; |
| 78 | 80 |
| 79 void set_sync_token(const gpu::SyncToken& sync_token) { | 81 void set_sync_token(const gpu::SyncToken& sync_token) { |
| 80 sync_token_ = sync_token; | 82 sync_token_ = sync_token; |
| 81 } | 83 } |
| 82 | 84 |
| 83 private: | 85 private: |
| 84 OneCopyRasterBufferProvider* client_; | 86 OneCopyRasterBufferProvider* client_; |
| 85 const Resource* resource_; | 87 const Resource* resource_; |
| 86 ResourceProvider::ScopedWriteLockGL lock_; | 88 ResourceProvider::ScopedWriteLockGL lock_; |
| 87 uint64_t previous_content_id_; | 89 uint64_t previous_content_id_; |
| 88 | 90 |
| 89 gpu::SyncToken sync_token_; | 91 gpu::SyncToken sync_token_; |
| 90 | 92 |
| 91 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 93 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 void PlaybackToStagingBuffer( | 96 void PlaybackToStagingBuffer( |
| 95 StagingBuffer* staging_buffer, | 97 StagingBuffer* staging_buffer, |
| 96 const Resource* resource, | 98 const Resource* resource, |
| 97 const RasterSource* raster_source, | 99 const RasterSource* raster_source, |
| 98 const gfx::Rect& raster_full_rect, | 100 const gfx::Rect& raster_full_rect, |
| 99 const gfx::Rect& raster_dirty_rect, | 101 const gfx::Rect& raster_dirty_rect, |
| 100 float scale, | 102 float scale, |
| 103 const gfx::Vector2dF& translation, |
| 101 const RasterSource::PlaybackSettings& playback_settings, | 104 const RasterSource::PlaybackSettings& playback_settings, |
| 102 uint64_t previous_content_id, | 105 uint64_t previous_content_id, |
| 103 uint64_t new_content_id); | 106 uint64_t new_content_id); |
| 104 void CopyOnWorkerThread(StagingBuffer* staging_buffer, | 107 void CopyOnWorkerThread(StagingBuffer* staging_buffer, |
| 105 ResourceProvider::ScopedWriteLockGL* resource_lock, | 108 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 106 const gpu::SyncToken& sync_token, | 109 const gpu::SyncToken& sync_token, |
| 107 const RasterSource* raster_source, | 110 const RasterSource* raster_source, |
| 108 uint64_t previous_content_id, | 111 uint64_t previous_content_id, |
| 109 uint64_t new_content_id); | 112 uint64_t new_content_id); |
| 110 gfx::BufferUsage StagingBufferUsage() const; | 113 gfx::BufferUsage StagingBufferUsage() const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 124 const bool async_worker_context_enabled_; | 127 const bool async_worker_context_enabled_; |
| 125 | 128 |
| 126 std::set<RasterBufferImpl*> pending_raster_buffers_; | 129 std::set<RasterBufferImpl*> pending_raster_buffers_; |
| 127 | 130 |
| 128 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); | 131 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } // namespace cc | 134 } // namespace cc |
| 132 | 135 |
| 133 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 136 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |