Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 2539333003: Fix crash when calling convertToBlob on an OffscreenCanvas with no pixels (Closed)
Patch Set: remove tab characters Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 renderingContextFactories()[type] = std::move(renderingContextFactory); 165 renderingContextFactories()[type] = std::move(renderingContextFactory);
166 } 166 }
167 167
168 bool OffscreenCanvas::originClean() const { 168 bool OffscreenCanvas::originClean() const {
169 return m_originClean && !m_disableReadingFromCanvas; 169 return m_originClean && !m_disableReadingFromCanvas;
170 } 170 }
171 171
172 bool OffscreenCanvas::isPaintable() const { 172 bool OffscreenCanvas::isPaintable() const {
173 if (!m_context) 173 if (!m_context)
174 return ImageBuffer::canCreateImageBuffer(m_size); 174 return ImageBuffer::canCreateImageBuffer(m_size);
175 return m_context->isPaintable(); 175 return m_context->isPaintable() && m_size.width() && m_size.height();
176 } 176 }
177 177
178 bool OffscreenCanvas::isAccelerated() const { 178 bool OffscreenCanvas::isAccelerated() const {
179 return m_context && m_context->isAccelerated(); 179 return m_context && m_context->isAccelerated();
180 } 180 }
181 181
182 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() { 182 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() {
183 if (!m_frameDispatcher) { 183 if (!m_frameDispatcher) {
184 // The frame dispatcher connects the current thread of OffscreenCanvas 184 // The frame dispatcher connects the current thread of OffscreenCanvas
185 // (either main or worker) to the browser process and remains unchanged 185 // (either main or worker) to the browser process and remains unchanged
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return resolver->promise(); 240 return resolver->promise();
241 } 241 }
242 242
243 DEFINE_TRACE(OffscreenCanvas) { 243 DEFINE_TRACE(OffscreenCanvas) {
244 visitor->trace(m_context); 244 visitor->trace(m_context);
245 visitor->trace(m_executionContext); 245 visitor->trace(m_executionContext);
246 EventTargetWithInlineData::trace(visitor); 246 EventTargetWithInlineData::trace(visitor);
247 } 247 }
248 248
249 } // namespace blink 249 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698