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

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

Issue 2362363002: Cancel GPU acceleration for 2D canvas when drawing very large images (Closed)
Patch Set: Created 4 years, 3 months 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
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/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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return m_originClean && !m_disableReadingFromCanvas; 149 return m_originClean && !m_disableReadingFromCanvas;
150 } 150 }
151 151
152 bool OffscreenCanvas::isPaintable() const 152 bool OffscreenCanvas::isPaintable() const
153 { 153 {
154 if (!m_context) 154 if (!m_context)
155 return ImageBuffer::canCreateImageBuffer(m_size); 155 return ImageBuffer::canCreateImageBuffer(m_size);
156 return m_context->isPaintable(); 156 return m_context->isPaintable();
157 } 157 }
158 158
159 bool OffscreenCanvas::isAccelerated() const
160 {
161 return m_context && m_context->isAccelerated();
xlai (Olivia) 2016/09/23 20:48:04 Just want to let you know that in my previous patc
162 }
163
159 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() 164 OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher()
160 { 165 {
161 if (!m_frameDispatcher) { 166 if (!m_frameDispatcher) {
162 // The frame dispatcher connects the current thread of OffscreenCanvas 167 // The frame dispatcher connects the current thread of OffscreenCanvas
163 // (either main or worker) to the browser process and remains unchanged 168 // (either main or worker) to the browser process and remains unchanged
164 // throughout the lifetime of this OffscreenCanvas. 169 // throughout the lifetime of this OffscreenCanvas.
165 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce, width(), height())); 170 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce, width(), height()));
166 } 171 }
167 return m_frameDispatcher.get(); 172 return m_frameDispatcher.get();
168 } 173 }
169 174
170 DEFINE_TRACE(OffscreenCanvas) 175 DEFINE_TRACE(OffscreenCanvas)
171 { 176 {
172 visitor->trace(m_context); 177 visitor->trace(m_context);
173 } 178 }
174 179
175 } // namespace blink 180 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698