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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary headers. Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 RejectMouseLockOrUnlockIfNecessary(); 663 RejectMouseLockOrUnlockIfNecessary();
664 664
665 // TODO(evanm): tracking this may no longer be necessary; 665 // TODO(evanm): tracking this may no longer be necessary;
666 // eliminate this function if so. 666 // eliminate this function if so.
667 SetView(NULL); 667 SetView(NULL);
668 } 668 }
669 669
670 void RenderWidgetHostImpl::CopyFromBackingStore( 670 void RenderWidgetHostImpl::CopyFromBackingStore(
671 const gfx::Rect& src_subrect, 671 const gfx::Rect& src_subrect,
672 const gfx::Size& accelerated_dst_size, 672 const gfx::Size& accelerated_dst_size,
673 const base::Callback<void(bool, const SkBitmap&)>& callback, 673 CopyFromCompositingSurfaceCallback& callback,
674 const SkColorType color_type) { 674 const SkColorType color_type) {
675 if (view_) { 675 if (view_) {
676 TRACE_EVENT0("browser", 676 TRACE_EVENT0("browser",
677 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); 677 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface");
678 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ? 678 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ?
679 gfx::Rect(view_->GetViewBounds().size()) : src_subrect; 679 gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
680 view_->CopyFromCompositingSurface( 680 view_->CopyFromCompositingSurface(
681 accelerated_copy_rect, accelerated_dst_size, callback, color_type); 681 accelerated_copy_rect, accelerated_dst_size, callback, color_type);
682 return; 682 return;
683 } 683 }
684 684
685 callback.Run(false, SkBitmap()); 685 callback.Run(false, SkBitmap(), content::READBACK_FAILED);
686 } 686 }
687 687
688 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { 688 bool RenderWidgetHostImpl::CanCopyFromBackingStore() {
689 if (view_) 689 if (view_)
690 return view_->IsSurfaceAvailableForCopy(); 690 return view_->IsSurfaceAvailableForCopy();
691 return false; 691 return false;
692 } 692 }
693 693
694 #if defined(OS_ANDROID) 694 #if defined(OS_ANDROID)
695 void RenderWidgetHostImpl::LockBackingStore() { 695 void RenderWidgetHostImpl::LockBackingStore() {
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 } 2371 }
2372 #endif 2372 #endif
2373 2373
2374 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2374 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2375 if (view_) 2375 if (view_)
2376 return view_->PreferredReadbackFormat(); 2376 return view_->PreferredReadbackFormat();
2377 return kN32_SkColorType; 2377 return kN32_SkColorType;
2378 } 2378 }
2379 2379
2380 } // namespace content 2380 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698