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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 bool OffscreenCanvas::isPaintable() const | 139 bool OffscreenCanvas::isPaintable() const |
140 { | 140 { |
141 if (!m_context) | 141 if (!m_context) |
142 return ImageBuffer::canCreateImageBuffer(m_size); | 142 return ImageBuffer::canCreateImageBuffer(m_size); |
143 return m_context->isPaintable(); | 143 return m_context->isPaintable(); |
144 } | 144 } |
145 | 145 |
146 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() | 146 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() |
147 { | 147 { |
148 if (!m_frameDispatcher) | 148 if (!m_frameDispatcher) { |
| 149 // The frame dispatcher connects the current thread of OffscreenCanvas |
| 150 // (either main or worker) to the browser process and remains unchanged |
| 151 // throughout the lifetime of this OffscreenCanvas. |
149 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_
clientId, m_localId, m_nonce, width(), height())); | 152 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_
clientId, m_localId, m_nonce, width(), height())); |
| 153 } |
150 return m_frameDispatcher.get(); | 154 return m_frameDispatcher.get(); |
151 } | 155 } |
152 | 156 |
153 DEFINE_TRACE(OffscreenCanvas) | 157 DEFINE_TRACE(OffscreenCanvas) |
154 { | 158 { |
155 visitor->trace(m_context); | 159 visitor->trace(m_context); |
156 } | 160 } |
157 | 161 |
158 } // namespace blink | 162 } // namespace blink |
OLD | NEW |