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 #include "wtf/WeakPtr.h" | |
12 | |
13 namespace blink { | |
14 | |
15 class DrawingBuffer; | |
Justin Novosad
2016/11/08 14:33:27
The dependency on DrawingBuffer here is quite yuck
| |
16 | |
17 class PLATFORM_EXPORT MailboxTextureHolder final : public TextureHolder { | |
18 public: | |
19 ~MailboxTextureHolder() override; | |
20 | |
21 bool isSkiaTextureHolder() final { return false; } | |
22 bool isMailboxTextureHolder() final { return true; } | |
23 unsigned sharedContextId() final; | |
24 IntSize size() const final { return m_size; } | |
25 bool currentFrameKnownToBeOpaque(Image::MetadataMode) final { return false; } | |
26 WebThread* imageThread() final; | |
27 | |
28 gpu::Mailbox mailbox() final { return m_mailbox; } | |
29 gpu::SyncToken syncToken() final { return m_syncToken; } | |
30 void updateSyncToken(gpu::SyncToken syncToken) final { | |
31 m_syncToken = syncToken; | |
32 } | |
33 void deleteTexture() final; | |
34 | |
35 // In WebGL's commit or transferToImageBitmap calls, it will call the | |
36 // DrawingBuffer::transferToStaticBitmapImage function, which produces the | |
37 // input parameters for this method. | |
38 MailboxTextureHolder(const gpu::Mailbox&, | |
39 const gpu::SyncToken&, | |
40 unsigned textureIdToDeleteAfterMailboxConsumed, | |
41 WeakPtr<DrawingBuffer>, | |
42 IntSize mailboxSize); | |
43 // This function turns a texture-backed SkImage into a mailbox and a | |
44 // syncToken. | |
45 MailboxTextureHolder(std::unique_ptr<TextureHolder>); | |
46 | |
47 private: | |
48 gpu::Mailbox m_mailbox; | |
49 gpu::SyncToken m_syncToken; | |
50 unsigned m_textureId; | |
51 WeakPtr<DrawingBuffer> m_drawingBuffer; | |
Justin Novosad
2016/11/08 14:33:27
This should have a better name, to indicate that i
| |
52 IntSize m_size; | |
53 bool m_isConvertedFromSkiaTexture; | |
54 }; | |
55 | |
56 } // namespace blink | |
57 | |
58 #endif // MailboxTextureHolder_h | |
OLD | NEW |