OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MailboxTextureHolder_h |
| 6 #define MailboxTextureHolder_h |
| 7 |
| 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/TextureHolder.h" |
| 10 #include "third_party/khronos/GLES2/gl2.h" |
| 11 |
| 12 namespace gpu { |
| 13 namespace gles2 { |
| 14 class GLES2Interface; |
| 15 } |
| 16 } |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 class SkiaTextureHolder; |
| 21 |
| 22 class PLATFORM_EXPORT MailboxTextureHolder final : public TextureHolder { |
| 23 public: |
| 24 ~MailboxTextureHolder() override; |
| 25 |
| 26 bool isSkiaTextureHolder() final { return false; } |
| 27 unsigned sharedContextId() final; |
| 28 gpu::Mailbox getMailbox() final { return m_mailbox; } |
| 29 gpu::SyncToken getSyncToken() final { return m_syncToken; } |
| 30 IntSize getMailboxSize() final { return m_size; } |
| 31 void releaseImageThreadSafe() final {} |
| 32 sk_sp<SkImage> getSkImage() final { return nullptr; } |
| 33 WebThread* getImageThread() final; |
| 34 IntSize size() const final { return m_size; } |
| 35 void setSharedContextId(unsigned contextId) final {} |
| 36 void setImageThread(WebThread* thread) final {} |
| 37 void updateSyncToken(gpu::SyncToken syncToken) final { |
| 38 m_syncToken = syncToken; |
| 39 } |
| 40 |
| 41 // In WebGL's commit or transferToImageBitmap calls, it will call the |
| 42 // DrawingBuffer::transferToStaticBitmapImage function, which produces the |
| 43 // input parameters for this method. |
| 44 MailboxTextureHolder(const gpu::Mailbox&, |
| 45 const gpu::SyncToken&, |
| 46 unsigned textureId, |
| 47 gpu::gles2::GLES2Interface*, |
| 48 IntSize mailboxSize); |
| 49 // This function turns a texture-backed SkImage into a mailbox and a |
| 50 // syncToken. |
| 51 MailboxTextureHolder(sk_sp<SkImage>); |
| 52 |
| 53 private: |
| 54 gpu::Mailbox m_mailbox; |
| 55 gpu::SyncToken m_syncToken; |
| 56 unsigned m_textureId; |
| 57 gpu::gles2::GLES2Interface* m_gl; |
| 58 IntSize m_size; |
| 59 }; |
| 60 |
| 61 } // namespace blink |
| 62 |
| 63 #endif // MailboxTextureHolder_h |
OLD | NEW |