Title: [185396] trunk/Source/WebCore
- Revision
- 185396
- Author
- [email protected]
- Date
- 2015-06-09 17:46:51 -0700 (Tue, 09 Jun 2015)
Log Message
GraphicsContext state stack wasting lots of memory when empty.
<https://webkit.org/b/145817>
Reviewed by Geoffrey Garen.
Give the GraphicsContextState stack an inline capacity of 1, and make sure
to free any heap-allocated backing store when the stack goes empty.
The 1 is because HTMLCanvasElement keeps one "save" on the underlying
GraphicsContext at all times, and this prevents those canvases from always
sitting on an empty stack with 16 capacity.
This saves ~520 kB on cnet.com video pages.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::restore):
* platform/graphics/GraphicsContext.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185395 => 185396)
--- trunk/Source/WebCore/ChangeLog 2015-06-10 00:45:58 UTC (rev 185395)
+++ trunk/Source/WebCore/ChangeLog 2015-06-10 00:46:51 UTC (rev 185396)
@@ -1,3 +1,23 @@
+2015-06-09 Andreas Kling <[email protected]>
+
+ GraphicsContext state stack wasting lots of memory when empty.
+ <https://webkit.org/b/145817>
+
+ Reviewed by Geoffrey Garen.
+
+ Give the GraphicsContextState stack an inline capacity of 1, and make sure
+ to free any heap-allocated backing store when the stack goes empty.
+
+ The 1 is because HTMLCanvasElement keeps one "save" on the underlying
+ GraphicsContext at all times, and this prevents those canvases from always
+ sitting on an empty stack with 16 capacity.
+
+ This saves ~520 kB on cnet.com video pages.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::restore):
+ * platform/graphics/GraphicsContext.h:
+
2015-06-09 Said Abou-Hallawa <[email protected]>
SVG Fragment is not rendered if it is the css background image of an HTML element
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (185395 => 185396)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2015-06-10 00:45:58 UTC (rev 185395)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2015-06-10 00:46:51 UTC (rev 185396)
@@ -134,6 +134,11 @@
m_state = m_stack.last();
m_stack.removeLast();
+ // Make sure we deallocate the state stack buffer when it goes empty.
+ // Canvas elements will immediately save() again, but that goes into inline capacity.
+ if (m_stack.isEmpty())
+ m_stack.clear();
+
restorePlatformState();
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (185395 => 185396)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-06-10 00:45:58 UTC (rev 185395)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-06-10 00:46:51 UTC (rev 185396)
@@ -559,7 +559,7 @@
GraphicsContextPlatformPrivate* m_data;
GraphicsContextState m_state;
- Vector<GraphicsContextState> m_stack;
+ Vector<GraphicsContextState, 1> m_stack;
bool m_updatingControlTints;
unsigned m_transparencyCount;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes