OLD | NEW |
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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 compositor->AttachLayerForReadback(layer); | 900 compositor->AttachLayerForReadback(layer); |
901 | 901 |
902 std::unique_ptr<cc::CopyOutputRequest> request = | 902 std::unique_ptr<cc::CopyOutputRequest> request = |
903 cc::CopyOutputRequest::CreateRequest( | 903 cc::CopyOutputRequest::CreateRequest( |
904 base::Bind(&PrepareTextureCopyOutputResult, | 904 base::Bind(&PrepareTextureCopyOutputResult, |
905 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, | 905 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, |
906 preferred_color_type, start_time, callback)); | 906 preferred_color_type, start_time, callback)); |
907 | 907 |
908 if (!src_subrect_in_pixel.IsEmpty()) | 908 if (!src_subrect_in_pixel.IsEmpty()) |
909 request->set_area(src_subrect_in_pixel); | 909 request->set_area(src_subrect_in_pixel); |
910 // Make sure the current frame doesn't get deleted until we fulfill the | |
911 // request. | |
912 LockCompositingSurface(); | |
913 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); | 910 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); |
914 } | 911 } |
915 | 912 |
916 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( | 913 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( |
917 const gfx::Rect& src_subrect, | 914 const gfx::Rect& src_subrect, |
918 const scoped_refptr<media::VideoFrame>& target, | 915 const scoped_refptr<media::VideoFrame>& target, |
919 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 916 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
920 NOTIMPLEMENTED(); | 917 NOTIMPLEMENTED(); |
921 callback.Run(gfx::Rect(), false); | 918 callback.Run(gfx::Rect(), false); |
922 } | 919 } |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 const gfx::Size& dst_size_in_pixel, | 1883 const gfx::Size& dst_size_in_pixel, |
1887 SkColorType color_type, | 1884 SkColorType color_type, |
1888 const base::TimeTicks& start_time, | 1885 const base::TimeTicks& start_time, |
1889 const ReadbackRequestCallback& callback, | 1886 const ReadbackRequestCallback& callback, |
1890 std::unique_ptr<cc::CopyOutputResult> result) { | 1887 std::unique_ptr<cc::CopyOutputResult> result) { |
1891 base::ScopedClosureRunner scoped_callback_runner( | 1888 base::ScopedClosureRunner scoped_callback_runner( |
1892 base::Bind(callback, SkBitmap(), READBACK_FAILED)); | 1889 base::Bind(callback, SkBitmap(), READBACK_FAILED)); |
1893 TRACE_EVENT0("cc", | 1890 TRACE_EVENT0("cc", |
1894 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); | 1891 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); |
1895 readback_layer->RemoveFromParent(); | 1892 readback_layer->RemoveFromParent(); |
1896 if (rwhva) | |
1897 rwhva->UnlockCompositingSurface(); | |
1898 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) | 1893 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) |
1899 return; | 1894 return; |
1900 cc::TextureMailbox texture_mailbox; | 1895 cc::TextureMailbox texture_mailbox; |
1901 std::unique_ptr<cc::SingleReleaseCallback> release_callback; | 1896 std::unique_ptr<cc::SingleReleaseCallback> release_callback; |
1902 result->TakeTexture(&texture_mailbox, &release_callback); | 1897 result->TakeTexture(&texture_mailbox, &release_callback); |
1903 DCHECK(texture_mailbox.IsTexture()); | 1898 DCHECK(texture_mailbox.IsTexture()); |
1904 if (!texture_mailbox.IsTexture()) | 1899 if (!texture_mailbox.IsTexture()) |
1905 return; | 1900 return; |
1906 display_compositor::GLHelper* gl_helper = GetPostReadbackGLHelper(); | 1901 display_compositor::GLHelper* gl_helper = GetPostReadbackGLHelper(); |
1907 if (!gl_helper) | 1902 if (!gl_helper) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 case ui::MotionEvent::ACTION_UP: | 1997 case ui::MotionEvent::ACTION_UP: |
2003 case ui::MotionEvent::ACTION_POINTER_UP: | 1998 case ui::MotionEvent::ACTION_POINTER_UP: |
2004 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1999 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
2005 delta.InMicroseconds(), 1, 1000000, 50); | 2000 delta.InMicroseconds(), 1, 1000000, 50); |
2006 default: | 2001 default: |
2007 return; | 2002 return; |
2008 } | 2003 } |
2009 } | 2004 } |
2010 | 2005 |
2011 } // namespace content | 2006 } // namespace content |
OLD | NEW |