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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 910613003: Trigger hardware accelerated canvas GC more aggressively. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Better comment Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index a4dcc991917028029c9db75fa8c1f25d658ebfdc..5cde15c4cb5e09bef600a3cc5bec45a7cf707317 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -694,11 +694,20 @@ void HTMLCanvasElement::trace(Visitor* visitor)
void HTMLCanvasElement::updateExternallyAllocatedMemory() const
{
int bufferCount = 0;
- if (m_imageBuffer)
+ if (m_imageBuffer) {
bufferCount++;
+ if (m_imageBuffer->isAccelerated()) {
+ // The number of internal GPU buffers vary between one (stable
+ // non-displayed state) and three (triple-buffered animations).
+ // Adding 2 is a pessimistic but relevant estimate.
+ // Note: These buffers might be allocated in GPU memory.
+ bufferCount += 2;
+ }
+ }
if (m_copiedImage)
bufferCount++;
+ // Four bytes per pixel per buffer.
Checked<intptr_t, RecordOverflow> checkedExternallyAllocatedMemory = 4 * bufferCount;
if (is3D())
checkedExternallyAllocatedMemory += toWebGLRenderingContext(m_context.get())->externallyAllocatedBytesPerPixel();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698