Chromium Code Reviews| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 } | 494 } |
| 495 | 495 |
| 496 bool RenderWidgetHostViewAndroid::HasFocus() const { | 496 bool RenderWidgetHostViewAndroid::HasFocus() const { |
| 497 if (!content_view_core_) | 497 if (!content_view_core_) |
| 498 return false; // ContentViewCore not created yet. | 498 return false; // ContentViewCore not created yet. |
| 499 | 499 |
| 500 return content_view_core_->HasFocus(); | 500 return content_view_core_->HasFocus(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { | 503 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { |
| 504 return !using_browser_compositor_ || HasValidFrame(); | 504 return !using_browser_compositor_ || |
| 505 (HasValidFrame() && surface_factory_.get()); | |
| 505 } | 506 } |
| 506 | 507 |
| 507 void RenderWidgetHostViewAndroid::Show() { | 508 void RenderWidgetHostViewAndroid::Show() { |
| 508 if (is_showing_) | 509 if (is_showing_) |
| 509 return; | 510 return; |
| 510 | 511 |
| 511 is_showing_ = true; | 512 is_showing_ = true; |
| 512 ShowInternal(); | 513 ShowInternal(); |
| 513 } | 514 } |
| 514 | 515 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 ui::WindowAndroidCompositor* compositor = | 885 ui::WindowAndroidCompositor* compositor = |
| 885 content_view_core_->GetWindowAndroid()->GetCompositor(); | 886 content_view_core_->GetWindowAndroid()->GetCompositor(); |
| 886 DCHECK(compositor); | 887 DCHECK(compositor); |
| 887 DCHECK(!surface_id_.is_null()); | 888 DCHECK(!surface_id_.is_null()); |
| 888 std::unique_ptr<cc::CopyOutputRequest> request = | 889 std::unique_ptr<cc::CopyOutputRequest> request = |
| 889 cc::CopyOutputRequest::CreateRequest(base::Bind( | 890 cc::CopyOutputRequest::CreateRequest(base::Bind( |
| 890 &PrepareTextureCopyOutputResult, weak_ptr_factory_.GetWeakPtr(), | 891 &PrepareTextureCopyOutputResult, weak_ptr_factory_.GetWeakPtr(), |
| 891 dst_size_in_pixel, preferred_color_type, start_time, callback)); | 892 dst_size_in_pixel, preferred_color_type, start_time, callback)); |
| 892 if (!src_subrect_in_pixel.IsEmpty()) | 893 if (!src_subrect_in_pixel.IsEmpty()) |
| 893 request->set_area(src_subrect_in_pixel); | 894 request->set_area(src_subrect_in_pixel); |
| 894 // Make sure the layer doesn't get deleted until we fulfill the request. | 895 // Make sure the layer doesn't get deleted until we fulfill the request. |
|
danakj
2016/07/26 23:20:12
This comment slightly wrong?
no sievers
2016/07/26 23:21:59
Done.
| |
| 895 LockCompositingSurface(); | 896 LockCompositingSurface(); |
| 896 view_.GetLayer()->RequestCopyOfOutput(std::move(request)); | 897 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); |
| 897 } | 898 } |
| 898 | 899 |
| 899 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( | 900 void RenderWidgetHostViewAndroid::CopyFromCompositingSurfaceToVideoFrame( |
| 900 const gfx::Rect& src_subrect, | 901 const gfx::Rect& src_subrect, |
| 901 const scoped_refptr<media::VideoFrame>& target, | 902 const scoped_refptr<media::VideoFrame>& target, |
| 902 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 903 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 903 NOTIMPLEMENTED(); | 904 NOTIMPLEMENTED(); |
| 904 callback.Run(gfx::Rect(), false); | 905 callback.Run(gfx::Rect(), false); |
| 905 } | 906 } |
| 906 | 907 |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1982 case ui::MotionEvent::ACTION_UP: | 1983 case ui::MotionEvent::ACTION_UP: |
| 1983 case ui::MotionEvent::ACTION_POINTER_UP: | 1984 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1984 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1985 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1985 delta.InMicroseconds(), 1, 1000000, 50); | 1986 delta.InMicroseconds(), 1, 1000000, 50); |
| 1986 default: | 1987 default: |
| 1987 return; | 1988 return; |
| 1988 } | 1989 } |
| 1989 } | 1990 } |
| 1990 | 1991 |
| 1991 } // namespace content | 1992 } // namespace content |
| OLD | NEW |