| 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 compositor->AttachLayerForReadback(layer); | 903 compositor->AttachLayerForReadback(layer); |
| 904 | 904 |
| 905 std::unique_ptr<cc::CopyOutputRequest> request = | 905 std::unique_ptr<cc::CopyOutputRequest> request = |
| 906 cc::CopyOutputRequest::CreateRequest( | 906 cc::CopyOutputRequest::CreateRequest( |
| 907 base::Bind(&PrepareTextureCopyOutputResult, | 907 base::Bind(&PrepareTextureCopyOutputResult, |
| 908 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, | 908 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, |
| 909 preferred_color_type, start_time, callback)); | 909 preferred_color_type, start_time, callback)); |
| 910 | 910 |
| 911 if (!src_subrect_in_pixel.IsEmpty()) | 911 if (!src_subrect_in_pixel.IsEmpty()) |
| 912 request->set_area(src_subrect_in_pixel); | 912 request->set_area(src_subrect_in_pixel); |
| 913 // Make sure the current frame doesn't get deleted until we fulfill the | |
| 914 // request. | |
| 915 LockCompositingSurface(); | |
| 916 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); | 913 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); |
| 917 } | 914 } |
| 918 | 915 |
| 919 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( | 916 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( |
| 920 const gfx::Rect& src_subrect, | 917 const gfx::Rect& src_subrect, |
| 921 const scoped_refptr<media::VideoFrame>& target, | 918 const scoped_refptr<media::VideoFrame>& target, |
| 922 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 919 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 923 NOTIMPLEMENTED(); | 920 NOTIMPLEMENTED(); |
| 924 callback.Run(gfx::Rect(), false); | 921 callback.Run(gfx::Rect(), false); |
| 925 } | 922 } |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 const gfx::Size& dst_size_in_pixel, | 1909 const gfx::Size& dst_size_in_pixel, |
| 1913 SkColorType color_type, | 1910 SkColorType color_type, |
| 1914 const base::TimeTicks& start_time, | 1911 const base::TimeTicks& start_time, |
| 1915 const ReadbackRequestCallback& callback, | 1912 const ReadbackRequestCallback& callback, |
| 1916 std::unique_ptr<cc::CopyOutputResult> result) { | 1913 std::unique_ptr<cc::CopyOutputResult> result) { |
| 1917 base::ScopedClosureRunner scoped_callback_runner( | 1914 base::ScopedClosureRunner scoped_callback_runner( |
| 1918 base::Bind(callback, SkBitmap(), READBACK_FAILED)); | 1915 base::Bind(callback, SkBitmap(), READBACK_FAILED)); |
| 1919 TRACE_EVENT0("cc", | 1916 TRACE_EVENT0("cc", |
| 1920 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); | 1917 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); |
| 1921 readback_layer->RemoveFromParent(); | 1918 readback_layer->RemoveFromParent(); |
| 1922 if (rwhva) | |
| 1923 rwhva->UnlockCompositingSurface(); | |
| 1924 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) | 1919 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) |
| 1925 return; | 1920 return; |
| 1926 cc::TextureMailbox texture_mailbox; | 1921 cc::TextureMailbox texture_mailbox; |
| 1927 std::unique_ptr<cc::SingleReleaseCallback> release_callback; | 1922 std::unique_ptr<cc::SingleReleaseCallback> release_callback; |
| 1928 result->TakeTexture(&texture_mailbox, &release_callback); | 1923 result->TakeTexture(&texture_mailbox, &release_callback); |
| 1929 DCHECK(texture_mailbox.IsTexture()); | 1924 DCHECK(texture_mailbox.IsTexture()); |
| 1930 if (!texture_mailbox.IsTexture()) | 1925 if (!texture_mailbox.IsTexture()) |
| 1931 return; | 1926 return; |
| 1932 display_compositor::GLHelper* gl_helper = GetPostReadbackGLHelper(); | 1927 display_compositor::GLHelper* gl_helper = GetPostReadbackGLHelper(); |
| 1933 if (!gl_helper) | 1928 if (!gl_helper) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 case ui::MotionEvent::ACTION_UP: | 2023 case ui::MotionEvent::ACTION_UP: |
| 2029 case ui::MotionEvent::ACTION_POINTER_UP: | 2024 case ui::MotionEvent::ACTION_POINTER_UP: |
| 2030 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2025 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 2031 delta.InMicroseconds(), 1, 1000000, 50); | 2026 delta.InMicroseconds(), 1, 1000000, 50); |
| 2032 default: | 2027 default: |
| 2033 return; | 2028 return; |
| 2034 } | 2029 } |
| 2035 } | 2030 } |
| 2036 | 2031 |
| 2037 } // namespace content | 2032 } // namespace content |
| OLD | NEW |