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

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

Issue 2490443002: Make OffscreenCanvas an EventTarget (Closed)
Patch Set: keep a Member<ExecutionContext> in OffscreenCanvas Created 4 years, 1 month 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 656b4dd24c7d6d2a11270afbd14339a5fdc15ee2..b455beb9b1427d7491c5fb1a39daa59aa5305328 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.h
@@ -8,6 +8,7 @@
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/events/EventTarget.h"
#include "core/html/HTMLCanvasElement.h"
#include "core/html/canvas/CanvasImageSource.h"
#include "core/offscreencanvas/ImageEncodeOptions.h"
@@ -25,14 +26,13 @@ class
typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContext
OffscreenRenderingContext;
-class CORE_EXPORT OffscreenCanvas final
- : public GarbageCollectedFinalized<OffscreenCanvas>,
- public ScriptWrappable,
- public CanvasImageSource {
+class CORE_EXPORT OffscreenCanvas final : public EventTargetWithInlineData,
+ public CanvasImageSource {
DEFINE_WRAPPERTYPEINFO();
public:
static OffscreenCanvas* create(unsigned width, unsigned height);
+ ~OffscreenCanvas() override {}
// IDL attributes
unsigned width() const { return m_size.width(); }
@@ -84,6 +84,18 @@ class CORE_EXPORT OffscreenCanvas final
uint64_t nonceHigh() const { return m_nonceHigh; }
uint64_t nonceLow() const { return m_nonceLow; }
+ void setExecutionContext(ExecutionContext* context) {
+ m_executionContext = context;
+ }
+
+ // EventTarget implementation
+ const AtomicString& interfaceName() const final {
+ return EventTargetNames::OffscreenCanvas;
+ }
+ ExecutionContext* getExecutionContext() const {
+ return m_executionContext.get();
+ }
+
// CanvasImageSource implementation
PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*,
AccelerationHint,
@@ -110,6 +122,7 @@ class CORE_EXPORT OffscreenCanvas final
static CanvasRenderingContextFactory* getRenderingContextFactory(int);
Member<CanvasRenderingContext> m_context;
+ Member<ExecutionContext> m_executionContext;
Justin Novosad 2016/11/14 19:45:08 Nit: This reference is not need for lifetime manag
xidachen 2016/11/14 19:56:38 Changed to WeakMember. But still need to trace it,
int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no
// associated canvas element.

Powered by Google App Engine
This is Rietveld 408576698