Title: [161675] trunk/Source
Revision
161675
Author
[email protected]
Date
2014-01-10 14:10:44 -0800 (Fri, 10 Jan 2014)

Log Message

Clear unparented tiled layers on memory pressure.
https://bugs.webkit.org/show_bug.cgi?id=126737

Patch by Yongjun Zhang <[email protected]> on 2014-01-10
Reviewed by Simon Fraser.

Source/WebCore:

TileController hold unparented tiles for a short period of time (1 -3 sec); we should clear these unparented
tiles immediately if we are under memory pressure.

The patch does 3 things to improve the behavior:
1) When the system free memory is low (<35%), reduce the tiling threshold.  This could reduce
the peak memory usage when system is under low memory since we will convert more web layers into
tiled backing.
2) Under memory pressure, immediately clear all unparented tiles.
3) Add a cap (16 tiles) to limit the total number of unparented tiles in TileController's.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj: Add a new class TileControllerMemoryHandler.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::requiresTiledLayer):  Use a smaller tiling threshold if the system free memory is low.
* platform/graphics/ca/mac/TileController.h:
(WebCore::TileController::numberOfUnparentedTiles):
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::startedNewCohort):
(WebCore::TileController::removeUnparentedTilesNow): Remove all unparentd tiles.
* platform/ios/MemoryPressureHandlerIOS.mm:
* platform/ios/TileControllerMemoryHandlerIOS.cpp: Added.
(WebCore::TileControllerMemoryHandler::removeTileController):
(WebCore::TileControllerMemoryHandler::totalUnparentedTiledLayers):
(WebCore::TileControllerMemoryHandler::tileControllerGainUnparentedTiles):
(WebCore::TileControllerMemoryHandler::trimUnparentedTilesToTarget): Trims the number of unparented tiles until
    it reaches the target.
(WebCore::tileControllerMemoryHandler):
* platform/ios/TileControllerMemoryHandlerIOS.h: Added.
(WebCore::TileControllerMemoryHandler::TileControllerMemoryHandler):

Source/WebKit/mac:

* WebView/WebView.mm:
(+[WebView _handleMemoryWarning]): Clear all unparented tiles when under memory pressure.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161674 => 161675)


--- trunk/Source/WebCore/ChangeLog	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/ChangeLog	2014-01-10 22:10:44 UTC (rev 161675)
@@ -1,3 +1,40 @@
+2014-01-10  Yongjun Zhang  <[email protected]>
+
+        Clear unparented tiled layers on memory pressure.
+        https://bugs.webkit.org/show_bug.cgi?id=126737
+
+        Reviewed by Simon Fraser.
+
+        TileController hold unparented tiles for a short period of time (1 -3 sec); we should clear these unparented
+        tiles immediately if we are under memory pressure.
+        
+        The patch does 3 things to improve the behavior:
+        1) When the system free memory is low (<35%), reduce the tiling threshold.  This could reduce
+        the peak memory usage when system is under low memory since we will convert more web layers into
+        tiled backing.
+        2) Under memory pressure, immediately clear all unparented tiles.
+        3) Add a cap (16 tiles) to limit the total number of unparented tiles in TileController's.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj: Add a new class TileControllerMemoryHandler.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::requiresTiledLayer):  Use a smaller tiling threshold if the system free memory is low.
+        * platform/graphics/ca/mac/TileController.h:
+        (WebCore::TileController::numberOfUnparentedTiles):
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::startedNewCohort):
+        (WebCore::TileController::removeUnparentedTilesNow): Remove all unparentd tiles.
+        * platform/ios/MemoryPressureHandlerIOS.mm:
+        * platform/ios/TileControllerMemoryHandlerIOS.cpp: Added.
+        (WebCore::TileControllerMemoryHandler::removeTileController):
+        (WebCore::TileControllerMemoryHandler::totalUnparentedTiledLayers):
+        (WebCore::TileControllerMemoryHandler::tileControllerGainUnparentedTiles):
+        (WebCore::TileControllerMemoryHandler::trimUnparentedTilesToTarget): Trims the number of unparented tiles until
+            it reaches the target.
+        (WebCore::tileControllerMemoryHandler):
+        * platform/ios/TileControllerMemoryHandlerIOS.h: Added.
+        (WebCore::TileControllerMemoryHandler::TileControllerMemoryHandler):
+
 2014-01-10  Joseph Pecoraro  <[email protected]>
 
         [CSS Blending] Log blending as a layer creation reason in the WI

