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

Side by Side Diff: third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.h

Issue 1862033002: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no need to register, taking the same approach as extractTransferables Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef OffscreenCanvas_h 5 #ifndef OffscreenCanvas_h
6 #define OffscreenCanvas_h 6 #define OffscreenCanvas_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/ScriptWrappable.h" 10 #include "bindings/core/v8/ScriptWrappable.h"
(...skipping 16 matching lines...) Expand all
27 static OffscreenCanvas* create(unsigned width, unsigned height); 27 static OffscreenCanvas* create(unsigned width, unsigned height);
28 ~OffscreenCanvas(); 28 ~OffscreenCanvas();
29 29
30 // IDL attributes 30 // IDL attributes
31 unsigned width() const { return m_size.width(); } 31 unsigned width() const { return m_size.width(); }
32 unsigned height() const { return m_size.height(); } 32 unsigned height() const { return m_size.height(); }
33 void setWidth(unsigned); 33 void setWidth(unsigned);
34 void setHeight(unsigned); 34 void setHeight(unsigned);
35 35
36 // API Methods 36 // API Methods
37 OffscreenCanvasRenderingContext2D* getContext(const String&, const CanvasCon textCreationAttributes&); 37 OffscreenCanvasRenderingContext2D* getContext(const String&, const CanvasCon textCreationAttributes&, ExceptionState&);
38 ImageBitmap* transferToImageBitmap(ExceptionState&); 38 ImageBitmap* transferToImageBitmap(ExceptionState&);
39 39
40 IntSize size() const { return m_size; } 40 IntSize size() const { return m_size; }
41 OffscreenCanvasRenderingContext2D* renderingContext() const; 41 OffscreenCanvasRenderingContext2D* renderingContext() const;
42 void setAssociatedCanvas(HTMLCanvasElement* canvas) { m_canvas = canvas; } 42 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; }
43 HTMLCanvasElement* getAssociatedCanvas() const { return m_canvas; } 43 int getAssociatedCanvasId() const { return m_canvasId; }
44 bool isNeutered() const { return m_isNeutered; }
45 void setNeutered();
44 46
45 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>); 47 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>);
46 48
47 DECLARE_VIRTUAL_TRACE(); 49 DECLARE_VIRTUAL_TRACE();
48 50
49 private: 51 private:
50 OffscreenCanvas(const IntSize&); 52 OffscreenCanvas(const IntSize&);
51 53
52 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>; 54 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>;
53 static ContextFactoryVector& renderingContextFactories(); 55 static ContextFactoryVector& renderingContextFactories();
54 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t); 56 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t);
55 57
56 Member<OffscreenCanvasRenderingContext> m_context; 58 Member<OffscreenCanvasRenderingContext> m_context;
57 WeakMember<HTMLCanvasElement> m_canvas; 59 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element.
58 IntSize m_size; 60 IntSize m_size;
61 bool m_isNeutered = false;
59 }; 62 };
60 63
61 } // namespace blink 64 } // namespace blink
62 65
63 #endif // OffscreenCanvas_h 66 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698