Title: [160370] trunk/Source/WebCore
Revision
160370
Author
[email protected]
Date
2013-12-10 08:50:49 -0800 (Tue, 10 Dec 2013)

Log Message

Jettison all StyleResolver data on memory pressure.
<https://webkit.org/b/125498>

The StyleResolver can be rebuilt relatively quickly; we already
have an optimization that discards it some time after last use.

If we find ourseles under serious memory pressure, don't wait for
the timer to kick in, throw everything overboard right away.

~5MB progression post-pressure on Membuster3.

Reviewed by Anders Carlsson.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160369 => 160370)


--- trunk/Source/WebCore/ChangeLog	2013-12-10 16:47:49 UTC (rev 160369)
+++ trunk/Source/WebCore/ChangeLog	2013-12-10 16:50:49 UTC (rev 160370)
@@ -1,3 +1,18 @@
+2013-12-10  Andreas Kling  <[email protected]>
+
+        Jettison all StyleResolver data on memory pressure.
+        <https://webkit.org/b/125498>
+
+        The StyleResolver can be rebuilt relatively quickly; we already
+        have an optimization that discards it some time after last use.
+
+        If we find ourseles under serious memory pressure, don't wait for
+        the timer to kick in, throw everything overboard right away.
+
+        ~5MB progression post-pressure on Membuster3.
+
+        Reviewed by Anders Carlsson.
+
 2013-12-10  Martin Robinson  <[email protected]>
 
         [GTK] [CMake] Add support for building the DOM bindings

Modified: trunk/Source/WebCore/page/Page.cpp (160369 => 160370)


--- trunk/Source/WebCore/page/Page.cpp	2013-12-10 16:47:49 UTC (rev 160369)
+++ trunk/Source/WebCore/page/Page.cpp	2013-12-10 16:50:49 UTC (rev 160370)
@@ -487,6 +487,20 @@
     }
 }
 
+void Page::jettisonStyleResolversInAllDocuments()
+{
+    if (!allPages)
+        return;
+
+    for (auto it = allPages->begin(), end = allPages->end(); it != end; ++it) {
+        Page& page = **it;
+        for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
+            if (Document* document = frame->document())
+                document->clearStyleResolver();
+        }
+    }
+}
+
 void Page::refreshPlugins(bool reload)
 {
     if (!allPages)

Modified: trunk/Source/WebCore/page/Page.h (160369 => 160370)


--- trunk/Source/WebCore/page/Page.h	2013-12-10 16:47:49 UTC (rev 160369)
+++ trunk/Source/WebCore/page/Page.h	2013-12-10 16:50:49 UTC (rev 160370)
@@ -111,6 +111,7 @@
 
 public:
     static void updateStyleForAllPagesAfterGlobalChangeInEnvironment();
+    static void jettisonStyleResolversInAllDocuments();
 
     // It is up to the platform to ensure that non-null clients are provided where required.
     struct PageClients {

Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (160369 => 160370)


--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2013-12-10 16:47:49 UTC (rev 160369)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2013-12-10 16:50:49 UTC (rev 160370)
@@ -30,6 +30,7 @@
 #import <WebCore/GCController.h>
 #import <WebCore/FontCache.h>
 #import <WebCore/MemoryCache.h>
+#import <WebCore/Page.h>
 #import <WebCore/PageCache.h>
 #import <WebCore/LayerPool.h>
 #import <WebCore/ScrollingThread.h>
@@ -163,6 +164,8 @@
 
     clearWidthCaches();
 
+    Page::jettisonStyleResolversInAllDocuments();
+
     gcController().discardAllCompiledCode();
 
     // FastMalloc has lock-free thread specific caches that can only be cleared from the thread itself.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to