Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Unified Diff: third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h

Issue 2261623002: Make DrawingBuffer and Canvas2DLayerBridge be cc::TextureLayerClients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: webmailbox: fix-passrefptr Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b5a418d95f1da386a140a4d4491aef76ca1d339b..a45db448f88088283da39340d67a7ef67803c5fc 100644
--- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
+++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
@@ -5,30 +5,57 @@
#ifndef AcceleratedStaticBitmapImage_h
#define AcceleratedStaticBitmapImage_h
+#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/common/sync_token.h"
+#include "platform/geometry/IntSize.h"
#include "platform/graphics/StaticBitmapImage.h"
-#include "public/platform/WebExternalTextureMailbox.h"
+
+#include <memory>
+
+class GrContext;
+
+namespace cc {
+class SingleReleaseCallback;
+}
namespace blink {
class PLATFORM_EXPORT AcceleratedStaticBitmapImage final : public StaticBitmapImage {
public:
- ~AcceleratedStaticBitmapImage() override { };
+ // SkImage with a texture backing that is assumed to be from the shared main thread context.
+ static PassRefPtr<AcceleratedStaticBitmapImage> create(PassRefPtr<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.
+ static PassRefPtr<AcceleratedStaticBitmapImage> create(PassRefPtr<SkImage>, sk_sp<GrContext>, const gpu::Mailbox&, const gpu::SyncToken&);
+
+ ~AcceleratedStaticBitmapImage() override;
- IntSize size() const override;
+ // StaticBitmapImage overrides.
PassRefPtr<SkImage> imageForCurrentFrame() override;
- static PassRefPtr<AcceleratedStaticBitmapImage> create(PassRefPtr<SkImage>);
- static PassRefPtr<AcceleratedStaticBitmapImage> create(WebExternalTextureMailbox&);
- void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GLenum, bool) override;
- bool hasMailbox() override { return m_mailbox.textureSize.width != 0 && m_mailbox.textureSize.height != 0; }
+ void copyToTexture(WebGraphicsContext3DProvider*, GLuint destTextureId, GLenum destInternalFormat, GLenum destType, bool flipY) override;
private:
AcceleratedStaticBitmapImage(PassRefPtr<SkImage>);
- AcceleratedStaticBitmapImage(WebExternalTextureMailbox&);
+ AcceleratedStaticBitmapImage(PassRefPtr<SkImage>, sk_sp<GrContext>, const gpu::Mailbox&, const gpu::SyncToken&);
+
bool switchStorageToMailbox(WebGraphicsContext3DProvider*);
GLuint switchStorageToSkImageForWebGL(WebGraphicsContext3DProvider*);
GLuint switchStorageToSkImage(WebGraphicsContext3DProvider*);
- WebExternalTextureMailbox m_mailbox;
+ void ensureMailbox();
+
+ // True when the |m_image| has a texture id backing it from the shared main thread context.
+ bool m_imageIsForSharedMainThreadContext;
+
+ // Keeps the context alive that the SkImage is associated with. Not used if the SkImage is coming from the shared main
+ // thread context as we assume that context is kept alive elsewhere since it is globally shared in the process.
+ sk_sp<GrContext> m_grContext;
+ // 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;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698