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

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

Issue 1881563003: Implement OffscreenCanvas.getContext('webgl') (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add bug# in TODO Created 4 years, 7 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"
11 #include "core/html/HTMLCanvasElement.h" 11 #include "core/html/HTMLCanvasElement.h"
12 #include "platform/geometry/IntSize.h" 12 #include "platform/geometry/IntSize.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class CanvasContextCreationAttributes; 17 class CanvasContextCreationAttributes;
18 class ImageBitmap; 18 class ImageBitmap;
19 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC ontext;
20 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin gContext OffscreenRenderingContext;
19 21
20 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva s>, public ScriptWrappable { 22 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva s>, public ScriptWrappable {
21 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
22 public: 24 public:
23 static OffscreenCanvas* create(unsigned width, unsigned height); 25 static OffscreenCanvas* create(unsigned width, unsigned height);
24 26
25 // IDL attributes 27 // IDL attributes
26 unsigned width() const { return m_size.width(); } 28 unsigned width() const { return m_size.width(); }
27 unsigned height() const { return m_size.height(); } 29 unsigned height() const { return m_size.height(); }
28 void setWidth(unsigned); 30 void setWidth(unsigned);
29 void setHeight(unsigned); 31 void setHeight(unsigned);
30 32
31 // API Methods 33 // API Methods
32 ImageBitmap* transferToImageBitmap(ExceptionState&); 34 ImageBitmap* transferToImageBitmap(ExceptionState&);
33 35
34 IntSize size() const { return m_size; } 36 IntSize size() const { return m_size; }
35 void setAssociatedCanvas(HTMLCanvasElement* canvas) { m_canvas = canvas; } 37 void setAssociatedCanvas(HTMLCanvasElement* canvas) { m_canvas = canvas; }
36 HTMLCanvasElement* getAssociatedCanvas() const { return m_canvas; } 38 HTMLCanvasElement* getAssociatedCanvas() const { return m_canvas; }
37 CanvasRenderingContext* getCanvasRenderingContext(const String&, const Canva sContextCreationAttributes&); 39 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&);
38 40
39 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); 41 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>);
40 42
41 DECLARE_VIRTUAL_TRACE(); 43 DECLARE_VIRTUAL_TRACE();
42 44
43 private: 45 private:
44 explicit OffscreenCanvas(const IntSize&); 46 explicit OffscreenCanvas(const IntSize&);
45 47
46 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 48 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>;
47 static ContextFactoryVector& renderingContextFactories(); 49 static ContextFactoryVector& renderingContextFactories();
48 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 50 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
49 51
50 Member<CanvasRenderingContext> m_context; 52 Member<CanvasRenderingContext> m_context;
51 WeakMember<HTMLCanvasElement> m_canvas; 53 WeakMember<HTMLCanvasElement> m_canvas;
52 IntSize m_size; 54 IntSize m_size;
53 }; 55 };
54 56
55 } // namespace blink 57 } // namespace blink
56 58
57 #endif // OffscreenCanvas_h 59 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698