OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 const unsigned resource_id_; | 130 const unsigned resource_id_; |
131 const gfx::Size resource_size_; | 131 const gfx::Size resource_size_; |
132 const ResourceFormat resource_format_; | 132 const ResourceFormat resource_format_; |
133 const gpu::Mailbox mailbox_; | 133 const gpu::Mailbox mailbox_; |
134 }; | 134 }; |
135 | 135 |
136 // This needs to be a container where iterators can be erased without | 136 // This needs to be a container where iterators can be erased without |
137 // invalidating other iterators. | 137 // invalidating other iterators. |
138 typedef std::list<PlaneResource> ResourceList; | 138 typedef std::list<PlaneResource> ResourceList; |
| 139 ResourceList::iterator RecycleOrAllocateTexture( |
| 140 const gfx::Size& resource_size, |
| 141 ResourceFormat resource_format, |
| 142 bool immutable_hint); |
139 ResourceList::iterator AllocateResource(const gfx::Size& plane_size, | 143 ResourceList::iterator AllocateResource(const gfx::Size& plane_size, |
140 ResourceFormat format, | 144 ResourceFormat format, |
141 const gfx::ColorSpace& color_space, | 145 const gfx::ColorSpace& color_space, |
142 bool has_mailbox, | 146 bool has_mailbox, |
143 bool immutable_hint); | 147 bool immutable_hint); |
144 void DeleteResource(ResourceList::iterator resource_it); | 148 void DeleteResource(ResourceList::iterator resource_it); |
145 void CopyPlaneTexture(media::VideoFrame* video_frame, | 149 void CopyPlaneTexture(media::VideoFrame* video_frame, |
146 const gpu::MailboxHolder& mailbox_holder, | 150 const gpu::MailboxHolder& mailbox_holder, |
147 VideoFrameExternalResources* external_resources); | 151 VideoFrameExternalResources* external_resources); |
148 VideoFrameExternalResources CreateForHardwarePlanes( | 152 VideoFrameExternalResources CreateForHardwarePlanes( |
149 scoped_refptr<media::VideoFrame> video_frame); | 153 scoped_refptr<media::VideoFrame> video_frame); |
| 154 VideoFrameExternalResources CreateRGBTextureForSoftwarePlanes( |
| 155 media::VideoFrame* video_frame); |
150 VideoFrameExternalResources CreateForSoftwarePlanes( | 156 VideoFrameExternalResources CreateForSoftwarePlanes( |
151 scoped_refptr<media::VideoFrame> video_frame); | 157 scoped_refptr<media::VideoFrame> video_frame); |
152 | 158 |
153 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 159 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
154 unsigned resource_id, | 160 unsigned resource_id, |
155 const gpu::SyncToken& sync_token, | 161 const gpu::SyncToken& sync_token, |
156 bool lost_resource, | 162 bool lost_resource, |
157 BlockingTaskRunner* main_thread_task_runner); | 163 BlockingTaskRunner* main_thread_task_runner); |
158 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 164 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
159 const scoped_refptr<media::VideoFrame>& video_frame, | 165 const scoped_refptr<media::VideoFrame>& video_frame, |
160 const gpu::SyncToken& sync_token, | 166 const gpu::SyncToken& sync_token, |
161 bool lost_resource, | 167 bool lost_resource, |
162 BlockingTaskRunner* main_thread_task_runner); | 168 BlockingTaskRunner* main_thread_task_runner); |
163 | 169 |
164 ContextProvider* context_provider_; | 170 ContextProvider* context_provider_; |
165 ResourceProvider* resource_provider_; | 171 ResourceProvider* resource_provider_; |
166 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 172 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
167 std::vector<uint8_t> upload_pixels_; | 173 std::vector<uint8_t> upload_pixels_; |
168 | 174 |
169 // Recycle resources so that we can reduce the number of allocations and | 175 // Recycle resources so that we can reduce the number of allocations and |
170 // data transfers. | 176 // data transfers. |
171 ResourceList all_resources_; | 177 ResourceList all_resources_; |
172 | 178 |
173 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 179 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
174 }; | 180 }; |
175 | 181 |
176 } // namespace cc | 182 } // namespace cc |
177 | 183 |
178 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 184 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |