| Index: third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
 | 
| diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
 | 
| index a9e9e3a1a6ab03f7d388723e8de0ce97cd0602da..873f98d7c169c06424f9eb7078d848c569c3b8a9 100644
 | 
| --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
 | 
| +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
 | 
| @@ -6,44 +6,41 @@
 | 
|  #define AcceleratedStaticBitmapImage_h
 | 
|  
 | 
|  #include "base/threading/thread_checker.h"
 | 
| -#include "platform/geometry/IntSize.h"
 | 
|  #include "platform/graphics/StaticBitmapImage.h"
 | 
| -#include "third_party/skia/include/core/SkRefCnt.h"
 | 
| +#include "platform/graphics/TextureHolder.h"
 | 
| +#include "wtf/WeakPtr.h"
 | 
|  
 | 
|  #include <memory>
 | 
|  
 | 
|  class GrContext;
 | 
|  
 | 
|  namespace blink {
 | 
| -class WebThread;
 | 
| +class WebGraphicsContext3DProviderWrapper;
 | 
| +class TextureHolder;
 | 
|  
 | 
|  class PLATFORM_EXPORT AcceleratedStaticBitmapImage final
 | 
|      : public StaticBitmapImage {
 | 
|   public:
 | 
| +  ~AcceleratedStaticBitmapImage() override;
 | 
|    // SkImage with a texture backing that is assumed to be from the shared
 | 
|    // context of the current thread.
 | 
|    static PassRefPtr<AcceleratedStaticBitmapImage> createFromSharedContextImage(
 | 
|        sk_sp<SkImage>);
 | 
| -  // Can specify the GrContext that created the texture backing the for the
 | 
| -  // given SkImage. Ideally all callers would use this option. The |mailbox| is
 | 
| -  // a name for the texture backing the SkImage, allowing other contexts to use
 | 
| -  // the same backing.
 | 
| +  // Can specify the GrContext that created the texture backing. Ideally all
 | 
| +  // callers would use this option. The |mailbox| is a name for the texture
 | 
| +  // backing, allowing other contexts to use the same backing.
 | 
|    static PassRefPtr<AcceleratedStaticBitmapImage> createFromWebGLContextImage(
 | 
| -      sk_sp<SkImage>,
 | 
|        const gpu::Mailbox&,
 | 
| -      const gpu::SyncToken&);
 | 
| -
 | 
| -  ~AcceleratedStaticBitmapImage() override;
 | 
| +      const gpu::SyncToken&,
 | 
| +      unsigned textureId,
 | 
| +      WeakPtr<WebGraphicsContext3DProviderWrapper>,
 | 
| +      IntSize mailboxSize);
 | 
|  
 | 
| -  // StaticBitmapImage overrides.
 | 
| +  bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override;
 | 
| +  IntSize size() const override;
 | 
|    sk_sp<SkImage> imageForCurrentFrame() override;
 | 
| -  void copyToTexture(WebGraphicsContext3DProvider*,
 | 
| -                     GLuint destTextureId,
 | 
| -                     GLenum destInternalFormat,
 | 
| -                     GLenum destType,
 | 
| -                     bool flipY) override;
 | 
| +  bool isTextureBacked() final { return true; }
 | 
|  
 | 
| -  // Image overrides.
 | 
|    void draw(SkCanvas*,
 | 
|              const SkPaint&,
 | 
|              const FloatRect& dstRect,
 | 
| @@ -51,40 +48,35 @@ class PLATFORM_EXPORT AcceleratedStaticBitmapImage final
 | 
|              RespectImageOrientationEnum,
 | 
|              ImageClampingMode) override;
 | 
|  
 | 
| +  void copyToTexture(WebGraphicsContext3DProvider*,
 | 
| +                     GLuint destTextureId,
 | 
| +                     GLenum destInternalFormat,
 | 
| +                     GLenum destType,
 | 
| +                     bool flipY) override;
 | 
| +
 | 
| +  bool hasMailbox() final { return m_textureHolder->isMailboxTextureHolder(); }
 | 
|    // To be called on sender thread before performing a transfer
 | 
|    void transfer() final;
 | 
|  
 | 
|    void ensureMailbox() final;
 | 
| -  gpu::Mailbox getMailbox() final { return m_mailbox; }
 | 
| -  gpu::SyncToken getSyncToken() final { return m_syncToken; }
 | 
| +  gpu::Mailbox mailbox() final { return m_textureHolder->mailbox(); }
 | 
| +  gpu::SyncToken syncToken() final { return m_textureHolder->syncToken(); }
 | 
| +  void updateSyncToken(gpu::SyncToken) final;
 | 
|  
 | 
|   private:
 | 
|    AcceleratedStaticBitmapImage(sk_sp<SkImage>);
 | 
| -  AcceleratedStaticBitmapImage(sk_sp<SkImage>,
 | 
| -                               const gpu::Mailbox&,
 | 
| -                               const gpu::SyncToken&);
 | 
| +  AcceleratedStaticBitmapImage(const gpu::Mailbox&,
 | 
| +                               const gpu::SyncToken&,
 | 
| +                               unsigned textureId,
 | 
| +                               WeakPtr<WebGraphicsContext3DProviderWrapper>,
 | 
| +                               IntSize mailboxSize);
 | 
|  
 | 
|    void createImageFromMailboxIfNeeded();
 | 
|    void checkThread();
 | 
|    void waitSyncTokenIfNeeded();
 | 
|    bool isValid();
 | 
| -  void releaseImageThreadSafe();
 | 
| -  bool imageBelongsToSharedContext();
 | 
| -
 | 
| -  // Id of the shared context where m_image was created
 | 
| -  unsigned m_sharedContextId;
 | 
| -  // True when the below mailbox and sync token are valid for getting at the
 | 
| -  // texture backing the object's SkImage.
 | 
| -  bool m_hasMailbox = false;
 | 
| -  // A mailbox referring to the texture id backing the SkImage. The mailbox is
 | 
| -  // valid as long as the SkImage is held alive.
 | 
| -  gpu::Mailbox m_mailbox;
 | 
| -  // This token must be waited for before using the mailbox.
 | 
| -  gpu::SyncToken m_syncToken;
 | 
| -  // Thread that |m_image| belongs to. Set to null when |m_image| belongs to the
 | 
| -  // same thread as this AcceleratedStaticBitmapImage.  Should only be non-null
 | 
| -  // after a transfer.
 | 
| -  WebThread* m_imageThread = nullptr;
 | 
| +
 | 
| +  std::unique_ptr<TextureHolder> m_textureHolder;
 | 
|  
 | 
|    base::ThreadChecker m_threadChecker;
 | 
|    bool m_detachThreadAtNextCheck = false;
 | 
| 
 |