| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC
ontextFactory>); | 47 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC
ontextFactory>); |
| 48 | 48 |
| 49 bool originClean() const; | 49 bool originClean() const; |
| 50 void setOriginTainted() { m_originClean = false; } | 50 void setOriginTainted() { m_originClean = false; } |
| 51 // TODO(crbug.com/630356): apply the flag to WebGL context as well | 51 // TODO(crbug.com/630356): apply the flag to WebGL context as well |
| 52 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true;
} | 52 void setDisableReadingFromCanvasTrue() { m_disableReadingFromCanvas = true;
} |
| 53 | 53 |
| 54 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher(); | 54 OffscreenCanvasFrameDispatcher* getOrCreateFrameDispatcher(); |
| 55 | 55 |
| 56 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonce) | 56 void setSurfaceId(uint32_t clientId, uint32_t localId, uint64_t nonceHigh, u
int64_t nonceLow) |
| 57 { | 57 { |
| 58 m_clientId = clientId; | 58 m_clientId = clientId; |
| 59 m_localId = localId; | 59 m_localId = localId; |
| 60 m_nonce = nonce; | 60 m_nonceHigh = nonceHigh; |
| 61 m_nonceLow = nonceLow; |
| 61 } | 62 } |
| 62 uint32_t clientId() const { return m_clientId; } | 63 uint32_t clientId() const { return m_clientId; } |
| 63 uint32_t localId() const { return m_localId; } | 64 uint32_t localId() const { return m_localId; } |
| 64 uint64_t nonce() const { return m_nonce; } | 65 uint64_t nonceHigh() const { return m_nonceHigh; } |
| 66 uint64_t nonceLow() const { return m_nonceLow; } |
| 65 | 67 |
| 66 // CanvasImageSource implementation | 68 // CanvasImageSource implementation |
| 67 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const final; | 69 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const final; |
| 68 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean;
} | 70 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean;
} |
| 69 bool isOffscreenCanvas() const final { return true; } | 71 bool isOffscreenCanvas() const final { return true; } |
| 70 FloatSize elementSize(const FloatSize& defaultObjectSize) const final { retu
rn FloatSize(width(), height()); } | 72 FloatSize elementSize(const FloatSize& defaultObjectSize) const final { retu
rn FloatSize(width(), height()); } |
| 71 bool isOpaque() const final; | 73 bool isOpaque() const final; |
| 72 bool isAccelerated() const final; | 74 bool isAccelerated() const final; |
| 73 int sourceWidth() final { return width(); } | 75 int sourceWidth() final { return width(); } |
| 74 int sourceHeight() final { return height(); } | 76 int sourceHeight() final { return height(); } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 | 94 |
| 93 bool isPaintable() const; | 95 bool isPaintable() const; |
| 94 | 96 |
| 95 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; | 97 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; |
| 96 // cc::SurfaceId is broken into three integer components as this can be used | 98 // cc::SurfaceId is broken into three integer components as this can be used |
| 97 // in transfer of OffscreenCanvas across threads | 99 // in transfer of OffscreenCanvas across threads |
| 98 // If this object is not created via HTMLCanvasElement.transferControlToOffs
creen(), | 100 // If this object is not created via HTMLCanvasElement.transferControlToOffs
creen(), |
| 99 // then the following members would remain as initialized zero values. | 101 // then the following members would remain as initialized zero values. |
| 100 uint32_t m_clientId = 0; | 102 uint32_t m_clientId = 0; |
| 101 uint32_t m_localId = 0; | 103 uint32_t m_localId = 0; |
| 102 uint64_t m_nonce = 0; | 104 uint64_t m_nonceHigh = 0; |
| 105 uint64_t m_nonceLow = 0; |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 } // namespace blink | 108 } // namespace blink |
| 106 | 109 |
| 107 #endif // OffscreenCanvas_h | 110 #endif // OffscreenCanvas_h |
| OLD | NEW |