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