Title: [165629] trunk/Source/WebCore
Revision
165629
Author
akl...@apple.com
Date
2014-03-14 10:29:09 -0700 (Fri, 14 Mar 2014)

Log Message

Simplify jettisoning of style resolvers on memory pressure.
<https://webkit.org/b/129644>

Now that we have Document::allDocuments(), we can jettison all the
style resolvers by walking the set of live documents and calling
clearStyleResolver() on each one, instead of having a function on
Page that walks the frame tree of every living page, etc.

Reviewed by Antti Koivisto.

* page/Page.cpp:
* page/Page.h:
* platform/mac/MemoryPressureHandlerMac.mm:
(WebCore::MemoryPressureHandler::releaseMemory):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165628 => 165629)


--- trunk/Source/WebCore/ChangeLog	2014-03-14 17:21:57 UTC (rev 165628)
+++ trunk/Source/WebCore/ChangeLog	2014-03-14 17:29:09 UTC (rev 165629)
@@ -1,3 +1,20 @@
+2014-03-14  Andreas Kling  <akl...@apple.com>
+
+        Simplify jettisoning of style resolvers on memory pressure.
+        <https://webkit.org/b/129644>
+
+        Now that we have Document::allDocuments(), we can jettison all the
+        style resolvers by walking the set of live documents and calling
+        clearStyleResolver() on each one, instead of having a function on
+        Page that walks the frame tree of every living page, etc.
+
+        Reviewed by Antti Koivisto.
+
+        * page/Page.cpp:
+        * page/Page.h:
+        * platform/mac/MemoryPressureHandlerMac.mm:
+        (WebCore::MemoryPressureHandler::releaseMemory):
+
 2014-03-07  Jer Noble  <jer.no...@apple.com>
 
         Add Remote Control command support to HTLMediaElement

Modified: trunk/Source/WebCore/page/Page.cpp (165628 => 165629)


--- trunk/Source/WebCore/page/Page.cpp	2014-03-14 17:21:57 UTC (rev 165628)
+++ trunk/Source/WebCore/page/Page.cpp	2014-03-14 17:29:09 UTC (rev 165629)
@@ -433,20 +433,6 @@
     }
 }
 
-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 (165628 => 165629)


--- trunk/Source/WebCore/page/Page.h	2014-03-14 17:21:57 UTC (rev 165628)
+++ trunk/Source/WebCore/page/Page.h	2014-03-14 17:29:09 UTC (rev 165629)
@@ -117,7 +117,6 @@
 
 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 (165628 => 165629)


--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2014-03-14 17:21:57 UTC (rev 165628)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2014-03-14 17:29:09 UTC (rev 165629)
@@ -27,6 +27,7 @@
 #import "MemoryPressureHandler.h"
 
 #import <WebCore/CSSValuePool.h>
+#import <WebCore/Document.h>
 #import <WebCore/GCController.h>
 #import <WebCore/FontCache.h>
 #import <WebCore/MemoryCache.h>
@@ -170,7 +171,8 @@
 
     clearWidthCaches();
 
-    Page::jettisonStyleResolversInAllDocuments();
+    for (auto* document : Document::allDocuments())
+        document->clearStyleResolver();
 
     gcController().discardAllCompiledCode();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to