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

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

Issue 1748163003: Add rendering context and rendering 2D context to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with master and fix merge conflicts 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 "core/CoreExport.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 CORE_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Offsc reenCanvas>, public ScriptWrappable { 17 class CanvasContextCreationAttributes;
18 class OffscreenCanvasRenderingContext;
19 class OffscreenCanvasRenderingContextFactory;
20
21 class MODULES_EXPORT OffscreenCanvas final : public GarbageCollectedFinalized<Of fscreenCanvas>, public ScriptWrappable {
18 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
19 public: 23 public:
20 static OffscreenCanvas* create(unsigned width, unsigned height); 24 static OffscreenCanvas* create(unsigned width, unsigned height);
25 ~OffscreenCanvas() {}
21 26
22 IntSize size() const { return m_size; } 27 IntSize size() const { return m_size; }
23 unsigned width() const { return m_size.width(); } 28 unsigned width() const { return m_size.width(); }
24 unsigned height() const { return m_size.height(); } 29 unsigned height() const { return m_size.height(); }
25
26 void setWidth(unsigned); 30 void setWidth(unsigned);
27 void setHeight(unsigned); 31 void setHeight(unsigned);
28 32
33 OffscreenCanvasRenderingContext* getContext(const String&, const CanvasConte xtCreationAttributes&);
Justin Novosad 2016/03/07 15:30:26 Until the day we actually use a union, this should
34 OffscreenCanvasRenderingContext* renderingContext() const { return m_context .get(); }
Justin Novosad 2016/03/07 15:30:26 Same here.
35
36 static void registerRenderingContextFactory(PassOwnPtr<OffscreenCanvasRender ingContextFactory>);
37
29 DECLARE_VIRTUAL_TRACE(); 38 DECLARE_VIRTUAL_TRACE();
30 39
31 private: 40 private:
32 OffscreenCanvas(const IntSize&); 41 OffscreenCanvas(const IntSize&);
33 42
43 using ContextFactoryVector = Vector<OwnPtr<OffscreenCanvasRenderingContextFa ctory>>;
44 static ContextFactoryVector& renderingContextFactories();
45 static OffscreenCanvasRenderingContextFactory* getRenderingContextFactory(in t);
46
47 Member<OffscreenCanvasRenderingContext> m_context;
34 IntSize m_size; 48 IntSize m_size;
35 }; 49 };
36 50
37 } // namespace blink 51 } // namespace blink
38 52
39 #endif // OffscreenCanvas_h 53 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698