| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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/renderer/compositor_bindings/web_external_texture_layer_impl.h
     " |    5 #include "cc/blink/web_external_texture_layer_impl.h" | 
|    6  |    6  | 
 |    7 #include "cc/blink/web_external_bitmap_impl.h" | 
 |    8 #include "cc/blink/web_layer_impl.h" | 
|    7 #include "cc/layers/texture_layer.h" |    9 #include "cc/layers/texture_layer.h" | 
|    8 #include "cc/resources/resource_update_queue.h" |   10 #include "cc/resources/resource_update_queue.h" | 
|    9 #include "cc/resources/single_release_callback.h" |   11 #include "cc/resources/single_release_callback.h" | 
|   10 #include "cc/resources/texture_mailbox.h" |   12 #include "cc/resources/texture_mailbox.h" | 
|   11 #include "content/renderer/compositor_bindings/web_external_bitmap_impl.h" |  | 
|   12 #include "content/renderer/compositor_bindings/web_layer_impl.h" |  | 
|   13 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" |   13 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" | 
|   14 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" |   14 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" | 
|   15 #include "third_party/WebKit/public/platform/WebFloatRect.h" |   15 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 
|   16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |   16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 
|   17 #include "third_party/WebKit/public/platform/WebSize.h" |   17 #include "third_party/WebKit/public/platform/WebSize.h" | 
|   18 #include "third_party/khronos/GLES2/gl2.h" |   18 #include "third_party/khronos/GLES2/gl2.h" | 
|   19  |   19  | 
|   20 using cc::TextureLayer; |   20 using cc::TextureLayer; | 
|   21 using cc::ResourceUpdateQueue; |   21 using cc::ResourceUpdateQueue; | 
|   22  |   22  | 
|   23 namespace content { |   23 namespace cc_blink { | 
|   24  |   24  | 
|   25 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( |   25 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( | 
|   26     blink::WebExternalTextureLayerClient* client) |   26     blink::WebExternalTextureLayerClient* client) | 
|   27     : client_(client) { |   27     : client_(client) { | 
|   28   cc::TextureLayerClient* cc_client = client_ ? this : NULL; |   28   cc::TextureLayerClient* cc_client = client_ ? this : NULL; | 
|   29   scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(cc_client); |   29   scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(cc_client); | 
|   30   layer->SetIsDrawable(true); |   30   layer->SetIsDrawable(true); | 
|   31   layer_.reset(new WebLayerImpl(layer)); |   31   layer_.reset(new WebLayerImpl(layer)); | 
|   32 } |   32 } | 
|   33  |   33  | 
|   34 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { |   34 WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() { | 
|   35   static_cast<TextureLayer*>(layer_->layer())->ClearClient(); |   35   static_cast<TextureLayer*>(layer_->layer())->ClearClient(); | 
|   36 } |   36 } | 
|   37  |   37  | 
|   38 blink::WebLayer* WebExternalTextureLayerImpl::layer() { |   38 blink::WebLayer* WebExternalTextureLayerImpl::layer() { | 
|   39   return layer_.get(); |   39   return layer_.get(); | 
|   40 } |   40 } | 
|   41  |   41  | 
|   42 void WebExternalTextureLayerImpl::clearTexture() { |   42 void WebExternalTextureLayerImpl::clearTexture() { | 
|   43   TextureLayer* layer = static_cast<TextureLayer*>(layer_->layer()); |   43   TextureLayer* layer = static_cast<TextureLayer*>(layer_->layer()); | 
|   44   layer->ClearTexture(); |   44   layer->ClearTexture(); | 
|   45 } |   45 } | 
|   46  |   46  | 
|   47 void WebExternalTextureLayerImpl::setOpaque(bool opaque) { |   47 void WebExternalTextureLayerImpl::setOpaque(bool opaque) { | 
|   48   static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque); |   48   static_cast<TextureLayer*>(layer_->layer())->SetContentsOpaque(opaque); | 
|   49 } |   49 } | 
|   50  |   50  | 
|   51 void WebExternalTextureLayerImpl::setPremultipliedAlpha( |   51 void WebExternalTextureLayerImpl::setPremultipliedAlpha( | 
|   52     bool premultiplied_alpha) { |   52     bool premultiplied_alpha) { | 
|   53   static_cast<TextureLayer*>(layer_->layer())->SetPremultipliedAlpha( |   53   static_cast<TextureLayer*>(layer_->layer()) | 
|   54       premultiplied_alpha); |   54       ->SetPremultipliedAlpha(premultiplied_alpha); | 
|   55 } |   55 } | 
|   56  |   56  | 
|   57 void WebExternalTextureLayerImpl::setBlendBackgroundColor(bool blend) { |   57 void WebExternalTextureLayerImpl::setBlendBackgroundColor(bool blend) { | 
|   58   static_cast<TextureLayer*>(layer_->layer())->SetBlendBackgroundColor(blend); |   58   static_cast<TextureLayer*>(layer_->layer())->SetBlendBackgroundColor(blend); | 
|   59 } |   59 } | 
|   60  |   60  | 
|   61 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { |   61 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { | 
|   62   static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); |   62   static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); | 
|   63 } |   63 } | 
|   64  |   64  | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  115     bool lost_resource) { |  115     bool lost_resource) { | 
|  116   DCHECK(layer); |  116   DCHECK(layer); | 
|  117   blink::WebExternalTextureMailbox available_mailbox; |  117   blink::WebExternalTextureMailbox available_mailbox; | 
|  118   memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); |  118   memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); | 
|  119   available_mailbox.syncPoint = sync_point; |  119   available_mailbox.syncPoint = sync_point; | 
|  120   if (bitmap) |  120   if (bitmap) | 
|  121     layer->free_bitmaps_.push_back(bitmap); |  121     layer->free_bitmaps_.push_back(bitmap); | 
|  122   layer->client_->mailboxReleased(available_mailbox, lost_resource); |  122   layer->client_->mailboxReleased(available_mailbox, lost_resource); | 
|  123 } |  123 } | 
|  124  |  124  | 
|  125 }  // namespace content |  125 }  // namespace cc_blink | 
|  126  |  | 
| OLD | NEW |