| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 // TODO(danakj): Remove this and abstract TextureMailbox into | 42 // TODO(danakj): Remove this and abstract TextureMailbox into |
| 43 // "ExternalResource" that can hold a hardware or software backing. | 43 // "ExternalResource" that can hold a hardware or software backing. |
| 44 SOFTWARE_RESOURCE | 44 SOFTWARE_RESOURCE |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 ResourceType type; | 47 ResourceType type; |
| 48 std::vector<TextureMailbox> mailboxes; | 48 std::vector<TextureMailbox> mailboxes; |
| 49 | 49 |
| 50 // TODO(danakj): Remove these when we get a Mailbox from VideoFrame. |
| 51 unsigned hardware_resource; |
| 52 TextureMailbox::ReleaseCallback hardware_release_callback; |
| 53 |
| 50 // TODO(danakj): Remove these too. | 54 // TODO(danakj): Remove these too. |
| 51 std::vector<unsigned> software_resources; | 55 std::vector<unsigned> software_resources; |
| 52 TextureMailbox::ReleaseCallback software_release_callback; | 56 TextureMailbox::ReleaseCallback software_release_callback; |
| 53 | 57 |
| 54 VideoFrameExternalResources(); | 58 VideoFrameExternalResources(); |
| 55 ~VideoFrameExternalResources(); | 59 ~VideoFrameExternalResources(); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 // VideoResourceUpdater is by the video system to produce frame content as | 62 // VideoResourceUpdater is by the video system to produce frame content as |
| 59 // resources consumable by the compositor. | 63 // resources consumable by the compositor. |
| 60 class VideoResourceUpdater | 64 class VideoResourceUpdater |
| 61 : public base::SupportsWeakPtr<VideoResourceUpdater> { | 65 : public base::SupportsWeakPtr<VideoResourceUpdater> { |
| 62 public: | 66 public: |
| 63 explicit VideoResourceUpdater(ResourceProvider* resource_provider); | 67 explicit VideoResourceUpdater(ResourceProvider* resource_provider); |
| 64 ~VideoResourceUpdater(); | 68 ~VideoResourceUpdater(); |
| 65 | 69 |
| 66 VideoFrameExternalResources CreateForHardwarePlanes( | 70 VideoFrameExternalResources CreateForHardwarePlanes( |
| 67 const scoped_refptr<media::VideoFrame>& video_frame, | 71 const scoped_refptr<media::VideoFrame>& video_frame); |
| 68 const TextureMailbox::ReleaseCallback& release_callback); | |
| 69 | 72 |
| 70 VideoFrameExternalResources CreateForSoftwarePlanes( | 73 VideoFrameExternalResources CreateForSoftwarePlanes( |
| 71 const scoped_refptr<media::VideoFrame>& video_frame); | 74 const scoped_refptr<media::VideoFrame>& video_frame); |
| 72 | 75 |
| 73 private: | 76 private: |
| 74 struct PlaneResource { | 77 struct PlaneResource { |
| 75 unsigned resource_id; | 78 unsigned resource_id; |
| 76 gfx::Size resource_size; | 79 gfx::Size resource_size; |
| 77 unsigned resource_format; | 80 unsigned resource_format; |
| 78 unsigned sync_point; | 81 unsigned sync_point; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 gfx::Size resource_size; | 97 gfx::Size resource_size; |
| 95 unsigned resource_format; | 98 unsigned resource_format; |
| 96 gpu::Mailbox mailbox; | 99 gpu::Mailbox mailbox; |
| 97 }; | 100 }; |
| 98 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 101 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
| 99 ResourceProvider* resource_provider, | 102 ResourceProvider* resource_provider, |
| 100 RecycleResourceData data, | 103 RecycleResourceData data, |
| 101 unsigned sync_point, | 104 unsigned sync_point, |
| 102 bool lost_resource); | 105 bool lost_resource); |
| 103 static void ReturnTexture(ResourceProvider* resource_provider, | 106 static void ReturnTexture(ResourceProvider* resource_provider, |
| 104 TextureMailbox::ReleaseCallback callback, | 107 unsigned resource_id, |
| 105 unsigned texture_id, | |
| 106 gpu::Mailbox mailbox, | |
| 107 unsigned sync_point, | 108 unsigned sync_point, |
| 108 bool lost_resource); | 109 bool lost_resource); |
| 109 | 110 |
| 110 ResourceProvider* resource_provider_; | 111 ResourceProvider* resource_provider_; |
| 111 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 112 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
| 112 | 113 |
| 113 std::vector<PlaneResource> recycled_resources_; | 114 std::vector<PlaneResource> recycled_resources_; |
| 114 | 115 |
| 115 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 116 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 } // namespace cc | 119 } // namespace cc |
| 119 | 120 |
| 120 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 121 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| OLD | NEW |