| 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static void registerRenderingContextFactory( | 56 static void registerRenderingContextFactory( |
| 57 std::unique_ptr<CanvasRenderingContextFactory>); | 57 std::unique_ptr<CanvasRenderingContextFactory>); |
| 58 | 58 |
| 59 bool originClean() const; | 59 bool originClean() const; |
| 60 void setOriginTainted() { m_originClean = false; } | 60 void setOriginTainted() { m_originClean = false; } |
| 61 // TODO(crbug.com/630356): apply the flag to WebGL context as well | 61 // TODO(crbug.com/630356): apply the flag to WebGL context as well |
| 62 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true; } | 62 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true; } |
| 63 | 63 |
| 64 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher(); | 64 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher(); |
| 65 | 65 |
| 66 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce) { | 66 void setSurfaceId(uint32_t clientId, |
| 67 uint32_t sinkId, |
| 68 uint32_t localId, |
| 69 uint64_t nonce) { |
| 67 m_clientId = clientId; | 70 m_clientId = clientId; |
| 71 m_sinkId = sinkId; |
| 68 m_localId = localId; | 72 m_localId = localId; |
| 69 m_nonce = nonce; | 73 m_nonce = nonce; |
| 70 } | 74 } |
| 71 uint32_t clientId() const { return m_clientId; } | 75 uint32_t clientId() const { return m_clientId; } |
| 76 uint32_t sinkId() const { return m_sinkId; } |
| 72 uint32_t localId() const { return m_localId; } | 77 uint32_t localId() const { return m_localId; } |
| 73 uint64_t nonce() const { return m_nonce; } | 78 uint64_t nonce() const { return m_nonce; } |
| 74 | 79 |
| 75 // CanvasImageSource implementation | 80 // CanvasImageSource implementation |
| 76 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, | 81 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, |
| 77 AccelerationHint, | 82 AccelerationHint, |
| 78 SnapshotReason, | 83 SnapshotReason, |
| 79 const FloatSize&) const final; | 84 const FloatSize&) const final; |
| 80 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean; } | 85 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean; } |
| 81 bool isOffscreenCanvas() const final { return true; } | 86 bool isOffscreenCanvas() const final { return true; } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 108 | 113 |
| 109 bool isPaintable() const; | 114 bool isPaintable() const; |
| 110 | 115 |
| 111 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; | 116 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; |
| 112 // cc::SurfaceId is broken into three integer components as this can be used | 117 // cc::SurfaceId is broken into three integer components as this can be used |
| 113 // in transfer of OffscreenCanvas across threads | 118 // in transfer of OffscreenCanvas across threads |
| 114 // If this object is not created via | 119 // If this object is not created via |
| 115 // HTMLCanvasElement.transferControlToOffscreen(), | 120 // HTMLCanvasElement.transferControlToOffscreen(), |
| 116 // then the following members would remain as initialized zero values. | 121 // then the following members would remain as initialized zero values. |
| 117 uint32_t m_clientId = 0; | 122 uint32_t m_clientId = 0; |
| 123 uint32_t m_sinkId = 0; |
| 118 uint32_t m_localId = 0; | 124 uint32_t m_localId = 0; |
| 119 uint64_t m_nonce = 0; | 125 uint64_t m_nonce = 0; |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 } // namespace blink | 128 } // namespace blink |
| 123 | 129 |
| 124 #endif // OffscreenCanvas_h | 130 #endif // OffscreenCanvas_h |
| OLD | NEW |