Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2702093002: Consistent CopyFromSurface() API, consolidated to RWHV (Closed)
Patch Set: REBASE Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 574 }
575 575
576 void RenderWidgetHostViewChildFrame::StopSpeaking() {} 576 void RenderWidgetHostViewChildFrame::StopSpeaking() {}
577 #endif // defined(OS_MACOSX) 577 #endif // defined(OS_MACOSX)
578 578
579 void RenderWidgetHostViewChildFrame::RegisterFrameSwappedCallback( 579 void RenderWidgetHostViewChildFrame::RegisterFrameSwappedCallback(
580 std::unique_ptr<base::Closure> callback) { 580 std::unique_ptr<base::Closure> callback) {
581 frame_swapped_callbacks_.push_back(std::move(callback)); 581 frame_swapped_callbacks_.push_back(std::move(callback));
582 } 582 }
583 583
584 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( 584 void RenderWidgetHostViewChildFrame::CopyFromSurface(
585 const gfx::Rect& src_subrect, 585 const gfx::Rect& src_rect,
586 const gfx::Size& output_size, 586 const gfx::Size& output_size,
587 const ReadbackRequestCallback& callback, 587 const ReadbackRequestCallback& callback,
588 const SkColorType preferred_color_type) { 588 const SkColorType preferred_color_type) {
589 if (!IsSurfaceAvailableForCopy()) { 589 if (!IsSurfaceAvailableForCopy()) {
590 // Defer submitting the copy request until after a frame is drawn, at which 590 // Defer submitting the copy request until after a frame is drawn, at which
591 // point we should be guaranteed that the surface is available. 591 // point we should be guaranteed that the surface is available.
592 RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(base::Bind( 592 RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>(base::Bind(
593 &RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest, AsWeakPtr(), 593 &RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest, AsWeakPtr(),
594 src_subrect, output_size, callback, preferred_color_type))); 594 src_rect, output_size, callback, preferred_color_type)));
595 return; 595 return;
596 } 596 }
597 597
598 SubmitSurfaceCopyRequest(src_subrect, output_size, callback, 598 SubmitSurfaceCopyRequest(src_rect, output_size, callback,
599 preferred_color_type); 599 preferred_color_type);
600 } 600 }
601 601
602 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest( 602 void RenderWidgetHostViewChildFrame::SubmitSurfaceCopyRequest(
603 const gfx::Rect& src_subrect, 603 const gfx::Rect& src_subrect,
604 const gfx::Size& output_size, 604 const gfx::Size& output_size,
605 const ReadbackRequestCallback& callback, 605 const ReadbackRequestCallback& callback,
606 const SkColorType preferred_color_type) { 606 const SkColorType preferred_color_type) {
607 DCHECK(IsSurfaceAvailableForCopy()); 607 DCHECK(IsSurfaceAvailableForCopy());
608 DCHECK(support_); 608 DCHECK(support_);
609 609
610 std::unique_ptr<cc::CopyOutputRequest> request = 610 std::unique_ptr<cc::CopyOutputRequest> request =
611 cc::CopyOutputRequest::CreateRequest( 611 cc::CopyOutputRequest::CreateRequest(
612 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, 612 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size,
613 preferred_color_type, callback)); 613 preferred_color_type, callback));
614 if (!src_subrect.IsEmpty()) 614 if (!src_subrect.IsEmpty())
615 request->set_area(src_subrect); 615 request->set_area(src_subrect);
616 616
617 support_->RequestCopyOfSurface(std::move(request)); 617 support_->RequestCopyOfSurface(std::move(request));
618 } 618 }
619 619
620 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
621 const gfx::Rect& src_subrect,
622 const scoped_refptr<media::VideoFrame>& target,
623 const base::Callback<void(const gfx::Rect&, bool)>& callback) {
624 NOTIMPLEMENTED();
625 callback.Run(gfx::Rect(), false);
626 }
627
628 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
629 return false;
630 }
631
632 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( 620 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
633 const gfx::Size& desired_size) { 621 const gfx::Size& desired_size) {
634 return false; 622 return false;
635 } 623 }
636 624
637 void RenderWidgetHostViewChildFrame::ReclaimResources( 625 void RenderWidgetHostViewChildFrame::ReclaimResources(
638 const cc::ReturnedResourceArray& resources) { 626 const cc::ReturnedResourceArray& resources) {
639 if (!host_) 627 if (!host_)
640 return; 628 return;
641 host_->Send(new ViewMsg_ReclaimCompositorResources( 629 host_->Send(new ViewMsg_ReclaimCompositorResources(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 if (!support_) 706 if (!support_)
719 return; 707 return;
720 if (parent_frame_sink_id_.is_valid()) { 708 if (parent_frame_sink_id_.is_valid()) {
721 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_, 709 GetSurfaceManager()->UnregisterFrameSinkHierarchy(parent_frame_sink_id_,
722 frame_sink_id_); 710 frame_sink_id_);
723 } 711 }
724 support_.reset(); 712 support_.reset();
725 } 713 }
726 714
727 } // namespace content 715 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698