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

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: Formatted code and fixed build issue in test. Created 6 years, 1 month 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 RejectMouseLockOrUnlockIfNecessary(); 686 RejectMouseLockOrUnlockIfNecessary();
687 687
688 // TODO(evanm): tracking this may no longer be necessary; 688 // TODO(evanm): tracking this may no longer be necessary;
689 // eliminate this function if so. 689 // eliminate this function if so.
690 SetView(NULL); 690 SetView(NULL);
691 } 691 }
692 692
693 void RenderWidgetHostImpl::CopyFromBackingStore( 693 void RenderWidgetHostImpl::CopyFromBackingStore(
694 const gfx::Rect& src_subrect, 694 const gfx::Rect& src_subrect,
695 const gfx::Size& accelerated_dst_size, 695 const gfx::Size& accelerated_dst_size,
696 const base::Callback<void(bool, const SkBitmap&)>& callback, 696 ReadbackRequestCallback& callback,
697 const SkColorType color_type) { 697 const SkColorType color_type) {
698 if (view_) { 698 if (view_) {
699 TRACE_EVENT0("browser", 699 TRACE_EVENT0("browser",
700 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); 700 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface");
701 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ? 701 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ?
702 gfx::Rect(view_->GetViewBounds().size()) : src_subrect; 702 gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
703 view_->CopyFromCompositingSurface( 703 view_->CopyFromCompositingSurface(
704 accelerated_copy_rect, accelerated_dst_size, callback, color_type); 704 accelerated_copy_rect, accelerated_dst_size, callback, color_type);
705 return; 705 return;
706 } 706 }
707 707
708 callback.Run(false, SkBitmap()); 708 callback.Run(SkBitmap(), content::READBACK_FAILED);
709 } 709 }
710 710
711 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { 711 bool RenderWidgetHostImpl::CanCopyFromBackingStore() {
712 if (view_) 712 if (view_)
713 return view_->IsSurfaceAvailableForCopy(); 713 return view_->IsSurfaceAvailableForCopy();
714 return false; 714 return false;
715 } 715 }
716 716
717 #if defined(OS_ANDROID) 717 #if defined(OS_ANDROID)
718 void RenderWidgetHostImpl::LockBackingStore() { 718 void RenderWidgetHostImpl::LockBackingStore() {
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 } 2443 }
2444 #endif 2444 #endif
2445 2445
2446 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2446 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2447 if (view_) 2447 if (view_)
2448 return view_->PreferredReadbackFormat(); 2448 return view_->PreferredReadbackFormat();
2449 return kN32_SkColorType; 2449 return kN32_SkColorType;
2450 } 2450 }
2451 2451
2452 } // namespace content 2452 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698