| 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 "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/output/gl_renderer.h" | 9 #include "cc/output/gl_renderer.h" |
| 10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; | 300 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; |
| 301 return external_resources; | 301 return external_resources; |
| 302 } | 302 } |
| 303 | 303 |
| 304 // static | 304 // static |
| 305 void VideoResourceUpdater::ReturnTexture( | 305 void VideoResourceUpdater::ReturnTexture( |
| 306 base::WeakPtr<VideoResourceUpdater> updater, | 306 base::WeakPtr<VideoResourceUpdater> updater, |
| 307 const scoped_refptr<media::VideoFrame>& video_frame, | 307 const scoped_refptr<media::VideoFrame>& video_frame, |
| 308 uint32 sync_point, | 308 uint32 sync_point, |
| 309 bool lost_resource) { | 309 bool lost_resource, |
| 310 BlockingTaskRunner* main_thread_task_runner) { |
| 310 // TODO(dshwang) this case should be forwarded to the decoder as lost | 311 // TODO(dshwang) this case should be forwarded to the decoder as lost |
| 311 // resource. | 312 // resource. |
| 312 if (lost_resource || !updater.get()) | 313 if (lost_resource || !updater.get()) |
| 313 return; | 314 return; |
| 314 // VideoFrame::UpdateReleaseSyncPoint() creates new sync point using the same | 315 // VideoFrame::UpdateReleaseSyncPoint() creates new sync point using the same |
| 315 // GL context which created the given |sync_point|, so discard the | 316 // GL context which created the given |sync_point|, so discard the |
| 316 // |sync_point|. | 317 // |sync_point|. |
| 317 SyncPointClientImpl client(updater->context_provider_->ContextGL()); | 318 SyncPointClientImpl client(updater->context_provider_->ContextGL()); |
| 318 video_frame->UpdateReleaseSyncPoint(&client); | 319 video_frame->UpdateReleaseSyncPoint(&client); |
| 319 } | 320 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 external_resources.release_callbacks.push_back( | 356 external_resources.release_callbacks.push_back( |
| 356 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); | 357 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); |
| 357 return external_resources; | 358 return external_resources; |
| 358 } | 359 } |
| 359 | 360 |
| 360 // static | 361 // static |
| 361 void VideoResourceUpdater::RecycleResource( | 362 void VideoResourceUpdater::RecycleResource( |
| 362 base::WeakPtr<VideoResourceUpdater> updater, | 363 base::WeakPtr<VideoResourceUpdater> updater, |
| 363 RecycleResourceData data, | 364 RecycleResourceData data, |
| 364 uint32 sync_point, | 365 uint32 sync_point, |
| 365 bool lost_resource) { | 366 bool lost_resource, |
| 367 BlockingTaskRunner* main_thread_task_runner) { |
| 366 if (!updater.get()) { | 368 if (!updater.get()) { |
| 367 // Resource was already deleted. | 369 // Resource was already deleted. |
| 368 return; | 370 return; |
| 369 } | 371 } |
| 370 | 372 |
| 371 ContextProvider* context_provider = updater->context_provider_; | 373 ContextProvider* context_provider = updater->context_provider_; |
| 372 if (context_provider && sync_point) { | 374 if (context_provider && sync_point) { |
| 373 GLC(context_provider->ContextGL(), | 375 GLC(context_provider->ContextGL(), |
| 374 context_provider->ContextGL()->WaitSyncPointCHROMIUM(sync_point)); | 376 context_provider->ContextGL()->WaitSyncPointCHROMIUM(sync_point)); |
| 375 } | 377 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 388 } | 390 } |
| 389 | 391 |
| 390 PlaneResource recycled_resource(data.resource_id, | 392 PlaneResource recycled_resource(data.resource_id, |
| 391 data.resource_size, | 393 data.resource_size, |
| 392 data.resource_format, | 394 data.resource_format, |
| 393 data.mailbox); | 395 data.mailbox); |
| 394 updater->recycled_resources_.push_back(recycled_resource); | 396 updater->recycled_resources_.push_back(recycled_resource); |
| 395 } | 397 } |
| 396 | 398 |
| 397 } // namespace cc | 399 } // namespace cc |
| OLD | NEW |