| 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 "core/html/canvas/CanvasImageSource.h" | 12 #include "core/html/canvas/CanvasImageSource.h" |
| 13 #include "platform/geometry/IntSize.h" | 13 #include "platform/geometry/IntSize.h" |
| 14 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" | |
| 15 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 16 #include <memory> | 15 #include <memory> |
| 17 | 16 |
| 18 namespace blink { | 17 namespace blink { |
| 19 | 18 |
| 20 class CanvasContextCreationAttributes; | 19 class CanvasContextCreationAttributes; |
| 21 class ImageBitmap; | 20 class ImageBitmap; |
| 22 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC
ontext; | 21 class OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingC
ontext; |
| 23 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin
gContext OffscreenRenderingContext; | 22 typedef OffscreenCanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2Renderin
gContext OffscreenRenderingContext; |
| 24 | 23 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String
&, const CanvasContextCreationAttributes&); | 43 CanvasRenderingContext* getCanvasRenderingContext(ScriptState*, const String
&, const CanvasContextCreationAttributes&); |
| 45 CanvasRenderingContext* renderingContext() { return m_context; } | 44 CanvasRenderingContext* renderingContext() { return m_context; } |
| 46 | 45 |
| 47 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC
ontextFactory>); | 46 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC
ontextFactory>); |
| 48 | 47 |
| 49 bool originClean() const; | 48 bool originClean() const; |
| 50 void setOriginTainted() { m_originClean = false; } | 49 void setOriginTainted() { m_originClean = false; } |
| 51 // TODO(crbug.com/630356): apply the flag to WebGL context as well | 50 // TODO(crbug.com/630356): apply the flag to WebGL context as well |
| 52 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true;
} | 51 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true;
} |
| 53 | 52 |
| 54 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher(); | |
| 55 | |
| 56 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce) | 53 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce) |
| 57 { | 54 { |
| 58 m_clientId = clientId; | 55 m_clientId = clientId; |
| 59 m_localId = localId; | 56 m_localId = localId; |
| 60 m_nonce = nonce; | 57 m_nonce = nonce; |
| 61 } | 58 } |
| 62 uint32_t clientId() const { return m_clientId; } | 59 uint32_t clientId() const { return m_clientId; } |
| 63 uint32_t localId() const { return m_localId; } | 60 uint32_t localId() const { return m_localId; } |
| 64 uint64_t nonce() const { return m_nonce; } | 61 uint64_t nonce() const { return m_nonce; } |
| 65 | 62 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 Member<CanvasRenderingContext> m_context; | 81 Member<CanvasRenderingContext> m_context; |
| 85 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as
sociated canvas element. | 82 int m_canvasId = -1; // DOMNodeIds starts from 0, using -1 to indicate no as
sociated canvas element. |
| 86 IntSize m_size; | 83 IntSize m_size; |
| 87 bool m_isNeutered = false; | 84 bool m_isNeutered = false; |
| 88 | 85 |
| 89 bool m_originClean; | 86 bool m_originClean; |
| 90 bool m_disableReadingFromCanvas = false; | 87 bool m_disableReadingFromCanvas = false; |
| 91 | 88 |
| 92 bool isPaintable() const; | 89 bool isPaintable() const; |
| 93 | 90 |
| 94 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; | |
| 95 // cc::SurfaceId is broken into three integer components as this can be used | 91 // cc::SurfaceId is broken into three integer components as this can be used |
| 96 // in transfer of OffscreenCanvas across threads | 92 // in transfer of OffscreenCanvas across threads |
| 97 // If this object is not created via HTMLCanvasElement.transferControlToOffs
creen(), | 93 // If this object is not created via HTMLCanvasElement.transferControlToOffs
creen(), |
| 98 // then the following members would remain as initialized zero values. | 94 // then the following members would remain as initialized zero values. |
| 99 uint32_t m_clientId = 0; | 95 uint32_t m_clientId = 0; |
| 100 uint32_t m_localId = 0; | 96 uint32_t m_localId = 0; |
| 101 uint64_t m_nonce = 0; | 97 uint64_t m_nonce = 0; |
| 102 }; | 98 }; |
| 103 | 99 |
| 104 } // namespace blink | 100 } // namespace blink |
| 105 | 101 |
| 106 #endif // OffscreenCanvas_h | 102 #endif // OffscreenCanvas_h |
| OLD | NEW |