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 bool has_mailbox, | 145 bool has_mailbox, |
142 bool immutable_hint); | 146 bool immutable_hint); |
143 void DeleteResource(ResourceList::iterator resource_it); | 147 void DeleteResource(ResourceList::iterator resource_it); |
144 void CopyPlaneTexture(media::VideoFrame* video_frame, | 148 void CopyPlaneTexture(media::VideoFrame* video_frame, |
145 const gpu::MailboxHolder& mailbox_holder, | 149 const gpu::MailboxHolder& mailbox_holder, |
146 VideoFrameExternalResources* external_resources); | 150 VideoFrameExternalResources* external_resources); |
147 VideoFrameExternalResources CreateForHardwarePlanes( | 151 VideoFrameExternalResources CreateForHardwarePlanes( |
148 scoped_refptr<media::VideoFrame> video_frame); | 152 scoped_refptr<media::VideoFrame> video_frame); |
| 153 VideoFrameExternalResources CreateRGBTextureForSoftwarePlanes( |
| 154 media::VideoFrame* video_frame); |
149 VideoFrameExternalResources CreateForSoftwarePlanes( | 155 VideoFrameExternalResources CreateForSoftwarePlanes( |
150 scoped_refptr<media::VideoFrame> video_frame); | 156 scoped_refptr<media::VideoFrame> video_frame); |
151 | 157 |
152 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 158 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
153 unsigned resource_id, | 159 unsigned resource_id, |
154 const gpu::SyncToken& sync_token, | 160 const gpu::SyncToken& sync_token, |
155 bool lost_resource, | 161 bool lost_resource, |
156 BlockingTaskRunner* main_thread_task_runner); | 162 BlockingTaskRunner* main_thread_task_runner); |
157 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 163 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
158 const scoped_refptr<media::VideoFrame>& video_frame, | 164 const scoped_refptr<media::VideoFrame>& video_frame, |
159 const gpu::SyncToken& sync_token, | 165 const gpu::SyncToken& sync_token, |
160 bool lost_resource, | 166 bool lost_resource, |
161 BlockingTaskRunner* main_thread_task_runner); | 167 BlockingTaskRunner* main_thread_task_runner); |
162 | 168 |
163 ContextProvider* context_provider_; | 169 ContextProvider* context_provider_; |
164 ResourceProvider* resource_provider_; | 170 ResourceProvider* resource_provider_; |
165 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 171 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
166 std::vector<uint8_t> upload_pixels_; | 172 std::vector<uint8_t> upload_pixels_; |
167 | 173 |
168 // Recycle resources so that we can reduce the number of allocations and | 174 // Recycle resources so that we can reduce the number of allocations and |
169 // data transfers. | 175 // data transfers. |
170 ResourceList all_resources_; | 176 ResourceList all_resources_; |
171 | 177 |
172 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 178 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
173 }; | 179 }; |
174 | 180 |
175 } // namespace cc | 181 } // namespace cc |
176 | 182 |
177 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 183 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |