| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ResourceFormat resource_format; | 92 ResourceFormat resource_format; |
| 93 gpu::Mailbox mailbox; | 93 gpu::Mailbox mailbox; |
| 94 // The balance between the number of times this resource has been returned | 94 // The balance between the number of times this resource has been returned |
| 95 // from CreateForSoftwarePlanes vs released in RecycleResource. | 95 // from CreateForSoftwarePlanes vs released in RecycleResource. |
| 96 int ref_count; | 96 int ref_count; |
| 97 // These last three members will be used for identifying the data stored in | 97 // These last three members will be used for identifying the data stored in |
| 98 // this resource, and uniquely identifies a media::VideoFrame plane. The | 98 // this resource, and uniquely identifies a media::VideoFrame plane. The |
| 99 // frame pointer will only be used for pointer comparison, i.e. the | 99 // frame pointer will only be used for pointer comparison, i.e. the |
| 100 // underlying data will not be accessed. | 100 // underlying data will not be accessed. |
| 101 const void* frame_ptr; | 101 const void* frame_ptr; |
| 102 #if DCHECK_IS_ON() |
| 103 // This is marked true when the orginal VideoFrame is destructed. It is |
| 104 // used to detect clients that are not setting the VideoFrame's timestamp |
| 105 // field correctly, as required. The memory allocator can and will re-use |
| 106 // the same pointer for new VideoFrame instances, so a destruction observer |
| 107 // is used to detect that. |
| 108 bool destructed; |
| 109 #endif |
| 102 size_t plane_index; | 110 size_t plane_index; |
| 103 base::TimeDelta timestamp; | 111 base::TimeDelta timestamp; |
| 104 | 112 |
| 105 PlaneResource(unsigned resource_id, | 113 PlaneResource(unsigned resource_id, |
| 106 const gfx::Size& resource_size, | 114 const gfx::Size& resource_size, |
| 107 ResourceFormat resource_format, | 115 ResourceFormat resource_format, |
| 108 gpu::Mailbox mailbox); | 116 gpu::Mailbox mailbox); |
| 109 PlaneResource(const PlaneResource& other); | 117 PlaneResource(const PlaneResource& other); |
| 110 }; | 118 }; |
| 111 | 119 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 136 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 144 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
| 137 unsigned resource_id, | 145 unsigned resource_id, |
| 138 const gpu::SyncToken& sync_token, | 146 const gpu::SyncToken& sync_token, |
| 139 bool lost_resource, | 147 bool lost_resource, |
| 140 BlockingTaskRunner* main_thread_task_runner); | 148 BlockingTaskRunner* main_thread_task_runner); |
| 141 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 149 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
| 142 const scoped_refptr<media::VideoFrame>& video_frame, | 150 const scoped_refptr<media::VideoFrame>& video_frame, |
| 143 const gpu::SyncToken& sync_token, | 151 const gpu::SyncToken& sync_token, |
| 144 bool lost_resource, | 152 bool lost_resource, |
| 145 BlockingTaskRunner* main_thread_task_runner); | 153 BlockingTaskRunner* main_thread_task_runner); |
| 154 #if DCHECK_IS_ON() |
| 155 // Mark the |destructed| as true when the orginal VideoFrame is destructed. |
| 156 static void MarkOldResource(base::WeakPtr<VideoResourceUpdater> updater, |
| 157 const media::VideoFrame* video_frame_ptr, |
| 158 base::TimeDelta timestamp); |
| 159 #endif |
| 146 | 160 |
| 147 ContextProvider* context_provider_; | 161 ContextProvider* context_provider_; |
| 148 ResourceProvider* resource_provider_; | 162 ResourceProvider* resource_provider_; |
| 149 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 163 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
| 150 std::vector<uint8_t> upload_pixels_; | 164 std::vector<uint8_t> upload_pixels_; |
| 151 | 165 |
| 152 // Recycle resources so that we can reduce the number of allocations and | 166 // Recycle resources so that we can reduce the number of allocations and |
| 153 // data transfers. | 167 // data transfers. |
| 154 ResourceList all_resources_; | 168 ResourceList all_resources_; |
| 155 | 169 |
| 156 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 170 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 157 }; | 171 }; |
| 158 | 172 |
| 159 } // namespace cc | 173 } // namespace cc |
| 160 | 174 |
| 161 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 175 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| OLD | NEW |