| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 VideoFrameExternalResources(const VideoFrameExternalResources& other); | 67 VideoFrameExternalResources(const VideoFrameExternalResources& other); |
| 68 ~VideoFrameExternalResources(); | 68 ~VideoFrameExternalResources(); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // VideoResourceUpdater is used by the video system to produce frame content as | 71 // VideoResourceUpdater is used by the video system to produce frame content as |
| 72 // resources consumable by the compositor. | 72 // resources consumable by the compositor. |
| 73 class CC_EXPORT VideoResourceUpdater | 73 class CC_EXPORT VideoResourceUpdater |
| 74 : public base::SupportsWeakPtr<VideoResourceUpdater> { | 74 : public base::SupportsWeakPtr<VideoResourceUpdater> { |
| 75 public: | 75 public: |
| 76 VideoResourceUpdater(ContextProvider* context_provider, | 76 VideoResourceUpdater(ContextProvider* context_provider, |
| 77 ResourceProvider* resource_provider, | 77 ResourceProvider* resource_provider); |
| 78 bool use_stream_video_draw_quad); | |
| 79 ~VideoResourceUpdater(); | 78 ~VideoResourceUpdater(); |
| 80 | 79 |
| 81 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( | 80 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( |
| 82 scoped_refptr<media::VideoFrame> video_frame); | 81 scoped_refptr<media::VideoFrame> video_frame); |
| 83 | 82 |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 class PlaneResource { | 85 class PlaneResource { |
| 87 public: | 86 public: |
| 88 PlaneResource(unsigned resource_id, | 87 PlaneResource(unsigned resource_id, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 bool lost_resource, | 169 bool lost_resource, |
| 171 BlockingTaskRunner* main_thread_task_runner); | 170 BlockingTaskRunner* main_thread_task_runner); |
| 172 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 171 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
| 173 const scoped_refptr<media::VideoFrame>& video_frame, | 172 const scoped_refptr<media::VideoFrame>& video_frame, |
| 174 const gpu::SyncToken& sync_token, | 173 const gpu::SyncToken& sync_token, |
| 175 bool lost_resource, | 174 bool lost_resource, |
| 176 BlockingTaskRunner* main_thread_task_runner); | 175 BlockingTaskRunner* main_thread_task_runner); |
| 177 | 176 |
| 178 ContextProvider* context_provider_; | 177 ContextProvider* context_provider_; |
| 179 ResourceProvider* resource_provider_; | 178 ResourceProvider* resource_provider_; |
| 180 const bool use_stream_video_draw_quad_; | |
| 181 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 179 std::unique_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
| 182 std::vector<uint8_t> upload_pixels_; | 180 std::vector<uint8_t> upload_pixels_; |
| 183 | 181 |
| 184 // Recycle resources so that we can reduce the number of allocations and | 182 // Recycle resources so that we can reduce the number of allocations and |
| 185 // data transfers. | 183 // data transfers. |
| 186 ResourceList all_resources_; | 184 ResourceList all_resources_; |
| 187 | 185 |
| 188 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 186 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 189 }; | 187 }; |
| 190 | 188 |
| 191 } // namespace cc | 189 } // namespace cc |
| 192 | 190 |
| 193 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 191 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| OLD | NEW |