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

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

Issue 1928043002: Add drawImage() originClean() getSecurityOrigin() to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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; 19 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC ontext;
20 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin gContext OffscreenRenderingContext; 20 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin gContext OffscreenRenderingContext;
21 21
22 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva s>, public ScriptWrappable { 22 class CORE_EXPORT OffscreenCanvas final : public GarbageCollected<OffscreenCanva s>, public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
24 public: 24 public:
25 static OffscreenCanvas* create(unsigned width, unsigned height); 25 static OffscreenCanvas* create(ExecutionContext*, unsigned width, unsigned h eight);
26 26
27 // IDL attributes 27 // IDL attributes
28 unsigned width() const { return m_size.width(); } 28 unsigned width() const { return m_size.width(); }
29 unsigned height() const { return m_size.height(); } 29 unsigned height() const { return m_size.height(); }
30 void setWidth(unsigned); 30 void setWidth(unsigned);
31 void setHeight(unsigned); 31 void setHeight(unsigned);
32 32
33 // API Methods 33 // API Methods
34 ImageBitmap* transferToImageBitmap(ExceptionState&); 34 ImageBitmap* transferToImageBitmap(ExceptionState&);
35 35
36 IntSize size() const { return m_size; } 36 IntSize size() const { return m_size; }
37 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; } 37 void setAssociatedCanvasId(int canvasId) { m_canvasId = canvasId; }
38 int getAssociatedCanvasId() const { return m_canvasId; } 38 int getAssociatedCanvasId() const { return m_canvasId; }
39 bool isNeutered() const { return m_isNeutered; } 39 bool isNeutered() const { return m_isNeutered; }
40 void setNeutered(); 40 void setNeutered();
41 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&); 41 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String &, const CanvasContextCreationAttributes&);
42 CanvasRenderingContext* renderingContext() { return m_context; } 42 CanvasRenderingContext* renderingContext() { return m_context; }
43 43
44 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); 44 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>);
45 45
46 SecurityOrigin* getSecurityOrigin() const;
47 bool originClean() const;
48 void setOriginTainted() { m_originClean = false; }
49
50 ExecutionContext* getExecutionContext() const { return m_executionContext; }
51
46 DECLARE_VIRTUAL_TRACE(); 52 DECLARE_VIRTUAL_TRACE();
47 53
48 private: 54 private:
49 explicit OffscreenCanvas(const IntSize&); 55 explicit OffscreenCanvas(ExecutionContext*, const IntSize&);
50 56
51 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 57 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>;
52 static ContextFactoryVector& renderingContextFactories(); 58 static ContextFactoryVector& renderingContextFactories();
53 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 59 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
54 60
55 Member<CanvasRenderingContext> m_context; 61 Member<CanvasRenderingContext> m_context;
62 Member<ExecutionContext> m_executionContext;
56 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element. 63 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as sociated canvas element.
57 IntSize m_size; 64 IntSize m_size;
58 bool m_isNeutered = false; 65 bool m_isNeutered = false;
66
67 bool m_originClean;
59 }; 68 };
60 69
61 } // namespace blink 70 } // namespace blink
62 71
63 #endif // OffscreenCanvas_h 72 #endif // OffscreenCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698