Chromium Code Reviews| 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 #include "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
| 9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 TextureMailbox(plane_resources[i].mailbox, GL_TEXTURE_2D, 0)); | 277 TextureMailbox(plane_resources[i].mailbox, GL_TEXTURE_2D, 0)); |
| 278 external_resources.release_callbacks.push_back( | 278 external_resources.release_callbacks.push_back( |
| 279 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); | 279 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); |
| 280 } | 280 } |
| 281 | 281 |
| 282 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; | 282 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; |
| 283 return external_resources; | 283 return external_resources; |
| 284 } | 284 } |
| 285 | 285 |
| 286 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, | 286 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, |
| 287 ContextProvider* context_provider, | |
| 287 uint32 sync_point, | 288 uint32 sync_point, |
| 288 bool lost_resource) { | 289 bool lost_resource) { |
| 289 frame->AppendReleaseSyncPoint(sync_point); | 290 frame->AppendReleaseSyncPoint(reinterpret_cast<uintptr_t>(context_provider), |
| 291 sync_point); | |
|
dshwang
2014/06/05 14:38:30
reinterpret_cast is ugly but I could not find bett
dshwang
2014/06/05 14:53:19
That's good question. If one client waits for sync
| |
| 290 } | 292 } |
| 291 | 293 |
| 292 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 294 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
| 293 const scoped_refptr<media::VideoFrame>& video_frame) { | 295 const scoped_refptr<media::VideoFrame>& video_frame) { |
| 294 media::VideoFrame::Format frame_format = video_frame->format(); | 296 media::VideoFrame::Format frame_format = video_frame->format(); |
| 295 | 297 |
| 296 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); | 298 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); |
| 297 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) | 299 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) |
| 298 return VideoFrameExternalResources(); | 300 return VideoFrameExternalResources(); |
| 299 | 301 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 315 break; | 317 break; |
| 316 default: | 318 default: |
| 317 NOTREACHED(); | 319 NOTREACHED(); |
| 318 return VideoFrameExternalResources(); | 320 return VideoFrameExternalResources(); |
| 319 } | 321 } |
| 320 | 322 |
| 321 external_resources.mailboxes.push_back( | 323 external_resources.mailboxes.push_back( |
| 322 TextureMailbox(mailbox_holder->mailbox, | 324 TextureMailbox(mailbox_holder->mailbox, |
| 323 mailbox_holder->texture_target, | 325 mailbox_holder->texture_target, |
| 324 mailbox_holder->sync_point)); | 326 mailbox_holder->sync_point)); |
| 325 external_resources.release_callbacks.push_back( | 327 external_resources.release_callbacks.push_back(base::Bind( |
| 326 base::Bind(&ReturnTexture, video_frame)); | 328 &ReturnTexture, video_frame, base::Unretained(context_provider_))); |
| 327 return external_resources; | 329 return external_resources; |
| 328 } | 330 } |
| 329 | 331 |
| 330 // static | 332 // static |
| 331 void VideoResourceUpdater::RecycleResource( | 333 void VideoResourceUpdater::RecycleResource( |
| 332 base::WeakPtr<VideoResourceUpdater> updater, | 334 base::WeakPtr<VideoResourceUpdater> updater, |
| 333 RecycleResourceData data, | 335 RecycleResourceData data, |
| 334 uint32 sync_point, | 336 uint32 sync_point, |
| 335 bool lost_resource) { | 337 bool lost_resource) { |
| 336 if (!updater.get()) { | 338 if (!updater.get()) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 358 } | 360 } |
| 359 | 361 |
| 360 PlaneResource recycled_resource(data.resource_id, | 362 PlaneResource recycled_resource(data.resource_id, |
| 361 data.resource_size, | 363 data.resource_size, |
| 362 data.resource_format, | 364 data.resource_format, |
| 363 data.mailbox); | 365 data.mailbox); |
| 364 updater->recycled_resources_.push_back(recycled_resource); | 366 updater->recycled_resources_.push_back(recycled_resource); |
| 365 } | 367 } |
| 366 | 368 |
| 367 } // namespace cc | 369 } // namespace cc |
| OLD | NEW |