| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "content/browser/android/content_view_core_impl.h" | 11 #include "content/browser/android/content_view_core_impl.h" |
| 12 #include "content/browser/android/draw_delegate_impl.h" | 12 #include "content/browser/android/draw_delegate_impl.h" |
| 13 #include "content/browser/gpu/gpu_surface_tracker.h" | 13 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 14 #include "content/browser/renderer_host/compositor_impl_android.h" | 14 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 15 #include "content/browser/renderer_host/image_transport_factory_android.h" | 15 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 17 #include "content/common/android/device_info.h" | 17 #include "content/common/android/device_info.h" |
| 18 #include "content/common/gpu/gpu_messages.h" | 18 #include "content/common/gpu/gpu_messages.h" |
| 19 #include "content/common/view_messages.h" | 19 #include "content/common/view_messages.h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
| 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor
t.h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 | 25 |
| 24 namespace { | 26 namespace { |
| 25 | 27 |
| 26 // TODO(pliard): http://crbug.com/142585. Remove this helper function and update | 28 // TODO(pliard): http://crbug.com/142585. Remove this helper function and update |
| 27 // the clients to deal directly with WebKit::WebTextDirection. | 29 // the clients to deal directly with WebKit::WebTextDirection. |
| 28 base::i18n::TextDirection ConvertTextDirection(WebKit::WebTextDirection dir) { | 30 base::i18n::TextDirection ConvertTextDirection(WebKit::WebTextDirection dir) { |
| 29 switch (dir) { | 31 switch (dir) { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 308 |
| 307 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( | 309 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( |
| 308 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 310 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 309 int gpu_host_id) { | 311 int gpu_host_id) { |
| 310 texture_layer_->setTextureId(params.surface_handle); | 312 texture_layer_->setTextureId(params.surface_handle); |
| 311 texture_layer_->layer()->invalidate(); | 313 texture_layer_->layer()->invalidate(); |
| 312 // TODO(sievers): The view and layer should get sized proactively. | 314 // TODO(sievers): The view and layer should get sized proactively. |
| 313 if (((gfx::Size)texture_layer_->layer()->bounds()).IsEmpty()) | 315 if (((gfx::Size)texture_layer_->layer()->bounds()).IsEmpty()) |
| 314 texture_layer_->layer()->setBounds( | 316 texture_layer_->layer()->setBounds( |
| 315 DrawDelegateImpl::GetInstance()->GetBounds()); | 317 DrawDelegateImpl::GetInstance()->GetBounds()); |
| 316 DrawDelegateImpl::GetInstance()->OnSurfaceUpdated( | 318 |
| 317 params.surface_handle, | 319 // TODO(sievers): When running the impl thread in the browser we |
| 318 this, | 320 // need to delay the ACK until after commit. |
| 319 base::Bind(&RenderWidgetHostImpl::AcknowledgeBufferPresent, | 321 DCHECK(!WebKit::Platform::current()->compositorSupport()-> |
| 320 params.route_id, gpu_host_id)); | 322 isThreadingEnabled()); |
| 323 uint32 sync_point = |
| 324 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); |
| 325 RenderWidgetHostImpl::AcknowledgeBufferPresent( |
| 326 params.route_id, gpu_host_id, sync_point); |
| 321 } | 327 } |
| 322 | 328 |
| 323 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( | 329 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( |
| 324 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 330 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 325 int gpu_host_id) { | 331 int gpu_host_id) { |
| 326 NOTREACHED(); | 332 NOTREACHED(); |
| 327 } | 333 } |
| 328 | 334 |
| 329 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { | 335 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { |
| 330 NOTREACHED(); | 336 NOTREACHED(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 // RenderWidgetHostView, public: | 507 // RenderWidgetHostView, public: |
| 502 | 508 |
| 503 // static | 509 // static |
| 504 RenderWidgetHostView* | 510 RenderWidgetHostView* |
| 505 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 511 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 506 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 512 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 507 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 513 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 508 } | 514 } |
| 509 | 515 |
| 510 } // namespace content | 516 } // namespace content |
| OLD | NEW |