Title: [235851] trunk
Revision
235851
Author
[email protected]
Date
2018-09-10 11:16:37 -0700 (Mon, 10 Sep 2018)

Log Message

Before tracking Document leaks, clear all caches
https://bugs.webkit.org/show_bug.cgi?id=189459

Reviewed by Sam Weinig.
Source/WebKit:

It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
does the GC that we need to happen.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleReleaseMemory):
(WKBundleClearPageCache): Deleted.
(WKBundleClearMemoryCache): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:

Tools:

It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
does the GC that we need to happen.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235850 => 235851)


--- trunk/Source/WebKit/ChangeLog	2018-09-10 17:20:26 UTC (rev 235850)
+++ trunk/Source/WebKit/ChangeLog	2018-09-10 18:16:37 UTC (rev 235851)
@@ -1,3 +1,20 @@
+2018-09-10  Simon Fraser  <[email protected]>
+
+        Before tracking Document leaks, clear all caches
+        https://bugs.webkit.org/show_bug.cgi?id=189459
+
+        Reviewed by Sam Weinig.
+        
+        It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
+        so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
+        does the GC that we need to happen.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleReleaseMemory):
+        (WKBundleClearPageCache): Deleted.
+        (WKBundleClearMemoryCache): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+
 2018-09-07  Matt Rajca  <[email protected]>
 
         Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp (235850 => 235851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2018-09-10 17:20:26 UTC (rev 235850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2018-09-10 18:16:37 UTC (rev 235851)
@@ -44,8 +44,7 @@
 #include "WebPage.h"
 #include "WebPageGroupProxy.h"
 #include <WebCore/DatabaseTracker.h>
-#include <WebCore/MemoryCache.h>
-#include <WebCore/PageCache.h>
+#include <WebCore/MemoryRelease.h>
 #include <WebCore/ResourceLoadObserver.h>
 #include <WebCore/ServiceWorkerThreadProxy.h>
 
@@ -260,16 +259,11 @@
     DatabaseTracker::singleton().setQuota(*SecurityOriginData::fromDatabaseIdentifier("file__0"), quota);
 }
 
-void WKBundleClearPageCache(WKBundleRef bundle)
+void WKBundleReleaseMemory(WKBundleRef)
 {
-    PageCache::singleton().pruneToSizeNow(0, PruningReason::MemoryPressure);
+    WebCore::releaseMemory(WTF::Critical::Yes, WTF::Synchronous::Yes);
 }
 
-void WKBundleClearMemoryCache(WKBundleRef bundle)
-{
-    MemoryCache::singleton().evictResources();
-}
-
 WKDataRef WKBundleCreateWKDataFromUInt8Array(WKBundleRef bundle, JSContextRef context, JSValueRef data)
 {
     return toAPI(&toImpl(bundle)->createWebDataFromUint8Array(context, data).leakRef());

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (235850 => 235851)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2018-09-10 17:20:26 UTC (rev 235850)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2018-09-10 18:16:37 UTC (rev 235851)
@@ -98,8 +98,7 @@
 
 WK_EXPORT void WKBundleExtendClassesForParameterCoder(WKBundleRef bundle, WKArrayRef classes);
 
-WK_EXPORT void WKBundleClearPageCache(WKBundleRef bundle);
-WK_EXPORT void WKBundleClearMemoryCache(WKBundleRef bundle);
+WK_EXPORT void WKBundleReleaseMemory(WKBundleRef);
 
 #ifdef __cplusplus
 }

Modified: trunk/Tools/ChangeLog (235850 => 235851)


--- trunk/Tools/ChangeLog	2018-09-10 17:20:26 UTC (rev 235850)
+++ trunk/Tools/ChangeLog	2018-09-10 18:16:37 UTC (rev 235851)
@@ -1,3 +1,17 @@
+2018-09-10  Simon Fraser  <[email protected]>
+
+        Before tracking Document leaks, clear all caches
+        https://bugs.webkit.org/show_bug.cgi?id=189459
+
+        Reviewed by Sam Weinig.
+
+        It's not enough to clear the page and memory caches; font caches can reference Documents (for SVG fonts),
+        so just call WebCore::releaseMemory(), which empties caches including the page and memory caches, and
+        does the GC that we need to happen.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+
 2018-09-07  Matt Rajca  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=189433

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (235850 => 235851)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2018-09-10 17:20:26 UTC (rev 235850)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2018-09-10 18:16:37 UTC (rev 235851)
@@ -271,9 +271,7 @@
     }
 
     if (WKStringIsEqualToUTF8CString(messageName, "CheckForWorldLeaks")) {
-        WKBundleClearPageCache(m_bundle);
-        WKBundleClearMemoryCache(m_bundle);
-        WKBundleGarbageCollectJavaScriptObjects(m_bundle);
+        WKBundleReleaseMemory(m_bundle);
 
         WKRetain(page); // Balanced by the release in postGCTask.
         WKBundlePagePostTask(page, postGCTask, (void*)page);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to