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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 66 void setSurfaceId(uint32_t clientId, |
67 uint32_t sinkId, | 67 uint32_t sinkId, |
68 uint32_t localId, | 68 uint32_t localId, |
69 uint64_t nonce) { | 69 uint64_t nonceHigh, |
| 70 uint64_t nonceLow) { |
70 m_clientId = clientId; | 71 m_clientId = clientId; |
71 m_sinkId = sinkId; | 72 m_sinkId = sinkId; |
72 m_localId = localId; | 73 m_localId = localId; |
73 m_nonce = nonce; | 74 m_nonceHigh = nonceHigh; |
| 75 m_nonceLow = nonceLow; |
74 } | 76 } |
75 uint32_t clientId() const { return m_clientId; } | 77 uint32_t clientId() const { return m_clientId; } |
76 uint32_t sinkId() const { return m_sinkId; } | 78 uint32_t sinkId() const { return m_sinkId; } |
77 uint32_t localId() const { return m_localId; } | 79 uint32_t localId() const { return m_localId; } |
78 uint64_t nonce() const { return m_nonce; } | 80 uint64_t nonceHigh() const { return m_nonceHigh; } |
| 81 uint64_t nonceLow() const { return m_nonceLow; } |
79 | 82 |
80 // CanvasImageSource implementation | 83 // CanvasImageSource implementation |
81 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, | 84 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, |
82 AccelerationHint, | 85 AccelerationHint, |
83 SnapshotReason, | 86 SnapshotReason, |
84 const FloatSize&) const final; | 87 const FloatSize&) const final; |
85 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean; } | 88 bool wouldTaintOrigin(SecurityOrigin*) const final { return !m_originClean; } |
86 bool isOffscreenCanvas() const final { return true; } | 89 bool isOffscreenCanvas() const final { return true; } |
87 FloatSize elementSize(const FloatSize& defaultObjectSize) const final { | 90 FloatSize elementSize(const FloatSize& defaultObjectSize) const final { |
88 return FloatSize(width(), height()); | 91 return FloatSize(width(), height()); |
(...skipping 26 matching lines...) Expand all Loading... |
115 | 118 |
116 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; | 119 std::unique_ptr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; |
117 // cc::SurfaceId is broken into three integer components as this can be used | 120 // cc::SurfaceId is broken into three integer components as this can be used |
118 // in transfer of OffscreenCanvas across threads | 121 // in transfer of OffscreenCanvas across threads |
119 // If this object is not created via | 122 // If this object is not created via |
120 // HTMLCanvasElement.transferControlToOffscreen(), | 123 // HTMLCanvasElement.transferControlToOffscreen(), |
121 // then the following members would remain as initialized zero values. | 124 // then the following members would remain as initialized zero values. |
122 uint32_t m_clientId = 0; | 125 uint32_t m_clientId = 0; |
123 uint32_t m_sinkId = 0; | 126 uint32_t m_sinkId = 0; |
124 uint32_t m_localId = 0; | 127 uint32_t m_localId = 0; |
125 uint64_t m_nonce = 0; | 128 uint64_t m_nonceHigh = 0; |
| 129 uint64_t m_nonceLow = 0; |
126 }; | 130 }; |
127 | 131 |
128 } // namespace blink | 132 } // namespace blink |
129 | 133 |
130 #endif // OffscreenCanvas_h | 134 #endif // OffscreenCanvas_h |
OLD | NEW |