| OLD | NEW |
| 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 #include <memory> | |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 | 16 |
| 18 class CanvasContextCreationAttributes; | 17 class CanvasContextCreationAttributes; |
| 19 class ImageBitmap; | 18 class ImageBitmap; |
| 20 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC
ontext; | 19 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC
ontext; |
| 21 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin
gContext OffscreenRenderingContext; | 20 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin
gContext OffscreenRenderingContext; |
| 22 | 21 |
| 23 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva
s>, public ScriptWrappable { | 22 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva
s>, public ScriptWrappable { |
| 24 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 ImageBitmap* transferToImageBitmap(ExceptionState&); | 34 ImageBitmap* transferToImageBitmap(ExceptionState&); |
| 36 | 35 |
| 37 IntSize size() const { return m_size; } | 36 IntSize size() const { return m_size; } |
| 38 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; } | 37 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; } |
| 39 int getAssociatedCanvasId() const { return m_canvasId; } | 38 int getAssociatedCanvasId() const { return m_canvasId; } |
| 40 bool isNeutered() const { return m_isNeutered; } | 39 bool isNeutered() const { return m_isNeutered; } |
| 41 void setNeutered(); | 40 void setNeutered(); |
| 42 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String
&, const CanvasContextCreationAttributes&); | 41 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String
&, const CanvasContextCreationAttributes&); |
| 43 CanvasRenderingContext* renderingContext() { return m_context; } | 42 CanvasRenderingContext* renderingContext() { return m_context; } |
| 44 | 43 |
| 45 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC
ontextFactory>); | 44 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex
tFactory>); |
| 46 | 45 |
| 47 bool originClean() const; | 46 bool originClean() const; |
| 48 void setOriginTainted() { m_originClean = false; } | 47 void setOriginTainted() { m_originClean = false; } |
| 49 | 48 |
| 50 DECLARE_VIRTUAL_TRACE(); | 49 DECLARE_VIRTUAL_TRACE(); |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 explicit OffscreenCanvas(const IntSize&); | 52 explicit OffscreenCanvas(const IntSize&); |
| 54 | 53 |
| 55 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa
ctory>>; | 54 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; |
| 56 static ContextFactoryVector& renderingContextFactories(); | 55 static ContextFactoryVector& renderingContextFactories(); |
| 57 static CanvasRenderingContextFactory* getRenderingContextFactory(int); | 56 static CanvasRenderingContextFactory* getRenderingContextFactory(int); |
| 58 | 57 |
| 59 Member<CanvasRenderingContext> m_context; | 58 Member<CanvasRenderingContext> m_context; |
| 60 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as
sociated canvas element. | 59 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as
sociated canvas element. |
| 61 IntSize m_size; | 60 IntSize m_size; |
| 62 bool m_isNeutered = false; | 61 bool m_isNeutered = false; |
| 63 | 62 |
| 64 bool m_originClean; | 63 bool m_originClean; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace blink | 66 } // namespace blink |
| 68 | 67 |
| 69 #endif // OffscreenCanvas_h | 68 #endif // OffscreenCanvas_h |
| OLD | NEW |