- Revision
- 167717
- Author
- akl...@apple.com
- Date
- 2014-04-23 11:47:15 -0700 (Wed, 23 Apr 2014)
Log Message
[iOS WebKit2] IOSurfacePool should force CA to actually garbage collect surfaces.
<https://webkit.org/b/132065>
<rdar://problem/16110687>
Add a platformGarbageCollectNow() helper function to IOSurfacePool that
triggers a sweep of the IOSurfaces. Call this from collectionTimerFired()
and discardAllSurfaces().
This lets us drop all otherwise-unused 420f surfaces on memory pressure.
Reviewed by Tim Horton.
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::IOSurfacePool::collectionTimerFired):
(WebCore::IOSurfacePool::discardAllSurfaces):
* platform/graphics/cg/IOSurfacePool.h:
* platform/graphics/cocoa/IOSurfacePoolCocoa.mm: Added.
(WebCore::IOSurfacePool::platformGarbageCollectNow):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (167716 => 167717)
--- trunk/Source/WebCore/ChangeLog 2014-04-23 18:39:57 UTC (rev 167716)
+++ trunk/Source/WebCore/ChangeLog 2014-04-23 18:47:15 UTC (rev 167717)
@@ -1,3 +1,25 @@
+2014-04-23 Andreas Kling <akl...@apple.com>
+
+ [iOS WebKit2] IOSurfacePool should force CA to actually garbage collect surfaces.
+ <https://webkit.org/b/132065>
+ <rdar://problem/16110687>
+
+ Add a platformGarbageCollectNow() helper function to IOSurfacePool that
+ triggers a sweep of the IOSurfaces. Call this from collectionTimerFired()
+ and discardAllSurfaces().
+
+ This lets us drop all otherwise-unused 420f surfaces on memory pressure.
+
+ Reviewed by Tim Horton.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/cg/IOSurfacePool.cpp:
+ (WebCore::IOSurfacePool::collectionTimerFired):
+ (WebCore::IOSurfacePool::discardAllSurfaces):
+ * platform/graphics/cg/IOSurfacePool.h:
+ * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: Added.
+ (WebCore::IOSurfacePool::platformGarbageCollectNow):
+
2014-04-23 Morten Stenshorne <msten...@opera.com>
REGRESSION (Safari 6 - ToT): Incorrectly assumes that RenderStyle data can be shared
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (167716 => 167717)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-04-23 18:39:57 UTC (rev 167716)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-04-23 18:47:15 UTC (rev 167717)
@@ -4245,6 +4245,7 @@
AD726FED16DA1171003A4E6D /* JSCSSStyleDeclarationCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
AD726FEE16DA11BC003A4E6D /* JSStyleSheetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AD726FEC16D9F4B9003A4E6D /* JSStyleSheetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
AD726FEF16DA11F5003A4E6D /* JSCSSRuleCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AD726FE916D9F40A003A4E6D /* JSCSSRuleCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */; };
ADB6B29818FB90240081963E /* MemoryPressureHandlerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = ADB6B29718FB90240081963E /* MemoryPressureHandlerCocoa.mm */; };
ADDF1AD71257CD9A0003A759 /* RenderSVGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = ADDF1AD51257CD9A0003A759 /* RenderSVGPath.h */; };
ADEC78F818EE5308001315C2 /* JSElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = ADEC78F718EE5308001315C2 /* JSElementCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11369,6 +11370,7 @@
AD726FE916D9F40A003A4E6D /* JSCSSRuleCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSRuleCustom.h; sourceTree = "<group>"; };
AD726FEA16D9F40B003A4E6D /* JSCSSStyleDeclarationCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSStyleDeclarationCustom.h; sourceTree = "<group>"; };
AD726FEC16D9F4B9003A4E6D /* JSStyleSheetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStyleSheetCustom.h; sourceTree = "<group>"; };
+ AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSurfacePoolCocoa.mm; sourceTree = "<group>"; };
ADB6B29718FB90240081963E /* MemoryPressureHandlerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryPressureHandlerCocoa.mm; sourceTree = "<group>"; };
ADDF1AD41257CD9A0003A759 /* RenderSVGPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGPath.cpp; sourceTree = "<group>"; };
ADDF1AD51257CD9A0003A759 /* RenderSVGPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGPath.h; sourceTree = "<group>"; };
@@ -20371,6 +20373,7 @@
2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
1C21E57A183ED1FF001C289D /* IOSurfacePool.cpp */,
1C21E57B183ED1FF001C289D /* IOSurfacePool.h */,
+ AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */,
);
path = cocoa;
@@ -28611,6 +28614,7 @@
E526AF3F1727F8F200E41781 /* Performance.cpp in Sources */,
86BE340315058CB200CE0FD8 /* PerformanceEntryList.cpp in Sources */,
8AF4E55511DC5A36000ED3DE /* PerformanceNavigation.cpp in Sources */,
+ AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */,
86512EDE154A2AEF00A90426 /* PerformanceResourceTiming.cpp in Sources */,
0F43C85D189E10CF00019AE2 /* PerformanceTiming.cpp in Sources */,
FD581FB41520F93B003A7A75 /* PeriodicWave.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp (167716 => 167717)
--- trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp 2014-04-23 18:39:57 UTC (rev 167716)
+++ trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp 2014-04-23 18:47:15 UTC (rev 167717)
@@ -288,6 +288,7 @@
if (!m_inUseSurfaces.size() && markedAllSurfaces)
m_collectionTimer.stop();
+ platformGarbageCollectNow();
DUMP_POOL_STATISTICS();
}
@@ -306,6 +307,7 @@
m_inUseSurfaces.clear();
m_sizesInPruneOrder.clear();
m_collectionTimer.stop();
+ platformGarbageCollectNow();
}
void IOSurfacePool::showPoolStatistics()
Modified: trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h (167716 => 167717)
--- trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h 2014-04-23 18:39:57 UTC (rev 167716)
+++ trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h 2014-04-23 18:47:15 UTC (rev 167717)
@@ -91,6 +91,8 @@
void collectInUseSurfaces();
bool markOlderSurfacesPurgeable();
+ void platformGarbageCollectNow();
+
Timer<IOSurfacePool> m_collectionTimer;
CachedSurfaceMap m_cachedSurfaces;
CachedSurfaceQueue m_inUseSurfaces;
Added: trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm (0 => 167717)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm 2014-04-23 18:47:15 UTC (rev 167717)
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+#import "IOSurfacePool.h"
+
+#if USE(IOSURFACE)
+
+#include <QuartzCore/QuartzCore.h>
+
+namespace WebCore {
+
+void IOSurfacePool::platformGarbageCollectNow()
+{
+ [CATransaction begin];
+ [CATransaction commit];
+}
+
+}
+
+#endif // USE(IOSURFACE)