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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 class CC_EXPORT VideoResourceUpdater { | 79 class CC_EXPORT VideoResourceUpdater { |
80 public: | 80 public: |
81 VideoResourceUpdater(viz::ContextProvider* context_provider, | 81 VideoResourceUpdater(viz::ContextProvider* context_provider, |
82 ResourceProvider* resource_provider, | 82 ResourceProvider* resource_provider, |
83 bool use_stream_video_draw_quad); | 83 bool use_stream_video_draw_quad); |
84 ~VideoResourceUpdater(); | 84 ~VideoResourceUpdater(); |
85 | 85 |
86 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( | 86 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( |
87 scoped_refptr<media::VideoFrame> video_frame); | 87 scoped_refptr<media::VideoFrame> video_frame); |
88 | 88 |
| 89 void UseR16ForTesting(bool use_r16_for_testing) { |
| 90 use_r16_for_testing_ = use_r16_for_testing; |
| 91 } |
| 92 |
89 private: | 93 private: |
90 class PlaneResource { | 94 class PlaneResource { |
91 public: | 95 public: |
92 PlaneResource(unsigned resource_id, | 96 PlaneResource(unsigned resource_id, |
93 const gfx::Size& resource_size, | 97 const gfx::Size& resource_size, |
94 viz::ResourceFormat resource_format, | 98 viz::ResourceFormat resource_format, |
95 gpu::Mailbox mailbox); | 99 gpu::Mailbox mailbox); |
96 PlaneResource(const PlaneResource& other); | 100 PlaneResource(const PlaneResource& other); |
97 | 101 |
98 // Returns true if this resource matches the unique identifiers of another | 102 // Returns true if this resource matches the unique identifiers of another |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 const scoped_refptr<media::VideoFrame>& video_frame, | 181 const scoped_refptr<media::VideoFrame>& video_frame, |
178 const gpu::SyncToken& sync_token, | 182 const gpu::SyncToken& sync_token, |
179 bool lost_resource, | 183 bool lost_resource, |
180 BlockingTaskRunner* main_thread_task_runner); | 184 BlockingTaskRunner* main_thread_task_runner); |
181 | 185 |
182 viz::ContextProvider* context_provider_; | 186 viz::ContextProvider* context_provider_; |
183 ResourceProvider* resource_provider_; | 187 ResourceProvider* resource_provider_; |
184 const bool use_stream_video_draw_quad_; | 188 const bool use_stream_video_draw_quad_; |
185 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 189 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
186 std::vector<uint8_t> upload_pixels_; | 190 std::vector<uint8_t> upload_pixels_; |
| 191 bool use_r16_for_testing_ = false; |
187 | 192 |
188 // Recycle resources so that we can reduce the number of allocations and | 193 // Recycle resources so that we can reduce the number of allocations and |
189 // data transfers. | 194 // data transfers. |
190 ResourceList all_resources_; | 195 ResourceList all_resources_; |
191 | 196 |
192 base::WeakPtrFactory<VideoResourceUpdater> weak_ptr_factory_; | 197 base::WeakPtrFactory<VideoResourceUpdater> weak_ptr_factory_; |
193 | 198 |
194 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 199 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
195 }; | 200 }; |
196 | 201 |
197 } // namespace cc | 202 } // namespace cc |
198 | 203 |
199 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 204 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |