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

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

Issue 143683003: Support format using enum argument for Async readback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace bool with enum to support other formats Created 6 years, 11 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_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1082
1083 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( 1083 BackingStore* RenderWidgetHostViewAura::AllocBackingStore(
1084 const gfx::Size& size) { 1084 const gfx::Size& size) {
1085 return new BackingStoreAura(host_, size); 1085 return new BackingStoreAura(host_, size);
1086 } 1086 }
1087 1087
1088 void RenderWidgetHostViewAura::CopyFromCompositingSurface( 1088 void RenderWidgetHostViewAura::CopyFromCompositingSurface(
1089 const gfx::Rect& src_subrect, 1089 const gfx::Rect& src_subrect,
1090 const gfx::Size& dst_size, 1090 const gfx::Size& dst_size,
1091 const base::Callback<void(bool, const SkBitmap&)>& callback, 1091 const base::Callback<void(bool, const SkBitmap&)>& callback,
1092 bool readback_config_rgb565) { 1092 const SkBitmap::Config config) {
1093 if (!CanCopyToBitmap()) { 1093 if (!CanCopyToBitmap()) {
1094 callback.Run(false, SkBitmap()); 1094 callback.Run(false, SkBitmap());
1095 return; 1095 return;
1096 } 1096 }
1097 1097
1098 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); 1098 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size);
1099 scoped_ptr<cc::CopyOutputRequest> request = 1099 scoped_ptr<cc::CopyOutputRequest> request =
1100 cc::CopyOutputRequest::CreateRequest(base::Bind( 1100 cc::CopyOutputRequest::CreateRequest(base::Bind(
1101 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, 1101 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult,
1102 dst_size_in_pixel, 1102 dst_size_in_pixel,
1103 readback_config_rgb565, 1103 config,
1104 callback)); 1104 callback));
1105 gfx::Rect src_subrect_in_pixel = 1105 gfx::Rect src_subrect_in_pixel =
1106 ConvertRectToPixel(current_device_scale_factor_, src_subrect); 1106 ConvertRectToPixel(current_device_scale_factor_, src_subrect);
1107 request->set_area(src_subrect_in_pixel); 1107 request->set_area(src_subrect_in_pixel);
1108 RequestCopyOfOutput(request.Pass()); 1108 RequestCopyOfOutput(request.Pass());
1109 } 1109 }
1110 1110
1111 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( 1111 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame(
1112 const gfx::Rect& src_subrect, 1112 const gfx::Rect& src_subrect,
1113 const scoped_refptr<media::VideoFrame>& target, 1113 const scoped_refptr<media::VideoFrame>& target,
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 return false; 1826 return false;
1827 } 1827 }
1828 1828
1829 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor( 1829 void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(
1830 scoped_refptr<ui::Texture>) { 1830 scoped_refptr<ui::Texture>) {
1831 } 1831 }
1832 1832
1833 // static 1833 // static
1834 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( 1834 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult(
1835 const gfx::Size& dst_size_in_pixel, 1835 const gfx::Size& dst_size_in_pixel,
1836 bool readback_config_rgb565, 1836 const SkBitmap::Config config,
1837 const base::Callback<void(bool, const SkBitmap&)>& callback, 1837 const base::Callback<void(bool, const SkBitmap&)>& callback,
1838 scoped_ptr<cc::CopyOutputResult> result) { 1838 scoped_ptr<cc::CopyOutputResult> result) {
1839 if (result->IsEmpty() || result->size().IsEmpty()) { 1839 if (result->IsEmpty() || result->size().IsEmpty()) {
1840 callback.Run(false, SkBitmap()); 1840 callback.Run(false, SkBitmap());
1841 return; 1841 return;
1842 } 1842 }
1843 1843
1844 if (result->HasTexture()) { 1844 if (result->HasTexture()) {
1845 PrepareTextureCopyOutputResult(dst_size_in_pixel, readback_config_rgb565, 1845 PrepareTextureCopyOutputResult(dst_size_in_pixel, config,
1846 callback, 1846 callback,
1847 result.Pass()); 1847 result.Pass());
1848 return; 1848 return;
1849 } 1849 }
1850 1850
1851 DCHECK(result->HasBitmap()); 1851 DCHECK(result->HasBitmap());
1852 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); 1852 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass());
1853 } 1853 }
1854 1854
1855 static void CopyFromCompositingSurfaceFinished( 1855 static void CopyFromCompositingSurfaceFinished(
1856 const base::Callback<void(bool, const SkBitmap&)>& callback, 1856 const base::Callback<void(bool, const SkBitmap&)>& callback,
1857 scoped_ptr<cc::SingleReleaseCallback> release_callback, 1857 scoped_ptr<cc::SingleReleaseCallback> release_callback,
1858 scoped_ptr<SkBitmap> bitmap, 1858 scoped_ptr<SkBitmap> bitmap,
1859 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, 1859 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
1860 bool result) { 1860 bool result) {
1861 bitmap_pixels_lock.reset(); 1861 bitmap_pixels_lock.reset();
1862 release_callback->Run(0, false); 1862 release_callback->Run(0, false);
1863 callback.Run(result, *bitmap); 1863 callback.Run(result, *bitmap);
1864 } 1864 }
1865 1865
1866 // static 1866 // static
1867 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( 1867 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult(
1868 const gfx::Size& dst_size_in_pixel, 1868 const gfx::Size& dst_size_in_pixel,
1869 bool readback_config_rgb565, 1869 const SkBitmap::Config config,
1870 const base::Callback<void(bool, const SkBitmap&)>& callback, 1870 const base::Callback<void(bool, const SkBitmap&)>& callback,
1871 scoped_ptr<cc::CopyOutputResult> result) { 1871 scoped_ptr<cc::CopyOutputResult> result) {
1872 base::ScopedClosureRunner scoped_callback_runner( 1872 base::ScopedClosureRunner scoped_callback_runner(
1873 base::Bind(callback, false, SkBitmap())); 1873 base::Bind(callback, false, SkBitmap()));
1874 1874
1875 DCHECK(result->HasTexture()); 1875 DCHECK(result->HasTexture());
1876 if (!result->HasTexture()) 1876 if (!result->HasTexture())
1877 return; 1877 return;
1878 1878
1879 scoped_ptr<SkBitmap> bitmap(new SkBitmap); 1879 scoped_ptr<SkBitmap> bitmap(new SkBitmap);
(...skipping 21 matching lines...) Expand all
1901 1901
1902 ignore_result(scoped_callback_runner.Release()); 1902 ignore_result(scoped_callback_runner.Release());
1903 1903
1904 gl_helper->CropScaleReadbackAndCleanMailbox( 1904 gl_helper->CropScaleReadbackAndCleanMailbox(
1905 texture_mailbox.name(), 1905 texture_mailbox.name(),
1906 texture_mailbox.sync_point(), 1906 texture_mailbox.sync_point(),
1907 result->size(), 1907 result->size(),
1908 gfx::Rect(result->size()), 1908 gfx::Rect(result->size()),
1909 dst_size_in_pixel, 1909 dst_size_in_pixel,
1910 pixels, 1910 pixels,
1911 readback_config_rgb565, 1911 config,
1912 base::Bind(&CopyFromCompositingSurfaceFinished, 1912 base::Bind(&CopyFromCompositingSurfaceFinished,
1913 callback, 1913 callback,
1914 base::Passed(&release_callback), 1914 base::Passed(&release_callback),
1915 base::Passed(&bitmap), 1915 base::Passed(&bitmap),
1916 base::Passed(&bitmap_pixels_lock))); 1916 base::Passed(&bitmap_pixels_lock)));
1917 } 1917 }
1918 1918
1919 // static 1919 // static
1920 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( 1920 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult(
1921 const gfx::Size& dst_size_in_pixel, 1921 const gfx::Size& dst_size_in_pixel,
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
3558 RenderWidgetHost* widget) { 3558 RenderWidgetHost* widget) {
3559 return new RenderWidgetHostViewAura(widget); 3559 return new RenderWidgetHostViewAura(widget);
3560 } 3560 }
3561 3561
3562 // static 3562 // static
3563 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3563 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3564 GetScreenInfoForWindow(results, NULL); 3564 GetScreenInfoForWindow(results, NULL);
3565 } 3565 }
3566 3566
3567 } // namespace content 3567 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698