| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/renderer_host/delegated_frame_host.h" | 5 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return; | 577 return; |
| 578 | 578 |
| 579 subscriber_texture->UpdateSyncToken(sync_token); | 579 subscriber_texture->UpdateSyncToken(sync_token); |
| 580 | 580 |
| 581 if (dfh->frame_subscriber_ && subscriber_texture->texture_id()) | 581 if (dfh->frame_subscriber_ && subscriber_texture->texture_id()) |
| 582 dfh->idle_frame_subscriber_textures_.push_back(subscriber_texture); | 582 dfh->idle_frame_subscriber_textures_.push_back(subscriber_texture); |
| 583 } | 583 } |
| 584 | 584 |
| 585 // static | 585 // static |
| 586 void DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo( | 586 void DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo( |
| 587 scoped_refptr<media::VideoFrame> video_frame, |
| 587 base::WeakPtr<DelegatedFrameHost> dfh, | 588 base::WeakPtr<DelegatedFrameHost> dfh, |
| 588 const base::Callback<void(bool)>& callback, | 589 const base::Callback<void(bool)>& callback, |
| 589 scoped_refptr<OwnedMailbox> subscriber_texture, | 590 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 590 std::unique_ptr<cc::SingleReleaseCallback> release_callback, | 591 std::unique_ptr<cc::SingleReleaseCallback> release_callback, |
| 591 bool result) { | 592 bool result) { |
| 592 callback.Run(result); | 593 callback.Run(result); |
| 593 | 594 |
| 594 gpu::SyncToken sync_token; | 595 gpu::SyncToken sync_token; |
| 595 if (result) { | 596 if (result) { |
| 596 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 597 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 quality, result_rect.size(), result_rect, region_in_frame.size(), true, | 705 quality, result_rect.size(), result_rect, region_in_frame.size(), true, |
| 705 true)); | 706 true)); |
| 706 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); | 707 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); |
| 707 } | 708 } |
| 708 | 709 |
| 709 ignore_result(scoped_callback_runner.Release()); | 710 ignore_result(scoped_callback_runner.Release()); |
| 710 ignore_result(scoped_return_subscriber_texture.Release()); | 711 ignore_result(scoped_return_subscriber_texture.Release()); |
| 711 | 712 |
| 712 base::Callback<void(bool result)> finished_callback = base::Bind( | 713 base::Callback<void(bool result)> finished_callback = base::Bind( |
| 713 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, | 714 &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, |
| 714 dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), | 715 video_frame, dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), |
| 715 subscriber_texture, base::Passed(&release_callback)); | 716 subscriber_texture, base::Passed(&release_callback)); |
| 716 yuv_readback_pipeline->ReadbackYUV( | 717 yuv_readback_pipeline->ReadbackYUV( |
| 717 texture_mailbox.mailbox(), texture_mailbox.sync_token(), | 718 texture_mailbox.mailbox(), texture_mailbox.sync_token(), |
| 718 video_frame.get(), region_in_frame.origin(), finished_callback); | 719 video_frame->visible_rect(), |
| 720 video_frame->stride(media::VideoFrame::kYPlane), |
| 721 video_frame->data(media::VideoFrame::kYPlane), |
| 722 video_frame->stride(media::VideoFrame::kUPlane), |
| 723 video_frame->data(media::VideoFrame::kUPlane), |
| 724 video_frame->stride(media::VideoFrame::kVPlane), |
| 725 video_frame->data(media::VideoFrame::kVPlane), region_in_frame.origin(), |
| 726 finished_callback); |
| 727 media::LetterboxYUV(video_frame.get(), region_in_frame); |
| 719 } | 728 } |
| 720 | 729 |
| 721 //////////////////////////////////////////////////////////////////////////////// | 730 //////////////////////////////////////////////////////////////////////////////// |
| 722 // DelegatedFrameHost, ui::CompositorObserver implementation: | 731 // DelegatedFrameHost, ui::CompositorObserver implementation: |
| 723 | 732 |
| 724 void DelegatedFrameHost::OnCompositingDidCommit(ui::Compositor* compositor) { | 733 void DelegatedFrameHost::OnCompositingDidCommit(ui::Compositor* compositor) { |
| 725 if (can_lock_compositor_ == NO_PENDING_COMMIT) { | 734 if (can_lock_compositor_ == NO_PENDING_COMMIT) { |
| 726 can_lock_compositor_ = YES_CAN_LOCK; | 735 can_lock_compositor_ = YES_CAN_LOCK; |
| 727 if (resize_lock_.get() && resize_lock_->GrabDeferredLock()) | 736 if (resize_lock_.get() && resize_lock_->GrabDeferredLock()) |
| 728 can_lock_compositor_ = YES_DID_LOCK; | 737 can_lock_compositor_ = YES_DID_LOCK; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 883 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 875 new_layer->SetShowSurface( | 884 new_layer->SetShowSurface( |
| 876 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 885 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 877 base::Bind(&RequireCallback, base::Unretained(manager)), | 886 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 878 current_surface_size_, current_scale_factor_, | 887 current_surface_size_, current_scale_factor_, |
| 879 current_frame_size_in_dip_); | 888 current_frame_size_in_dip_); |
| 880 } | 889 } |
| 881 } | 890 } |
| 882 | 891 |
| 883 } // namespace content | 892 } // namespace content |
| OLD | NEW |