Chromium Code Reviews| 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 } | 596 } |
| 597 | 597 |
| 598 void RenderWidgetHostViewChildFrame::StopSpeaking() {} | 598 void RenderWidgetHostViewChildFrame::StopSpeaking() {} |
| 599 #endif // defined(OS_MACOSX) | 599 #endif // defined(OS_MACOSX) |
| 600 | 600 |
| 601 void RenderWidgetHostViewChildFrame::RegisterFrameSwappedCallback( | 601 void RenderWidgetHostViewChildFrame::RegisterFrameSwappedCallback( |
| 602 std::unique_ptr<base::Closure> callback) { | 602 std::unique_ptr<base::Closure> callback) { |
| 603 frame_swapped_callbacks_.push_back(std::move(callback)); | 603 frame_swapped_callbacks_.push_back(std::move(callback)); |
| 604 } | 604 } |
| 605 | 605 |
| 606 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( | 606 void RenderWidgetHostViewChildFrame::CopyFromSurface( |
| 607 const gfx::Rect& src_subrect, | 607 const gfx::Rect& src_subrect, |
|
alexmos
2017/02/28 19:44:09
nit: the header has this as src_rect, make them th
miu
2017/03/01 01:17:02
Done.
| |
| 608 const gfx::Size& output_size, | 608 const gfx::Size& output_size, |
| 609 const ReadbackRequestCallback& callback, | 609 const ReadbackRequestCallback& callback, |
| 610 const SkColorType preferred_color_type) { | 610 const SkColorType preferred_color_type) { |
| 611 if (!IsSurfaceAvailableForCopy()) { | 611 if (!IsSurfaceAvailableForCopy()) { |
| 612 // Defer submitting the copy request until after a frame is drawn, at which | 612 // Defer submitting the copy request until after a frame is drawn, at which |
| 613 // point we should be guaranteed that the surface is available. | 613 // point we should be guaranteed that the surface is available. |
| 614 RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(base::Bind( | 614 RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(base::Bind( |
| 615 &RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest, AsWeakPtr(), | 615 &RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest, AsWeakPtr(), |
| 616 src_subrect, output_size, callback, preferred_color_type))); | 616 src_subrect, output_size, callback, preferred_color_type))); |
| 617 return; | 617 return; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 631 std::unique_ptr<cc::CopyOutputRequest> request = | 631 std::unique_ptr<cc::CopyOutputRequest> request = |
| 632 cc::CopyOutputRequest::CreateRequest( | 632 cc::CopyOutputRequest::CreateRequest( |
| 633 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, | 633 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, |
| 634 preferred_color_type, callback)); | 634 preferred_color_type, callback)); |
| 635 if (!src_subrect.IsEmpty()) | 635 if (!src_subrect.IsEmpty()) |
| 636 request->set_area(src_subrect); | 636 request->set_area(src_subrect); |
| 637 | 637 |
| 638 surface_factory_->RequestCopyOfSurface(std::move(request)); | 638 surface_factory_->RequestCopyOfSurface(std::move(request)); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( | |
| 642 const gfx::Rect& src_subrect, | |
| 643 const scoped_refptr<media::VideoFrame>& target, | |
| 644 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | |
| 645 NOTIMPLEMENTED(); | |
| 646 callback.Run(gfx::Rect(), false); | |
| 647 } | |
| 648 | |
| 649 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { | |
| 650 return false; | |
| 651 } | |
| 652 | |
| 653 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( | 641 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( |
| 654 const gfx::Size& desired_size) { | 642 const gfx::Size& desired_size) { |
| 655 return false; | 643 return false; |
| 656 } | 644 } |
| 657 | 645 |
| 658 // cc::SurfaceFactoryClient implementation. | 646 // cc::SurfaceFactoryClient implementation. |
| 659 void RenderWidgetHostViewChildFrame::ReturnResources( | 647 void RenderWidgetHostViewChildFrame::ReturnResources( |
| 660 const cc::ReturnedResourceArray& resources) { | 648 const cc::ReturnedResourceArray& resources) { |
| 661 if (resources.empty()) | 649 if (resources.empty()) |
| 662 return; | 650 return; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 | 736 |
| 749 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 737 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 750 return true; | 738 return true; |
| 751 } | 739 } |
| 752 | 740 |
| 753 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 741 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 754 return cc::SurfaceId(frame_sink_id_, local_surface_id_); | 742 return cc::SurfaceId(frame_sink_id_, local_surface_id_); |
| 755 }; | 743 }; |
| 756 | 744 |
| 757 } // namespace content | 745 } // namespace content |
| OLD | NEW |