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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } // anonymous namespace | 70 } // anonymous namespace |
71 | 71 |
72 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 72 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
73 RenderWidgetHostImpl* widget_host, | 73 RenderWidgetHostImpl* widget_host, |
74 ContentViewCoreImpl* content_view_core) | 74 ContentViewCoreImpl* content_view_core) |
75 : host_(widget_host), | 75 : host_(widget_host), |
76 is_layer_attached_(true), | 76 is_layer_attached_(true), |
77 content_view_core_(NULL), | 77 content_view_core_(NULL), |
78 ime_adapter_android_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 78 ime_adapter_android_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
79 cached_background_color_(SK_ColorWHITE), | 79 cached_background_color_(SK_ColorWHITE), |
80 texture_id_in_layer_(0), | 80 texture_id_in_layer_(0) { |
81 consumed_current_texture_(true) { | |
82 if (CompositorImpl::UsesDirectGL()) { | 81 if (CompositorImpl::UsesDirectGL()) { |
83 surface_texture_transport_.reset(new SurfaceTextureTransportClient()); | 82 surface_texture_transport_.reset(new SurfaceTextureTransportClient()); |
84 layer_ = surface_texture_transport_->Initialize(); | 83 layer_ = surface_texture_transport_->Initialize(); |
85 layer_->SetIsDrawable(true); | 84 layer_->SetIsDrawable(true); |
86 } else { | 85 } else { |
87 texture_layer_ = cc::TextureLayer::Create(this); | 86 texture_layer_ = cc::TextureLayer::Create(this); |
88 layer_ = texture_layer_; | 87 layer_ = texture_layer_; |
89 } | 88 } |
90 | 89 |
91 layer_->SetContentsOpaque(true); | 90 layer_->SetContentsOpaque(true); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // size. | 625 // size. |
627 gfx::PointF uv_max; | 626 gfx::PointF uv_max; |
628 if (texture_size.GetArea() > 0) { | 627 if (texture_size.GetArea() > 0) { |
629 uv_max.SetPoint(content_size.width() / texture_size.width(), | 628 uv_max.SetPoint(content_size.width() / texture_size.width(), |
630 content_size.height() / texture_size.height()); | 629 content_size.height() / texture_size.height()); |
631 } | 630 } |
632 texture_layer_->SetUV(gfx::PointF(0, 0), uv_max); | 631 texture_layer_->SetUV(gfx::PointF(0, 0), uv_max); |
633 texture_size_in_layer_ = texture_size; | 632 texture_size_in_layer_ = texture_size; |
634 current_mailbox_ = mailbox; | 633 current_mailbox_ = mailbox; |
635 | 634 |
636 if (consumed_current_texture_ || host_->is_hidden()) | 635 if (host_->is_hidden()) |
637 ack_callback.Run(); | 636 ack_callback.Run(); |
638 else | 637 else |
639 ack_callbacks_.push(ack_callback); | 638 ack_callbacks_.push(ack_callback); |
640 | |
641 consumed_current_texture_ = false; | |
642 } | 639 } |
643 | 640 |
644 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( | 641 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( |
645 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 642 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
646 int gpu_host_id) { | 643 int gpu_host_id) { |
647 NOTREACHED(); | 644 NOTREACHED(); |
648 } | 645 } |
649 | 646 |
650 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { | 647 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { |
651 NOTREACHED(); | 648 NOTREACHED(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 797 |
801 void RenderWidgetHostViewAndroid::HasTouchEventHandlers( | 798 void RenderWidgetHostViewAndroid::HasTouchEventHandlers( |
802 bool need_touch_events) { | 799 bool need_touch_events) { |
803 if (content_view_core_) | 800 if (content_view_core_) |
804 content_view_core_->HasTouchEventHandlers(need_touch_events); | 801 content_view_core_->HasTouchEventHandlers(need_touch_events); |
805 } | 802 } |
806 | 803 |
807 unsigned RenderWidgetHostViewAndroid::PrepareTexture( | 804 unsigned RenderWidgetHostViewAndroid::PrepareTexture( |
808 cc::ResourceUpdateQueue* queue) { | 805 cc::ResourceUpdateQueue* queue) { |
809 RunAckCallbacks(); | 806 RunAckCallbacks(); |
810 consumed_current_texture_ = true; | |
811 return texture_id_in_layer_; | 807 return texture_id_in_layer_; |
812 } | 808 } |
813 | 809 |
814 WebKit::WebGraphicsContext3D* RenderWidgetHostViewAndroid::Context3d() { | 810 WebKit::WebGraphicsContext3D* RenderWidgetHostViewAndroid::Context3d() { |
815 return ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); | 811 return ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); |
816 } | 812 } |
817 | 813 |
818 bool RenderWidgetHostViewAndroid::PrepareTextureMailbox( | 814 bool RenderWidgetHostViewAndroid::PrepareTextureMailbox( |
819 cc::TextureMailbox* mailbox) { | 815 cc::TextureMailbox* mailbox) { |
820 return false; | 816 return false; |
(...skipping 18 matching lines...) Expand all Loading... |
839 // RenderWidgetHostView, public: | 835 // RenderWidgetHostView, public: |
840 | 836 |
841 // static | 837 // static |
842 RenderWidgetHostView* | 838 RenderWidgetHostView* |
843 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 839 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
844 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 840 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
845 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 841 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
846 } | 842 } |
847 | 843 |
848 } // namespace content | 844 } // namespace content |
OLD | NEW |