| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (CompositorImpl::UsesDirectGL()) { | 81 if (CompositorImpl::UsesDirectGL()) { |
| 82 surface_texture_transport_.reset(new SurfaceTextureTransportClient()); | 82 surface_texture_transport_.reset(new SurfaceTextureTransportClient()); |
| 83 layer_ = surface_texture_transport_->Initialize(); | 83 layer_ = surface_texture_transport_->Initialize(); |
| 84 } else { | 84 } else { |
| 85 texture_layer_ = cc::TextureLayer::create(0); | 85 texture_layer_ = cc::TextureLayer::Create(NULL); |
| 86 layer_ = texture_layer_; | 86 layer_ = texture_layer_; |
| 87 } | 87 } |
| 88 | 88 |
| 89 layer_->setContentsOpaque(true); | 89 layer_->SetContentsOpaque(true); |
| 90 layer_->setIsDrawable(true); | 90 layer_->SetIsDrawable(true); |
| 91 | 91 |
| 92 host_->SetView(this); | 92 host_->SetView(this); |
| 93 SetContentViewCore(content_view_core); | 93 SetContentViewCore(content_view_core); |
| 94 } | 94 } |
| 95 | 95 |
| 96 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { | 96 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { |
| 97 SetContentViewCore(NULL); | 97 SetContentViewCore(NULL); |
| 98 if (texture_id_in_layer_) { | 98 if (texture_id_in_layer_) { |
| 99 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture( | 99 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture( |
| 100 texture_id_in_layer_); | 100 texture_id_in_layer_); |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 ImageTransportFactoryAndroid::GetInstance()->AcquireTexture( | 550 ImageTransportFactoryAndroid::GetInstance()->AcquireTexture( |
| 551 texture_id_in_layer_, mailbox.name); | 551 texture_id_in_layer_, mailbox.name); |
| 552 | 552 |
| 553 // We need to tell ContentViewCore about the new frame before calling | 553 // We need to tell ContentViewCore about the new frame before calling |
| 554 // setNeedsDisplay() below so that it has the needed information schedule the | 554 // setNeedsDisplay() below so that it has the needed information schedule the |
| 555 // next compositor frame. | 555 // next compositor frame. |
| 556 if (content_view_core_) | 556 if (content_view_core_) |
| 557 content_view_core_->DidProduceRendererFrame(); | 557 content_view_core_->DidProduceRendererFrame(); |
| 558 | 558 |
| 559 texture_layer_->setNeedsDisplay(); | 559 texture_layer_->SetNeedsDisplay(); |
| 560 texture_layer_->setBounds(size); | 560 texture_layer_->SetBounds(size); |
| 561 texture_size_in_layer_ = size; | 561 texture_size_in_layer_ = size; |
| 562 current_mailbox_ = mailbox; | 562 current_mailbox_ = mailbox; |
| 563 ack_callback.Run(); | 563 ack_callback.Run(); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( | 566 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( |
| 567 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 567 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 568 int gpu_host_id) { | 568 int gpu_host_id) { |
| 569 NOTREACHED(); | 569 NOTREACHED(); |
| 570 } | 570 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 // RenderWidgetHostView, public: | 743 // RenderWidgetHostView, public: |
| 744 | 744 |
| 745 // static | 745 // static |
| 746 RenderWidgetHostView* | 746 RenderWidgetHostView* |
| 747 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 747 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 748 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 748 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 749 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 749 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 750 } | 750 } |
| 751 | 751 |
| 752 } // namespace content | 752 } // namespace content |
| OLD | NEW |