| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "ui/gfx/screen.h" | 48 #include "ui/gfx/screen.h" |
| 49 #include "ui/gfx/size_conversions.h" | 49 #include "ui/gfx/size_conversions.h" |
| 50 | 50 |
| 51 namespace content { | 51 namespace content { |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 const int kUndefinedOutputSurfaceId = -1; | 55 const int kUndefinedOutputSurfaceId = -1; |
| 56 const int kMinimumPointerDistance = 50; | 56 const int kMinimumPointerDistance = 50; |
| 57 | 57 |
| 58 void InsertSyncPointAndAckForGpu( | |
| 59 int gpu_host_id, int route_id, const std::string& return_mailbox) { | |
| 60 uint32 sync_point = | |
| 61 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); | |
| 62 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | |
| 63 ack_params.mailbox_name = return_mailbox; | |
| 64 ack_params.sync_point = sync_point; | |
| 65 RenderWidgetHostImpl::AcknowledgeBufferPresent( | |
| 66 route_id, gpu_host_id, ack_params); | |
| 67 } | |
| 68 | |
| 69 void InsertSyncPointAndAckForCompositor( | 58 void InsertSyncPointAndAckForCompositor( |
| 70 int renderer_host_id, | 59 int renderer_host_id, |
| 71 uint32 output_surface_id, | 60 uint32 output_surface_id, |
| 72 int route_id, | 61 int route_id, |
| 73 const gpu::Mailbox& return_mailbox, | 62 const gpu::Mailbox& return_mailbox, |
| 74 const gfx::Size return_size) { | 63 const gfx::Size return_size) { |
| 75 cc::CompositorFrameAck ack; | 64 cc::CompositorFrameAck ack; |
| 76 ack.gl_frame_data.reset(new cc::GLFrameData()); | 65 ack.gl_frame_data.reset(new cc::GLFrameData()); |
| 77 if (!return_mailbox.IsZero()) { | 66 if (!return_mailbox.IsZero()) { |
| 78 ack.gl_frame_data->mailbox = return_mailbox; | 67 ack.gl_frame_data->mailbox = return_mailbox; |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 frame_metadata.viewport_size, | 810 frame_metadata.viewport_size, |
| 822 frame_metadata.location_bar_offset, | 811 frame_metadata.location_bar_offset, |
| 823 frame_metadata.location_bar_content_translation, | 812 frame_metadata.location_bar_content_translation, |
| 824 frame_metadata.overdraw_bottom_height); | 813 frame_metadata.overdraw_bottom_height); |
| 825 } | 814 } |
| 826 } | 815 } |
| 827 | 816 |
| 828 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( | 817 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( |
| 829 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 818 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 830 int gpu_host_id) { | 819 int gpu_host_id) { |
| 831 NOTREACHED() << "Deprecated. Use --composite-to-mailbox."; | 820 NOTREACHED() << "Need --composite-to-mailbox or --enable-delegated-renderer"; |
| 832 | |
| 833 if (params.mailbox_name.empty()) | |
| 834 return; | |
| 835 | |
| 836 std::string return_mailbox; | |
| 837 if (!current_mailbox_.IsZero()) { | |
| 838 return_mailbox.assign( | |
| 839 reinterpret_cast<const char*>(current_mailbox_.name), | |
| 840 sizeof(current_mailbox_.name)); | |
| 841 } | |
| 842 | |
| 843 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, | |
| 844 gpu_host_id, params.route_id, | |
| 845 return_mailbox); | |
| 846 | |
| 847 gpu::Mailbox mailbox; | |
| 848 std::copy(params.mailbox_name.data(), | |
| 849 params.mailbox_name.data() + params.mailbox_name.length(), | |
| 850 reinterpret_cast<char*>(mailbox.name)); | |
| 851 | |
| 852 texture_size_in_layer_ = params.size; | |
| 853 content_size_in_layer_ = params.size; | |
| 854 | |
| 855 BuffersSwapped(mailbox, kUndefinedOutputSurfaceId, callback); | |
| 856 } | 821 } |
| 857 | 822 |
| 858 void RenderWidgetHostViewAndroid::BuffersSwapped( | 823 void RenderWidgetHostViewAndroid::BuffersSwapped( |
| 859 const gpu::Mailbox& mailbox, | 824 const gpu::Mailbox& mailbox, |
| 860 uint32_t output_surface_id, | 825 uint32_t output_surface_id, |
| 861 const base::Closure& ack_callback) { | 826 const base::Closure& ack_callback) { |
| 862 ImageTransportFactoryAndroid* factory = | 827 ImageTransportFactoryAndroid* factory = |
| 863 ImageTransportFactoryAndroid::GetInstance(); | 828 ImageTransportFactoryAndroid::GetInstance(); |
| 864 | 829 |
| 865 // TODO(sievers): When running the impl thread in the browser we | 830 // TODO(sievers): When running the impl thread in the browser we |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); | 958 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); |
| 994 } | 959 } |
| 995 | 960 |
| 996 // TODO(jrg): Find out the implications and answer correctly here, | 961 // TODO(jrg): Find out the implications and answer correctly here, |
| 997 // as we are returning the WebView and not root window bounds. | 962 // as we are returning the WebView and not root window bounds. |
| 998 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { | 963 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { |
| 999 return GetViewBounds(); | 964 return GetViewBounds(); |
| 1000 } | 965 } |
| 1001 | 966 |
| 1002 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { | 967 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { |
| 1003 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | 968 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT); |
| 1004 } | 969 } |
| 1005 | 970 |
| 1006 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( | 971 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( |
| 1007 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 972 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 1008 if (content_view_core_) | 973 if (content_view_core_) |
| 1009 content_view_core_->ConfirmTouchEvent(ack_result); | 974 content_view_core_->ConfirmTouchEvent(ack_result); |
| 1010 } | 975 } |
| 1011 | 976 |
| 1012 void RenderWidgetHostViewAndroid::SetHasHorizontalScrollbar( | 977 void RenderWidgetHostViewAndroid::SetHasHorizontalScrollbar( |
| 1013 bool has_horizontal_scrollbar) { | 978 bool has_horizontal_scrollbar) { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 // RenderWidgetHostView, public: | 1366 // RenderWidgetHostView, public: |
| 1402 | 1367 |
| 1403 // static | 1368 // static |
| 1404 RenderWidgetHostView* | 1369 RenderWidgetHostView* |
| 1405 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1370 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 1406 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1371 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 1407 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1372 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 1408 } | 1373 } |
| 1409 | 1374 |
| 1410 } // namespace content | 1375 } // namespace content |
| OLD | NEW |