Modified: trunk/Source/WebCore/WebCore.exp.in (161674 => 161675)


--- trunk/Source/WebCore/WebCore.exp.in	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-01-10 22:10:44 UTC (rev 161675)
@@ -2448,6 +2448,8 @@
 _wkGetViewportScreenSize
 _wkIsGB18030ComplianceRequired
 _wkSetLayerContentsScale
+__ZN7WebCore27tileControllerMemoryHandlerEv
+__ZN7WebCore27TileControllerMemoryHandler27trimUnparentedTilesToTargetEi
 #endif
 
 #if !defined(NDEBUG)

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161674 => 161675)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-01-10 22:10:44 UTC (rev 161675)
@@ -901,6 +901,8 @@
 		1F3C3BEB135CAF3C00B8C1AC /* MediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */; };
 		1F3F19531499CA7600A5AEA7 /* PODFreeListArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3F19521499CA7600A5AEA7 /* PODFreeListArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1F68D4AE14BB9DCA007B5C62 /* MemoryPressureHandlerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F68D4AD14BB9DCA007B5C62 /* MemoryPressureHandlerIOS.mm */; };
+		1F72BF0A187FD4490009BCB3 /* TileControllerMemoryHandlerIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */; };
+		1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */; };
 		1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */; };
 		1FC40FB91655CCB60040F29E /* SubimageCacheWithTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FC40FB81655C5910040F29E /* SubimageCacheWithTimer.cpp */; };
@@ -7683,6 +7685,8 @@
 		1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControls.h; sourceTree = "<group>"; };
 		1F3F19521499CA7600A5AEA7 /* PODFreeListArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PODFreeListArena.h; sourceTree = "<group>"; };
 		1F68D4AD14BB9DCA007B5C62 /* MemoryPressureHandlerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MemoryPressureHandlerIOS.mm; path = ios/MemoryPressureHandlerIOS.mm; sourceTree = "<group>"; };
+		1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TileControllerMemoryHandlerIOS.cpp; path = ios/TileControllerMemoryHandlerIOS.cpp; sourceTree = "<group>"; };
+		1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TileControllerMemoryHandlerIOS.h; path = ios/TileControllerMemoryHandlerIOS.h; sourceTree = "<group>"; };
 		1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTIUtilities.h; sourceTree = "<group>"; };
 		1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIUtilities.mm; sourceTree = "<group>"; };
 		1FC40FB71655C5910040F29E /* SubimageCacheWithTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubimageCacheWithTimer.h; sourceTree = "<group>"; };
@@ -17938,6 +17942,8 @@
 				44C9919E0F3D210E00586670 /* ThemeIOS.mm */,
 				E4C3B1F90F0E4161009693F6 /* TileCache.h */,
 				E4C3B1FB0F0E4170009693F6 /* TileCache.mm */,
+				1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */,
+				1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */,
 				E4B65A57132FA8E70070E7BE /* TileGrid.h */,
 				E4B65A59132FAAF90070E7BE /* TileGrid.mm */,
 				E424A39D1330DF0100CF6DC9 /* TileGridTile.h */,
@@ -24824,6 +24830,7 @@
 				51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */,
 				FFD5B97B135CC97800D5E92A /* PageVisibilityState.h in Headers */,
 				9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */,
+				1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */,
 				0885067F11DA045B00182B98 /* PaintInfo.h in Headers */,
 				0885068011DA045B00182B98 /* PaintPhase.h in Headers */,
 				07ED35A316D6DCE2002248F3 /* InbandTextTrackPrivateAVFIOS.h in Headers */,
@@ -27807,6 +27814,7 @@
 				19BFF64E11C0F2AC00B8C04D /* JSSVGFEConvolveMatrixElement.cpp in Sources */,
 				B2FA3D720AB75A6F000E5AC4 /* JSSVGFEDiffuseLightingElement.cpp in Sources */,
 				B2FA3D740AB75A6F000E5AC4 /* JSSVGFEDisplacementMapElement.cpp in Sources */,
