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

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

Issue 1775153002: Make OffscreenCanvasRenderingContext2D renderable on a worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix non-oilpan build Created 4 years, 9 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 "modules/ModulesExport.h" 11 #include "modules/ModulesExport.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 OffscreenCanvasRenderingContext; 19 class OffscreenCanvasRenderingContext;
19 class OffscreenCanvasRenderingContext2D; 20 class OffscreenCanvasRenderingContext2D;
20 class OffscreenCanvasRenderingContextFactory; 21 class OffscreenCanvasRenderingContextFactory;
21 22
22 class MODULES_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Of fscreenCanvas>, public ScriptWrappable { 23 class MODULES_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Of fscreenCanvas>, public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO(); 24 DEFINE_WRAPPERTYPEINFO();
24 public: 25 public:
25 static OffscreenCanvas* create(unsigned width, unsigned height); 26 static OffscreenCanvas* create(unsigned width, unsigned height);
26 ~OffscreenCanvas() {} 27 ~OffscreenCanvas();
27 28
28 IntSize size() const { return m_size; } 29 // IDL attributes
29 unsigned width() const { return m_size.width(); } 30 unsigned width() const { return m_size.width(); }
30 unsigned height() const { return m_size.height(); } 31 unsigned height() const { return m_size.height(); }
31 void setWidth(unsigned); 32 void setWidth(unsigned);
32 void setHeight(unsigned); 33 void setHeight(unsigned);
33 34
35 // API Methods
34 OffscreenCanvasRenderingContext2D* getContext(const String&, const CanvasCon textCreationAttributes&); 36 OffscreenCanvasRenderingContext2D* getContext(const String&, const CanvasCon textCreationAttributes&);
37 PassRefPtrWillBeRawPtr<ImageBitmap> transferToImageBitmap(ExceptionState&);
38
39 IntSize size() const { return m_size; }
35 OffscreenCanvasRenderingContext2D* renderingContext() const; 40 OffscreenCanvasRenderingContext2D* renderingContext() const;
36 41
37 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>); 42 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>);
38 43
39 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
40 45
41 private: 46 private:
42 OffscreenCanvas(const IntSize&); 47 OffscreenCanvas(const IntSize&);
43 48
44 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>; 49 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>;
45 static ContextFactoryVector& renderingContextFactories(); 50 static ContextFactoryVector& renderingContextFactories();
46 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t); 51 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t);
47 52
48 Member<OffscreenCanvasRenderingContext> m_context; 53 Member<OffscreenCanvasRenderingContext> m_context;
49 IntSize m_size; 54 IntSize m_size;
50 }; 55 };
51 56
52 } // namespace blink 57 } // namespace blink
53 58
54 #endif // OffscreenCanvas_h 59 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698