[iOS] Don't progressively re-render tiles while pinch-zooming under memory pressure.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jul 2014 03:04:57 +0000 (03:04 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jul 2014 03:04:57 +0000 (03:04 +0000)
<https://webkit.org/b/134915>

When we're under memory pressure, the last thing we want to be doing is
creating gratuitous new IOSurfaces. Just wait for the gesture to end before
rendering at the new scale.

Reviewed by Tim Horton.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index da3da5e..23f5a93 100644 (file)
@@ -1,3 +1,17 @@
+2014-07-14  Andreas Kling  <akling@apple.com>
+
+        [iOS] Don't progressively re-render tiles while pinch-zooming under memory pressure.
+        <https://webkit.org/b/134915>
+
+        When we're under memory pressure, the last thing we want to be doing is
+        creating gratuitous new IOSurfaces. Just wait for the gesture to end before
+        rendering at the new scale.
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2014-07-14  Joseph Pecoraro  <pecoraro@apple.com>
 
         [Cocoa] _WKRemoteObjectInterface leaks NSString ivar
index da13d28..87fa039 100644 (file)
@@ -69,6 +69,7 @@
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/MainFrame.h>
 #import <WebCore/MediaSessionManagerIOS.h>
+#import <WebCore/MemoryPressureHandler.h>
 #import <WebCore/Node.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/Page.h>
@@ -2452,6 +2453,10 @@ void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visi
 
     double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), filteredScale));
 
+    // Skip progressively redrawing tiles if pinch-zooming while the system is under memory pressure.
+    if (boundedScale != currentScale && !visibleContentRectUpdateInfo.inStableState() && memoryPressureHandler().isUnderMemoryPressure())
+        return;
+
     FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
     FloatRect adjustedExposedRect = adjustExposedRectForBoundedScale(exposedRect, visibleContentRectUpdateInfo.scale(), boundedScale);
     m_drawingArea->setExposedContentRect(adjustedExposedRect);