Always clear RenderLayer backing stores when going into page cache.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2016 18:37:18 +0000 (18:37 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Dec 2016 18:37:18 +0000 (18:37 +0000)
<https://webkit.org/b/165901>

Reviewed by Simon Fraser.

Source/WebCore:

We were already doing this for the iOS and GTK+ ports, let's do it everywhere
for consistency, and a bit of memory usage improvement.

This patch just removes the setting and always calls FrameView::clearBackingStores()
when there is composited content going into page cache.

* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
* history/PageCache.h:
(WebCore::PageCache::shouldClearBackingStores): Deleted.
(WebCore::PageCache::setShouldClearBackingStores): Deleted.

Source/WebKit/mac:

* WebView/WebView.mm:
(+[WebView _setCacheModel:]):

Source/WebKit2:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/history/PageCache.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebProcess.cpp

index 6ed32d6..93eaa6a 100644 (file)
@@ -1,3 +1,22 @@
+2016-12-15  Andreas Kling  <akling@apple.com>
+
+        Always clear RenderLayer backing stores when going into page cache.
+        <https://webkit.org/b/165901>
+
+        Reviewed by Simon Fraser.
+
+        We were already doing this for the iOS and GTK+ ports, let's do it everywhere
+        for consistency, and a bit of memory usage improvement.
+
+        This patch just removes the setting and always calls FrameView::clearBackingStores()
+        when there is composited content going into page cache.
+
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrame::CachedFrame):
+        * history/PageCache.h:
+        (WebCore::PageCache::shouldClearBackingStores): Deleted.
+        (WebCore::PageCache::setShouldClearBackingStores): Deleted.
+
 2016-12-15  Darin Adler  <darin@apple.com>
 
         Remove custom binding for MediaDevices
index 752d4f6..21ec527 100644 (file)
@@ -164,7 +164,7 @@ CachedFrame::CachedFrame(Frame& frame)
 
     frame.loader().client().savePlatformDataToCachedFrame(this);
 
-    if (m_isComposited && PageCache::singleton().shouldClearBackingStores())
+    if (m_isComposited)
         frame.view()->clearBackingStores();
 
     // documentWillSuspendForPageCache() can set up a layout timer on the FrameView, so clear timers after that.
index 316c73b..7f5d03e 100644 (file)
@@ -66,9 +66,6 @@ public:
     void markPagesForCaptionPreferencesChanged();
 #endif
 
-    bool shouldClearBackingStores() const { return m_shouldClearBackingStores; }
-    void setShouldClearBackingStores(bool flag) { m_shouldClearBackingStores = flag; }
-
 private:
     PageCache() = default; // Use singleton() instead.
     ~PageCache() = delete; // Make sure nobody accidentally calls delete -- WebCore does not delete singletons.
@@ -79,7 +76,6 @@ private:
 
     ListHashSet<RefPtr<HistoryItem>> m_items;
     unsigned m_maxSize {0};
-    bool m_shouldClearBackingStores {false};
 
     friend class WTF::NeverDestroyed<PageCache>;
 };
index a2ec201..1ec7719 100644 (file)
@@ -1,3 +1,13 @@
+2016-12-15  Andreas Kling  <akling@apple.com>
+
+        Always clear RenderLayer backing stores when going into page cache.
+        <https://webkit.org/b/165901>
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (+[WebView _setCacheModel:]):
+
 2016-12-12  Alex Christensen  <achristensen@webkit.org>
 
         Remove unused workaround for Silverlight
index 194a02a..e63b149 100644 (file)
@@ -8520,7 +8520,6 @@ static WebFrameView *containingFrameView(NSView *view)
     auto& pageCache = PageCache::singleton();
     pageCache.setMaxSize(pageCacheSize);
 #if PLATFORM(IOS)
-    pageCache.setShouldClearBackingStores(true);
     nsurlCacheMemoryCapacity = std::max(nsurlCacheMemoryCapacity, [nsurlCache memoryCapacity]);
     CFURLCacheRef cfCache;
     if ([nsurlCache respondsToSelector:@selector(_CFURLCache)] && (cfCache = [nsurlCache _CFURLCache]))
index de012bc..3a1ca89 100644 (file)
@@ -1,3 +1,13 @@
+2016-12-15  Andreas Kling  <akling@apple.com>
+
+        Always clear RenderLayer backing stores when going into page cache.
+        <https://webkit.org/b/165901>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess):
+
 2016-12-15  Darin Adler  <darin@apple.com>
 
         Remove custom binding for MediaDevices
index a51f780..c128018 100644 (file)
@@ -203,10 +203,6 @@ WebProcess::WebProcess()
     RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
 #endif
 
-#if PLATFORM(IOS) || PLATFORM(GTK)
-    PageCache::singleton().setShouldClearBackingStores(true);
-#endif
-
     ResourceLoadObserver::sharedObserver().setStatisticsStore(m_resourceLoadStatisticsStorage.copyRef());
     m_resourceLoadStatisticsStorage->setNotificationCallback([this] {
         if (m_statisticsChangedTimer.isActive())