| 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 #include "core/offscreencanvas/OffscreenCanvas.h" | 5 #include "core/offscreencanvas/OffscreenCanvas.h" |
| 6 | 6 |
| 7 #include "core/dom/ExceptionCode.h" | 7 #include "core/dom/ExceptionCode.h" |
| 8 #include "core/fileapi/Blob.h" | 8 #include "core/fileapi/Blob.h" |
| 9 #include "core/html/ImageData.h" | 9 #include "core/html/ImageData.h" |
| 10 #include "core/html/canvas/CanvasAsyncBlobCreator.h" | 10 #include "core/html/canvas/CanvasAsyncBlobCreator.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 bool OffscreenCanvas::isAccelerated() const { | 181 bool OffscreenCanvas::isAccelerated() const { |
| 182 return m_context && m_context->isAccelerated(); | 182 return m_context && m_context->isAccelerated(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() { | 185 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() { |
| 186 if (!m_frameDispatcher) { | 186 if (!m_frameDispatcher) { |
| 187 // The frame dispatcher connects the current thread of OffscreenCanvas | 187 // The frame dispatcher connects the current thread of OffscreenCanvas |
| 188 // (either main or worker) to the browser process and remains unchanged | 188 // (either main or worker) to the browser process and remains unchanged |
| 189 // throughout the lifetime of this OffscreenCanvas. | 189 // throughout the lifetime of this OffscreenCanvas. |
| 190 m_frameDispatcher = WTF::wrapUnique(new OffscreenCanvasFrameDispatcherImpl( | 190 m_frameDispatcher = WTF::wrapUnique(new OffscreenCanvasFrameDispatcherImpl( |
| 191 m_clientId, m_sinkId, m_localId, m_nonceHigh, m_nonceLow, | 191 m_clientId, m_sinkId, m_placeholderCanvasId, m_size.width(), |
| 192 m_placeholderCanvasId, m_size.width(), m_size.height())); | 192 m_size.height())); |
| 193 } | 193 } |
| 194 return m_frameDispatcher.get(); | 194 return m_frameDispatcher.get(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 ScriptPromise OffscreenCanvas::convertToBlob(ScriptState* scriptState, | 197 ScriptPromise OffscreenCanvas::convertToBlob(ScriptState* scriptState, |
| 198 const ImageEncodeOptions& options, | 198 const ImageEncodeOptions& options, |
| 199 ExceptionState& exceptionState) { | 199 ExceptionState& exceptionState) { |
| 200 if (this->isNeutered()) { | 200 if (this->isNeutered()) { |
| 201 exceptionState.throwDOMException(InvalidStateError, | 201 exceptionState.throwDOMException(InvalidStateError, |
| 202 "OffscreenCanvas object is detached."); | 202 "OffscreenCanvas object is detached."); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 return resolver->promise(); | 243 return resolver->promise(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 DEFINE_TRACE(OffscreenCanvas) { | 246 DEFINE_TRACE(OffscreenCanvas) { |
| 247 visitor->trace(m_context); | 247 visitor->trace(m_context); |
| 248 visitor->trace(m_executionContext); | 248 visitor->trace(m_executionContext); |
| 249 EventTargetWithInlineData::trace(visitor); | 249 EventTargetWithInlineData::trace(visitor); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |