Title: [126787] trunk/Source
- Revision
- 126787
- Author
- [email protected]
- Date
- 2012-08-27 13:20:52 -0700 (Mon, 27 Aug 2012)
Log Message
[Chromium] Fixing infinite recursion in Canvas2DLayerManager
https://bugs.webkit.org/show_bug.cgi?id=95110
Patch by Justin Novosad <[email protected]> on 2012-08-27
Reviewed by Stephen White.
Source/WebCore:
Fixed infinite recursion by not reporting a change in memory allocation
when Canvas2DLayerBridge::freeMemoryIfPossible fails to free memory.
Also modified Canvas2DLayerManager::layerAllocatedStorageChanged to
only initiate a memory eviction pass if memory consumption has
increased.
Test: webkit_unit_tests Canvas2DLayerManagerTest*
* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::freeMemoryIfPossible):
* platform/graphics/chromium/Canvas2DLayerManager.cpp:
(WebCore::Canvas2DLayerManager::layerAllocatedStorageChanged):
Source/WebKit/chromium:
Breaking recursion cycle by not reporting a change in memory allocation
when no memory is freed in FakeCanvas2DLayer::freeMemoryIfPossible.
* tests/Canvas2DLayerManagerTest.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126786 => 126787)
--- trunk/Source/WebCore/ChangeLog 2012-08-27 20:12:39 UTC (rev 126786)
+++ trunk/Source/WebCore/ChangeLog 2012-08-27 20:20:52 UTC (rev 126787)
@@ -1,3 +1,23 @@
+2012-08-27 Justin Novosad <[email protected]>
+
+ [Chromium] Fixing infinite recursion in Canvas2DLayerManager
+ https://bugs.webkit.org/show_bug.cgi?id=95110
+
+ Reviewed by Stephen White.
+
+ Fixed infinite recursion by not reporting a change in memory allocation
+ when Canvas2DLayerBridge::freeMemoryIfPossible fails to free memory.
+ Also modified Canvas2DLayerManager::layerAllocatedStorageChanged to
+ only initiate a memory eviction pass if memory consumption has
+ increased.
+
+ Test: webkit_unit_tests Canvas2DLayerManagerTest*
+
+ * platform/graphics/chromium/Canvas2DLayerBridge.cpp:
+ (WebCore::Canvas2DLayerBridge::freeMemoryIfPossible):
+ * platform/graphics/chromium/Canvas2DLayerManager.cpp:
+ (WebCore::Canvas2DLayerManager::layerAllocatedStorageChanged):
+
2012-08-27 Anna Cavender <[email protected]>
TextTrack modes are strings
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp (126786 => 126787)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-08-27 20:12:39 UTC (rev 126786)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp 2012-08-27 20:20:52 UTC (rev 126787)
@@ -123,7 +123,8 @@
{
ASSERT(deferredCanvas());
size_t bytesFreed = deferredCanvas()->freeMemoryIfPossible(bytesToFree);
- Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed));
+ if (bytesFreed)
+ Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed));
m_bytesAllocated -= bytesFreed;
return bytesFreed;
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp (126786 => 126787)
--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp 2012-08-27 20:12:39 UTC (rev 126786)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp 2012-08-27 20:20:52 UTC (rev 126787)
@@ -88,7 +88,8 @@
ASSERT((intptr_t)m_bytesAllocated + deltaBytes >= 0);
m_bytesAllocated = (intptr_t)m_bytesAllocated + deltaBytes;
}
- freeMemoryIfNecessary();
+ if (deltaBytes > 0)
+ freeMemoryIfNecessary();
}
void Canvas2DLayerManager::layerToBeDestroyed(Canvas2DLayerBridge* layer)
Modified: trunk/Source/WebKit/chromium/ChangeLog (126786 => 126787)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-27 20:12:39 UTC (rev 126786)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-27 20:20:52 UTC (rev 126787)
@@ -1,5 +1,17 @@
2012-08-27 Justin Novosad <[email protected]>
+ [Chromium] Fixing infinite recursion in Canvas2DLayerManager
+ https://bugs.webkit.org/show_bug.cgi?id=95110
+
+ Reviewed by Stephen White.
+
+ Breaking recursion cycle by not reporting a change in memory allocation
+ when no memory is freed in FakeCanvas2DLayer::freeMemoryIfPossible.
+
+ * tests/Canvas2DLayerManagerTest.cpp:
+
+2012-08-27 Justin Novosad <[email protected]>
+
[Chromium] Implementing a global limit on memory consumed by deferred 2D canvases
https://bugs.webkit.org/show_bug.cgi?id=94386
Modified: trunk/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp (126786 => 126787)
--- trunk/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp 2012-08-27 20:12:39 UTC (rev 126786)
+++ trunk/Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp 2012-08-27 20:20:52 UTC (rev 126787)
@@ -57,7 +57,8 @@
m_freeMemoryIfPossibleCount++;
size_t bytesFreed = size < m_freeableBytes ? size : m_freeableBytes;
m_freeableBytes -= bytesFreed;
- Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed));
+ if (bytesFreed)
+ Canvas2DLayerManager::get().layerAllocatedStorageChanged(this, -((intptr_t)bytesFreed));
m_bytesAllocated -= bytesFreed;
return bytesFreed;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes