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 !defined(NDEBUG) | |
danakj
2016/03/14 18:52:41
I think you mean #if DCHECK_IS_ON()
xjz
2016/03/15 21:04:00
Done.
| |
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 25 matching lines...) Expand all Loading... | |
137 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 145 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
138 unsigned resource_id, | 146 unsigned resource_id, |
139 const gpu::SyncToken& sync_token, | 147 const gpu::SyncToken& sync_token, |
140 bool lost_resource, | 148 bool lost_resource, |
141 BlockingTaskRunner* main_thread_task_runner); | 149 BlockingTaskRunner* main_thread_task_runner); |
142 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 150 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
143 const scoped_refptr<media::VideoFrame>& video_frame, | 151 const scoped_refptr<media::VideoFrame>& video_frame, |
144 const gpu::SyncToken& sync_token, | 152 const gpu::SyncToken& sync_token, |
145 bool lost_resource, | 153 bool lost_resource, |
146 BlockingTaskRunner* main_thread_task_runner); | 154 BlockingTaskRunner* main_thread_task_runner); |
155 #if !defined(NDEBUG) | |
danakj
2016/03/14 18:52:41
for all these
xjz
2016/03/15 21:04:00
Done.
| |
156 // Mark the |destructed| as true when the orginal VideoFrame is destructed. | |
157 static void MarkOldResource(base::WeakPtr<VideoResourceUpdater> updater, | |
158 const void* video_frame_ptr, | |
159 base::TimeDelta timestamp); | |
160 #endif | |
147 | 161 |
148 ContextProvider* context_provider_; | 162 ContextProvider* context_provider_; |
149 ResourceProvider* resource_provider_; | 163 ResourceProvider* resource_provider_; |
150 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 164 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
151 std::vector<uint8_t> upload_pixels_; | 165 std::vector<uint8_t> upload_pixels_; |
152 | 166 |
153 // Recycle resources so that we can reduce the number of allocations and | 167 // Recycle resources so that we can reduce the number of allocations and |
154 // data transfers. | 168 // data transfers. |
155 ResourceList all_resources_; | 169 ResourceList all_resources_; |
156 | 170 |
157 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 171 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
158 }; | 172 }; |
159 | 173 |
160 } // namespace cc | 174 } // namespace cc |
161 | 175 |
162 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 176 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |