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

Unified Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h

Issue 2594843002: Implementing promise-based commit for driving OffscreenCanvas animations (Closed)
Patch Set: rebase Created 3 years, 11 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/core/offscreencanvas/OffscreenCanvas.h
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
index e3f175ad4e58cfa3b8be7c47300784bd4838327a..2d121a593c7edf695356e7c7a0ec0e440476c11c 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
@@ -26,14 +26,18 @@ class
typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContext
OffscreenRenderingContext;
-class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
- public CanvasImageSource,
- public ImageBitmapSource {
+class CORE_EXPORT OffscreenCanvas final
+ : public EventTargetWithInlineData,
+ public CanvasImageSource,
+ public ImageBitmapSource,
+ public OffscreenCanvasFrameDispatcherClient {
DEFINE_WRAPPERTYPEINFO();
+ USING_PRE_FINALIZER(OffscreenCanvas, dispose);
public:
static OffscreenCanvas* create(unsigned width, unsigned height);
- ~OffscreenCanvas() override {}
+ ~OffscreenCanvas() override;
+ void dispose();
// IDL attributes
unsigned width() const { return m_size.width(); }
@@ -73,8 +77,6 @@ class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
// TODO(crbug.com/630356): apply the flag to WebGL context as well
void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true; }
- OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher();
-
void setFrameSinkId(uint32_t clientId, uint32_t sinkId) {
m_clientId = clientId;
m_sinkId = sinkId;
@@ -86,6 +88,15 @@ class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
m_executionContext = context;
}
+ ScriptPromise commit(RefPtr<StaticBitmapImage>,
+ bool isWebGLSoftwareRendering,
+ ScriptState*);
+
+ void detachContext() { m_context = nullptr; }
+
+ // OffscreenCanvasFrameDispatcherClient implementation
+ void beginFrame() final;
+
// EventTarget implementation
const AtomicString& interfaceName() const final {
return EventTargetNames::OffscreenCanvas;
@@ -121,7 +132,8 @@ class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
private:
explicit OffscreenCanvas(const IntSize&);
-
+ OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher();
+ void doCommit(RefPtr<StaticBitmapImage>, bool isWebGLSoftwareRendering);
using ContextFactoryVector =
Vector<std::unique_ptr<CanvasRenderingContextFactory>>;
static ContextFactoryVector& renderingContextFactories();
@@ -139,12 +151,15 @@ class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
IntSize m_size;
bool m_isNeutered = false;
- bool m_originClean;
+ bool m_originClean = true;
bool m_disableReadingFromCanvas = false;
bool isPaintable() const;
std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher;
+ Member<ScriptPromiseResolver> m_commitPromiseResolver;
+ RefPtr<StaticBitmapImage> m_overdrawFrame;
+ bool m_overdrawFrameIsWebGLSoftwareRendering = false;
// cc::FrameSinkId is broken into two integer components as this can be used
// in transfer of OffscreenCanvas across threads
// If this object is not created via

Powered by Google App Engine
This is Rietveld 408576698