| Index: third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
|
| diff --git a/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b40c5e26bf8857f2b9cf1686a253ef15c467e147
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SkiaTextureHolder_h
|
| +#define SkiaTextureHolder_h
|
| +
|
| +#include "platform/PlatformExport.h"
|
| +#include "platform/graphics/TextureHolder.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class MailboxTextureHolder;
|
| +
|
| +class PLATFORM_EXPORT SkiaTextureHolder final : public TextureHolder {
|
| + public:
|
| + bool isSkiaTextureHolder() final { return true; }
|
| + unsigned sharedContextId() final;
|
| + gpu::Mailbox getMailbox() final { return gpu::Mailbox(); }
|
| + gpu::SyncToken getSyncToken() final { return gpu::SyncToken(); }
|
| + IntSize getMailboxSize() final { return IntSize(); }
|
| + void releaseImageThreadSafe() final;
|
| + sk_sp<SkImage> getSkImage() final { return m_image; }
|
| + WebThread* getImageThread() final { return m_imageThread; }
|
| + IntSize size() const final {
|
| + return IntSize(m_image->width(), m_image->height());
|
| + }
|
| + void setSharedContextId(unsigned contextId) final {
|
| + m_sharedContextId = contextId;
|
| + }
|
| + void setImageThread(WebThread* thread) { m_imageThread = thread; }
|
| + void deleteTexture(const int8_t* syncTokenData) final {}
|
| +
|
| + // When creating a AcceleratedStaticBitmap from a texture-backed SkImage, this
|
| + // function will be called to create a TextureHolder object.
|
| + SkiaTextureHolder(sk_sp<SkImage>);
|
| + // This function consumes the mailbox in the input parameter and turn it into
|
| + // a texture-backed SkImage.
|
| + SkiaTextureHolder(const gpu::Mailbox&,
|
| + const gpu::SyncToken&,
|
| + IntSize mailboxSize);
|
| +
|
| + private:
|
| + // The m_image should always be texture-backed
|
| + sk_sp<SkImage> m_image;
|
| + // Id of the shared context where m_image was created
|
| + unsigned m_sharedContextId = 0;
|
| + // Thread that |m_image| belongs to. Set to null when |m_image| belongs to the
|
| + // same thread as the AcceleratedStaticBitmapImage. Should only be non-null
|
| + // after a transfer.
|
| + WebThread* m_imageThread = nullptr;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // SkiaTextureHolder_h
|
|
|