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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.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 (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 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 825
826 void RenderWidgetHostImpl::ViewDestroyed() { 826 void RenderWidgetHostImpl::ViewDestroyed() {
827 RejectMouseLockOrUnlockIfNecessary(); 827 RejectMouseLockOrUnlockIfNecessary();
828 828
829 // TODO(evanm): tracking this may no longer be necessary; 829 // TODO(evanm): tracking this may no longer be necessary;
830 // eliminate this function if so. 830 // eliminate this function if so.
831 SetView(NULL); 831 SetView(NULL);
832 } 832 }
833 833
834 void RenderWidgetHostImpl::CopyFromBackingStore(
835 const gfx::Rect& src_subrect,
836 const gfx::Size& accelerated_dst_size,
837 const ReadbackRequestCallback& callback,
838 const SkColorType preferred_color_type) {
839 if (view_) {
840 TRACE_EVENT0("browser",
841 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface");
842 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ?
843 gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
844 view_->CopyFromCompositingSurface(accelerated_copy_rect,
845 accelerated_dst_size, callback,
846 preferred_color_type);
847 return;
848 }
849
850 callback.Run(SkBitmap(), content::READBACK_FAILED);
851 }
852
853 bool RenderWidgetHostImpl::CanCopyFromBackingStore() {
854 if (view_)
855 return view_->IsSurfaceAvailableForCopy();
856 return false;
857 }
858
859 #if defined(OS_MACOSX) 834 #if defined(OS_MACOSX)
860 void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() { 835 void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() {
861 TRACE_EVENT0("browser", 836 TRACE_EVENT0("browser",
862 "RenderWidgetHostImpl::PauseForPendingResizeOrRepaints"); 837 "RenderWidgetHostImpl::PauseForPendingResizeOrRepaints");
863 838
864 if (!CanPauseForPendingResizeOrRepaints()) 839 if (!CanPauseForPendingResizeOrRepaints())
865 return; 840 return;
866 841
867 WaitForSurface(); 842 WaitForSurface();
868 } 843 }
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 // different from the receiver's. 2505 // different from the receiver's.
2531 file_system_file.url = 2506 file_system_file.url =
2532 GURL(storage::GetIsolatedFileSystemRootURIString( 2507 GURL(storage::GetIsolatedFileSystemRootURIString(
2533 file_system_url.origin(), filesystem_id, std::string()) 2508 file_system_url.origin(), filesystem_id, std::string())
2534 .append(register_name)); 2509 .append(register_name));
2535 file_system_file.filesystem_id = filesystem_id; 2510 file_system_file.filesystem_id = filesystem_id;
2536 } 2511 }
2537 } 2512 }
2538 2513
2539 } // namespace content 2514 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698