| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 | 492 |
| 493 bool RenderWidgetHostViewAndroid::HasFocus() const { | 493 bool RenderWidgetHostViewAndroid::HasFocus() const { |
| 494 if (!content_view_core_) | 494 if (!content_view_core_) |
| 495 return false; // ContentViewCore not created yet. | 495 return false; // ContentViewCore not created yet. |
| 496 | 496 |
| 497 return content_view_core_->HasFocus(); | 497 return content_view_core_->HasFocus(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { | 500 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { |
| 501 return !using_browser_compositor_ || | 501 return !using_browser_compositor_ || HasValidFrame(); |
| 502 (HasValidFrame() && surface_factory_.get()); | |
| 503 } | 502 } |
| 504 | 503 |
| 505 void RenderWidgetHostViewAndroid::Show() { | 504 void RenderWidgetHostViewAndroid::Show() { |
| 506 if (is_showing_) | 505 if (is_showing_) |
| 507 return; | 506 return; |
| 508 | 507 |
| 509 is_showing_ = true; | 508 is_showing_ = true; |
| 510 ShowInternal(); | 509 ShowInternal(); |
| 511 } | 510 } |
| 512 | 511 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 compositor->AttachLayerForReadback(layer); | 902 compositor->AttachLayerForReadback(layer); |
| 904 | 903 |
| 905 std::unique_ptr<cc::CopyOutputRequest> request = | 904 std::unique_ptr<cc::CopyOutputRequest> request = |
| 906 cc::CopyOutputRequest::CreateRequest( | 905 cc::CopyOutputRequest::CreateRequest( |
| 907 base::Bind(&PrepareTextureCopyOutputResult, | 906 base::Bind(&PrepareTextureCopyOutputResult, |
| 908 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, | 907 weak_ptr_factory_.GetWeakPtr(), layer, dst_size_in_pixel, |
| 909 preferred_color_type, start_time, callback)); | 908 preferred_color_type, start_time, callback)); |
| 910 | 909 |
| 911 if (!src_subrect_in_pixel.IsEmpty()) | 910 if (!src_subrect_in_pixel.IsEmpty()) |
| 912 request->set_area(src_subrect_in_pixel); | 911 request->set_area(src_subrect_in_pixel); |
| 913 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); | 912 layer->RequestCopyOfOutput(std::move(request)); |
| 914 } | 913 } |
| 915 | 914 |
| 916 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( | 915 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( |
| 917 const gfx::Rect& src_subrect, | 916 const gfx::Rect& src_subrect, |
| 918 const scoped_refptr<media::VideoFrame>& target, | 917 const scoped_refptr<media::VideoFrame>& target, |
| 919 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 918 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 920 NOTIMPLEMENTED(); | 919 NOTIMPLEMENTED(); |
| 921 callback.Run(gfx::Rect(), false); | 920 callback.Run(gfx::Rect(), false); |
| 922 } | 921 } |
| 923 | 922 |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 case ui::MotionEvent::ACTION_UP: | 2022 case ui::MotionEvent::ACTION_UP: |
| 2024 case ui::MotionEvent::ACTION_POINTER_UP: | 2023 case ui::MotionEvent::ACTION_POINTER_UP: |
| 2025 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2024 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 2026 delta.InMicroseconds(), 1, 1000000, 50); | 2025 delta.InMicroseconds(), 1, 1000000, 50); |
| 2027 default: | 2026 default: |
| 2028 return; | 2027 return; |
| 2029 } | 2028 } |
| 2030 } | 2029 } |
| 2031 | 2030 |
| 2032 } // namespace content | 2031 } // namespace content |
| OLD | NEW |