| 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 #ifndef CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ | 5 #ifndef CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ |
| 6 #define CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ | 6 #define CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | |
| 10 | 9 |
| 11 #include "base/bind.h" | |
| 12 #include "base/macros.h" | 10 #include "base/macros.h" |
| 13 #include "cc/blink/cc_blink_export.h" | 11 #include "cc/blink/cc_blink_export.h" |
| 14 #include "cc/layers/texture_layer_client.h" | |
| 15 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" | 12 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" |
| 16 | 13 |
| 17 namespace blink { | |
| 18 class WebExternalTextureLayerClient; | |
| 19 struct WebFloatRect; | |
| 20 struct WebExternalTextureMailbox; | |
| 21 } | |
| 22 | |
| 23 namespace cc { | 14 namespace cc { |
| 24 class SingleReleaseCallback; | 15 class TextureLayerClient; |
| 25 class TextureMailbox; | |
| 26 } | 16 } |
| 27 | 17 |
| 28 namespace cc_blink { | 18 namespace cc_blink { |
| 19 class WebLayerImpl; |
| 29 | 20 |
| 30 class WebLayerImpl; | 21 class WebExternalTextureLayerImpl : public blink::WebExternalTextureLayer { |
| 31 class WebExternalBitmapImpl; | |
| 32 | |
| 33 class WebExternalTextureLayerImpl | |
| 34 : public blink::WebExternalTextureLayer, | |
| 35 public cc::TextureLayerClient, | |
| 36 public base::SupportsWeakPtr<WebExternalTextureLayerImpl> { | |
| 37 public: | 22 public: |
| 38 CC_BLINK_EXPORT explicit WebExternalTextureLayerImpl( | 23 CC_BLINK_EXPORT explicit WebExternalTextureLayerImpl(cc::TextureLayerClient*); |
| 39 blink::WebExternalTextureLayerClient*); | |
| 40 ~WebExternalTextureLayerImpl() override; | 24 ~WebExternalTextureLayerImpl() override; |
| 41 | 25 |
| 42 // blink::WebExternalTextureLayer implementation. | 26 // blink::WebExternalTextureLayer implementation. |
| 43 blink::WebLayer* layer() override; | 27 blink::WebLayer* layer() override; |
| 44 void clearTexture() override; | 28 void clearTexture() override; |
| 45 void setOpaque(bool opaque) override; | 29 void setOpaque(bool opaque) override; |
| 46 void setPremultipliedAlpha(bool premultiplied) override; | 30 void setPremultipliedAlpha(bool premultiplied) override; |
| 47 void setBlendBackgroundColor(bool blend) override; | 31 void setBlendBackgroundColor(bool blend) override; |
| 48 void setNearestNeighbor(bool nearest_neighbor) override; | 32 void setNearestNeighbor(bool nearest_neighbor) override; |
| 49 | 33 |
| 50 // TextureLayerClient implementation. | |
| 51 bool PrepareTextureMailbox( | |
| 52 cc::TextureMailbox* mailbox, | |
| 53 std::unique_ptr<cc::SingleReleaseCallback>* release_callback, | |
| 54 bool use_shared_memory) override; | |
| 55 | |
| 56 private: | 34 private: |
| 57 static void DidReleaseMailbox( | |
| 58 base::WeakPtr<WebExternalTextureLayerImpl> layer, | |
| 59 const blink::WebExternalTextureMailbox& mailbox, | |
| 60 WebExternalBitmapImpl* bitmap, | |
| 61 const gpu::SyncToken& sync_token, | |
| 62 bool lost_resource); | |
| 63 | |
| 64 WebExternalBitmapImpl* AllocateBitmap(); | |
| 65 | |
| 66 blink::WebExternalTextureLayerClient* client_; | |
| 67 std::unique_ptr<WebLayerImpl> layer_; | 35 std::unique_ptr<WebLayerImpl> layer_; |
| 68 std::vector<std::unique_ptr<WebExternalBitmapImpl>> free_bitmaps_; | |
| 69 | 36 |
| 70 DISALLOW_COPY_AND_ASSIGN(WebExternalTextureLayerImpl); | 37 DISALLOW_COPY_AND_ASSIGN(WebExternalTextureLayerImpl); |
| 71 }; | 38 }; |
| 72 | 39 |
| 73 } // namespace cc_blink | 40 } // namespace cc_blink |
| 74 | 41 |
| 75 #endif // CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ | 42 #endif // CC_BLINK_WEB_EXTERNAL_TEXTURE_LAYER_IMPL_H_ |
| OLD | NEW |