+				1F72BF0A187FD4490009BCB3 /* TileControllerMemoryHandlerIOS.cpp in Sources */,
 				B2FA3D760AB75A6F000E5AC4 /* JSSVGFEDistantLightElement.cpp in Sources */,
 				4358E87C1360A2EE00E4748C /* JSSVGFEDropShadowElement.cpp in Sources */,
 				B2FA3D780AB75A6F000E5AC4 /* JSSVGFEFloodElement.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (161674 => 161675)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-01-10 22:10:44 UTC (rev 161675)
@@ -67,6 +67,8 @@
 // texture size limit on all supported hardware.
 #if PLATFORM(IOS)
 static const int cMaxPixelDimension = 1280;
+static const int cMaxPixelDimensionLowMemory = 1024;
+static const int cMemoryLevelToUseSmallerPixelDimension = 35;
 #else
 static const int cMaxPixelDimension = 2000;
 #endif
@@ -3058,7 +3060,12 @@
         return false;
 
     // FIXME: catch zero-size height or width here (or earlier)?
+#if PLATFORM(IOS)
+    int maxPixelDimension = systemMemoryLevel() < cMemoryLevelToUseSmallerPixelDimension ? cMaxPixelDimensionLowMemory : cMaxPixelDimension;
+    return m_size.width() * pageScaleFactor > maxPixelDimension || m_size.height() * pageScaleFactor > maxPixelDimension;
+#else
     return m_size.width() * pageScaleFactor > cMaxPixelDimension || m_size.height() * pageScaleFactor > cMaxPixelDimension;
+#endif
 }
 
 void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h (161674 => 161675)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2014-01-10 22:10:44 UTC (rev 161675)
@@ -78,6 +78,11 @@
     unsigned blankPixelCount() const;
     static unsigned blankPixelCountForTiles(const PlatformLayerList&, const FloatRect&, const IntPoint&);
 
+#if PLATFORM(IOS)
+    unsigned numberOfUnparentedTiles() const { return m_cohortList.size(); }
+    void removeUnparentedTilesNow();
+#endif
+
 public:
     // Only public for inline methods in the implementation file.
     typedef IntPoint TileIndex;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (161674 => 161675)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm	2014-01-10 22:10:44 UTC (rev 161675)
@@ -36,8 +36,12 @@
 #import <wtf/MainThread.h>
 #import <utility>
 
+#if PLATFORM(IOS)
+#import "TileControllerMemoryHandlerIOS.h"
+#endif
+
 namespace WebCore {
-    
+
 enum TileValidationPolicyFlag {
     PruneSecondaryTiles = 1 << 0,
     UnparentAllTiles = 1 << 1
@@ -84,6 +88,10 @@
 {
     ASSERT(isMainThread());
 
+#if PLATFORM(IOS)
+    tileControllerMemoryHandler().removeTileController(this);
+#endif
+
     for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
         it->value.layer->setOwner(nullptr);
 
@@ -824,6 +832,10 @@
 void TileController::startedNewCohort(TileCohort cohort)
 {
     m_cohortList.append(TileCohortInfo(cohort, monotonicallyIncreasingTime()));
+#if PLATFORM(IOS)
+    if (!m_isInWindow)
+        tileControllerMemoryHandler().tileControllerGainedUnparentedTiles(this);
+#endif
 }
 
 TileController::TileCohort TileController::newestTileCohort() const
@@ -1168,5 +1180,17 @@
     }
 }
     
+#if PLATFORM(IOS)
+void TileController::removeUnparentedTilesNow()
+{
+    while (!m_cohortList.isEmpty()) {
+        TileCohortInfo firstCohort = m_cohortList.takeFirst();
+        removeTilesInCohort(firstCohort.cohort);
+    }
 
+    if (m_tiledScrollingIndicatorLayer)
+        updateTileCoverageMap();
+}
+#endif
+
 } // namespace WebCore

Added: trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp (0 => 161675)


--- trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp	2014-01-10 22:10:44 UTC (rev 161675)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TileControllerMemoryHandlerIOS.h"
+
+#include "MemoryPressureHandler.h"
+#include "TileController.h"
+
+namespace WebCore {
+
+static const unsigned kMaxCountOfUnparentedTiledLayers = 16;
+
+void TileControllerMemoryHandler::removeTileController(TileController* controller)
+{
+    if (m_tileControllers.contains(controller))
+        m_tileControllers.remove(controller);
+}
+
+unsigned TileControllerMemoryHandler::totalUnparentedTiledLayers() const
+{
+    unsigned totalUnparentedLayers = 0;
+    for (ListHashSet<TileController*>::const_iterator it = m_tileControllers.begin(); it != m_tileControllers.end(); ++it) {
+        TileController* tileController = *it;
+        totalUnparentedLayers += tileController->numberOfUnparentedTiles();
+    }
+    return totalUnparentedLayers;
+}
+
+void TileControllerMemoryHandler::tileControllerGainedUnparentedTiles(TileController* controller)
+{
+    m_tileControllers.appendOrMoveToLast(controller);
+
+    // If we are under memory pressure, remove all unparented tiles now.
+    if (memoryPressureHandler().hasReceivedMemoryPressure()) {
+        trimUnparentedTilesToTarget(0);
+        return;
+    }
+
+    if (totalUnparentedTiledLayers() < kMaxCountOfUnparentedTiledLayers)
+        return;
+
+    trimUnparentedTilesToTarget(kMaxCountOfUnparentedTiledLayers);
+}
+
+void TileControllerMemoryHandler::trimUnparentedTilesToTarget(int target)
+{
+    while (!m_tileControllers.isEmpty()) {
+        TileController* tileController = m_tileControllers.first();
+        tileController->removeUnparentedTilesNow();
+        m_tileControllers.removeFirst();
+
+        if (target > 0 && totalUnparentedTiledLayers() < static_cast<unsigned>(target))
+            return;
+    }
+}
+
+TileControllerMemoryHandler& tileControllerMemoryHandler()
+{
+    DEFINE_STATIC_LOCAL(TileControllerMemoryHandler, staticTileControllerMemoryHandler, ());
+    return staticTileControllerMemoryHandler;
+}
+
+}

Added: trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.h (0 => 161675)


--- trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.h	2014-01-10 22:10:44 UTC (rev 161675)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TileControllerMemoryHandlerIOS_h
+#define TileControllerMemoryHandlerIOS_h
+
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+class TileController;
+
+class TileControllerMemoryHandler {
+public:
+    friend TileControllerMemoryHandler& tileControllerMemoryHandler();
+
+    void removeTileController(TileController*);
+    void tileControllerGainedUnparentedTiles(TileController*);
+    void trimUnparentedTilesToTarget(int target);
+
+private:
+    TileControllerMemoryHandler() { }
+    unsigned totalUnparentedTiledLayers() const;
+
+    typedef ListHashSet<TileController*> TileControllerList;
+    TileControllerList m_tileControllers;
+};
+
+TileControllerMemoryHandler& tileControllerMemoryHandler();
+}
+
+#endif // TileControllerMemoryHandlerIOS_h

Modified: trunk/Source/WebKit/mac/ChangeLog (161674 => 161675)


--- trunk/Source/WebKit/mac/ChangeLog	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-01-10 22:10:44 UTC (rev 161675)
@@ -1,3 +1,13 @@
+2014-01-10  Yongjun Zhang  <[email protected]>
+
+        Clear unparented tiled layers on memory pressure.
+        https://bugs.webkit.org/show_bug.cgi?id=126737
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (+[WebView _handleMemoryWarning]): Clear all unparented tiles when under memory pressure.
+
 2014-01-10  Daniel Bates  <[email protected]>
 
         Fix the WebCore, WebKit build targets following <http://trac.webkit.org/changeset/161638>

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (161674 => 161675)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-01-10 22:06:15 UTC (rev 161674)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-01-10 22:10:44 UTC (rev 161675)
@@ -231,6 +231,7 @@
 #import <WebCore/SQLiteDatabaseTracker.h>
 #import <WebCore/SmartReplace.h>
 #import <WebCore/TextRun.h>
+#import <WebCore/TileControllerMemoryHandlerIOS.h>
 #import <WebCore/WAKWindow.h>
 #import <WebCore/WebCoreThread.h>
 #import <WebCore/WebCoreThreadMessage.h>
@@ -1276,6 +1277,8 @@
     if (!didOneTimeInitialization)
         return;
 
+    tileControllerMemoryHandler().trimUnparentedTilesToTarget(0);
+
 #if ENABLE(DISK_IMAGE_CACHE)
     {
         WebKit::MemoryMeasure measurer("Memory warning: flushing images to disk.");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to