Chromium Code Reviews| 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" |
| 11 #include "platform/graphics/ImageBuffer.h" | 11 #include "platform/graphics/ImageBuffer.h" |
| 12 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" | |
| 12 #include "wtf/MathExtras.h" | 13 #include "wtf/MathExtras.h" |
| 14 #include "wtf/PtrUtil.h" | |
| 13 #include <memory> | 15 #include <memory> |
| 14 | 16 |
| 15 namespace blink { | 17 namespace blink { |
| 16 | 18 |
| 17 OffscreenCanvas::OffscreenCanvas(const IntSize& size) | 19 OffscreenCanvas::OffscreenCanvas(const IntSize& size) |
| 18 : m_size(size) | 20 : m_size(size) |
| 19 , m_originClean(true) | 21 , m_originClean(true) |
| 20 { | 22 { |
| 21 } | 23 } |
| 22 | 24 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 return m_originClean && !m_disableReadingFromCanvas; | 129 return m_originClean && !m_disableReadingFromCanvas; |
| 128 } | 130 } |
| 129 | 131 |
| 130 bool OffscreenCanvas::isPaintable() const | 132 bool OffscreenCanvas::isPaintable() const |
| 131 { | 133 { |
| 132 if (!m_context) | 134 if (!m_context) |
| 133 return ImageBuffer::canCreateImageBuffer(m_size); | 135 return ImageBuffer::canCreateImageBuffer(m_size); |
| 134 return m_context->isPaintable(); | 136 return m_context->isPaintable(); |
| 135 } | 137 } |
| 136 | 138 |
| 139 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() | |
| 140 { | |
| 141 if (!m_frameDispatcher) | |
| 142 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce)); | |
|
danakj
2016/09/02 19:12:42
why isn't this created when OffscreenCanvas is con
xlai (Olivia)
2016/09/02 20:10:06
The FrameDispatcher is needed only when user inten
danakj
2016/09/02 21:51:00
Oops I mean to change this comment but it got lost
danakj
2016/09/02 21:53:50
Though also from https://cs.chromium.org/chromium/
xlai (Olivia)
2016/09/02 23:41:28
The code link you've given happens when OffscreenC
danakj
2016/09/03 00:40:42
I see. I guess I mostly find it a bit confusing th
| |
| 143 return m_frameDispatcher.get(); | |
| 144 } | |
| 145 | |
| 137 DEFINE_TRACE(OffscreenCanvas) | 146 DEFINE_TRACE(OffscreenCanvas) |
| 138 { | 147 { |
| 139 visitor->trace(m_context); | 148 visitor->trace(m_context); |
| 140 } | 149 } |
| 141 | 150 |
| 142 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |