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/html/canvas/CanvasContextCreationAttributes.h" | 8 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
9 #include "core/html/canvas/CanvasRenderingContext.h" | 9 #include "core/html/canvas/CanvasRenderingContext.h" |
10 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 10 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 InvalidStateError, | 64 InvalidStateError, |
65 "Cannot transfer an ImageBitmap from a detached OffscreenCanvas"); | 65 "Cannot transfer an ImageBitmap from a detached OffscreenCanvas"); |
66 return nullptr; | 66 return nullptr; |
67 } | 67 } |
68 if (!m_context) { | 68 if (!m_context) { |
69 exceptionState.throwDOMException(InvalidStateError, | 69 exceptionState.throwDOMException(InvalidStateError, |
70 "Cannot transfer an ImageBitmap from an " | 70 "Cannot transfer an ImageBitmap from an " |
71 "OffscreenCanvas with no context"); | 71 "OffscreenCanvas with no context"); |
72 return nullptr; | 72 return nullptr; |
73 } | 73 } |
74 ImageBitmap* image = m_context->transferToImageBitmap(exceptionState); | 74 ImageBitmap* image = m_context->transferToImageBitmap(); |
75 if (!image) { | 75 if (!image) { |
76 // Undocumented exception (not in spec) | 76 // Undocumented exception (not in spec) |
77 exceptionState.throwDOMException(V8Error, "Out of memory"); | 77 exceptionState.throwDOMException(V8Error, "Out of memory"); |
78 } | 78 } |
79 return image; | 79 return image; |
80 } | 80 } |
81 | 81 |
82 PassRefPtr<Image> OffscreenCanvas::getSourceImageForCanvas( | 82 PassRefPtr<Image> OffscreenCanvas::getSourceImageForCanvas( |
83 SourceImageStatus* status, | 83 SourceImageStatus* status, |
84 AccelerationHint hint, | 84 AccelerationHint hint, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 m_clientId, m_sinkId, m_localId, m_nonce, width(), height())); | 181 m_clientId, m_sinkId, m_localId, m_nonce, width(), height())); |
182 } | 182 } |
183 return m_frameDispatcher.get(); | 183 return m_frameDispatcher.get(); |
184 } | 184 } |
185 | 185 |
186 DEFINE_TRACE(OffscreenCanvas) { | 186 DEFINE_TRACE(OffscreenCanvas) { |
187 visitor->trace(m_context); | 187 visitor->trace(m_context); |
188 } | 188 } |
189 | 189 |
190 } // namespace blink | 190 } // namespace blink |
OLD | NEW |