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) | |
103 // This is marked true when the orginal VideoFrame is destructed. It is used | |
104 // to detect the reuse of the destructed resource (in Debug mode only). | |
miu
2016/03/09 01:59:49
Instead of "It is used to detect the reuse of the
xjz
2016/03/10 01:51:44
Done.
| |
105 bool destructed; | |
106 #endif | |
102 size_t plane_index; | 107 size_t plane_index; |
103 base::TimeDelta timestamp; | 108 base::TimeDelta timestamp; |
104 | 109 |
105 PlaneResource(unsigned resource_id, | 110 PlaneResource(unsigned resource_id, |
106 const gfx::Size& resource_size, | 111 const gfx::Size& resource_size, |
107 ResourceFormat resource_format, | 112 ResourceFormat resource_format, |
108 gpu::Mailbox mailbox); | 113 gpu::Mailbox mailbox); |
109 PlaneResource(const PlaneResource& other); | 114 PlaneResource(const PlaneResource& other); |
110 }; | 115 }; |
111 | 116 |
(...skipping 25 matching lines...) Expand all Loading... | |
137 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 142 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
138 unsigned resource_id, | 143 unsigned resource_id, |
139 const gpu::SyncToken& sync_token, | 144 const gpu::SyncToken& sync_token, |
140 bool lost_resource, | 145 bool lost_resource, |
141 BlockingTaskRunner* main_thread_task_runner); | 146 BlockingTaskRunner* main_thread_task_runner); |
142 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 147 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
143 const scoped_refptr<media::VideoFrame>& video_frame, | 148 const scoped_refptr<media::VideoFrame>& video_frame, |
144 const gpu::SyncToken& sync_token, | 149 const gpu::SyncToken& sync_token, |
145 bool lost_resource, | 150 bool lost_resource, |
146 BlockingTaskRunner* main_thread_task_runner); | 151 BlockingTaskRunner* main_thread_task_runner); |
152 #if !defined(NDEBUG) | |
153 // Mark the |destructed| as true when the orginal VideoFrame is destructed. | |
154 static void MarkOldResource(base::WeakPtr<VideoResourceUpdater> updater, | |
155 const void* video_frame_ptr, | |
156 base::TimeDelta timestamp); | |
157 #endif | |
147 | 158 |
148 ContextProvider* context_provider_; | 159 ContextProvider* context_provider_; |
149 ResourceProvider* resource_provider_; | 160 ResourceProvider* resource_provider_; |
150 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 161 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
151 std::vector<uint8_t> upload_pixels_; | 162 std::vector<uint8_t> upload_pixels_; |
152 | 163 |
153 // Recycle resources so that we can reduce the number of allocations and | 164 // Recycle resources so that we can reduce the number of allocations and |
154 // data transfers. | 165 // data transfers. |
155 ResourceList all_resources_; | 166 ResourceList all_resources_; |
156 | 167 |
157 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 168 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
158 }; | 169 }; |
159 | 170 |
160 } // namespace cc | 171 } // namespace cc |
161 | 172 |
162 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 173 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |