<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[168260] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/168260">168260</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-05-05 00:37:35 -0700 (Mon, 05 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WebKit2] Swipe snapshots should be taken asynchronously
https://bugs.webkit.org/show_bug.cgi?id=132417
&lt;rdar://problem/16535921&gt;

Reviewed by Anders Carlsson.

Reorganize takeViewSnapshot to return a ViewSnaphot with the image
filled in (the other properties are filled in by ViewSnapshotStore).

Make ViewSnapshotStore use a fixed size instead of count for the snapshot cache.
iOS doesn't use purgeable snapshots, so make the cache much smaller there.

Use CARenderServerCaptureLayerWithTransform to achieve async snapshotting.

Rename WebKit::ViewSnapshotStore::Snapshot to WebKit::ViewSnapshot so that
it can be forward-declared in a bunch of places.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _takeViewSnapshot:]):
Use CARenderServerCaptureLayerWithTransform.

* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/mac/WKView.mm:
(createIOSurfaceFromImage):
(-[WKView _takeViewSnapshot:]):
Adjust to the new push model.

* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::takeViewSnapshot):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::takeViewSnapshot):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::takeViewSnapshot):
Plumbing.

* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::endSwipeGesture):
Realize an object that can be used as the layer contents from the slot ID.

* UIProcess/ios/WebMemoryPressureHandlerIOS.cpp:
(WebKit::WebMemoryPressureHandler::sharedHandler):
(WebKit::WebMemoryPressureHandler::WebMemoryPressureHandler):
* UIProcess/WebMemoryPressureHandlerIOS.h:
Add a memory pressure handler for the UI process. This does not use
WebCore's platform independent memory pressure handler because that
mechanism only allows for one handler per process, and we don't want to
stomp on any handlers installed by WebKit1 in a process where the WebKits coexist.

* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _takeViewSnapshot]): Deleted.
Get rid of an unnecessary bounce through WKContentView.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::retrieveSnapshotForItem):
(WebKit::ViewGestureController::endSwipeGesture):
Use the new name, ViewSnapshot.

* UIProcess/mac/ViewSnapshotStore.h:
(WebKit::ViewSnapshot::ViewSnapshot):
* UIProcess/mac/ViewSnapshotStore.mm:
(WebKit::ViewSnapshotStore::ViewSnapshotStore):
(WebKit::ViewSnapshotStore::~ViewSnapshotStore):
(WebKit::ViewSnapshotStore::snapshottingContext):
Use a custom CAContext for snapshotting so that snapshots don't
disappear when the main context is destroyed on hibernation.

(WebKit::ViewSnapshotStore::removeSnapshotImage):
(WebKit::ViewSnapshotStore::pruneSnapshots):
(WebKit::ViewSnapshotStore::recordSnapshot):
(WebKit::ViewSnapshotStore::getSnapshot):
(WebKit::ViewSnapshotStore::discardSnapshots):
(WebKit::ViewSnapshot::clearImage):
(WebKit::ViewSnapshot::hasImage):
(WebKit::createIOSurfaceFromImage): Deleted.
(WebKit::ViewSnapshotStore::Snapshot::clearImage): Deleted.
(WebKit::ViewSnapshotStore::Snapshot::hasImage): Deleted.
Cache by image size instead of counts.

* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm">trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewh">trunk/Source/WebKit2/UIProcess/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewSnapshotStoreh">trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewSnapshotStoremm">trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebContextMacmm">trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOScpp">trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOSh">trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -1,3 +1,92 @@
</span><ins>+2014-05-05  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        [iOS WebKit2] Swipe snapshots should be taken asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=132417
+        &lt;rdar://problem/16535921&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Reorganize takeViewSnapshot to return a ViewSnaphot with the image
+        filled in (the other properties are filled in by ViewSnapshotStore).
+
+        Make ViewSnapshotStore use a fixed size instead of count for the snapshot cache.
+        iOS doesn't use purgeable snapshots, so make the cache much smaller there.
+
+        Use CARenderServerCaptureLayerWithTransform to achieve async snapshotting.
+
+        Rename WebKit::ViewSnapshotStore::Snapshot to WebKit::ViewSnapshot so that
+        it can be forward-declared in a bunch of places.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _takeViewSnapshot:]):
+        Use CARenderServerCaptureLayerWithTransform.
+
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/API/mac/WKView.mm:
+        (createIOSurfaceFromImage):
+        (-[WKView _takeViewSnapshot:]):
+        Adjust to the new push model.
+
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::takeViewSnapshot):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::takeViewSnapshot):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::takeViewSnapshot):
+        Plumbing.
+
+        * UIProcess/ios/ViewGestureControllerIOS.mm:
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::endSwipeGesture):
+        Realize an object that can be used as the layer contents from the slot ID.
+
+        * UIProcess/ios/WebMemoryPressureHandlerIOS.cpp:
+        (WebKit::WebMemoryPressureHandler::sharedHandler):
+        (WebKit::WebMemoryPressureHandler::WebMemoryPressureHandler):
+        * UIProcess/WebMemoryPressureHandlerIOS.h:
+        Add a memory pressure handler for the UI process. This does not use
+        WebCore's platform independent memory pressure handler because that
+        mechanism only allows for one handler per process, and we don't want to
+        stomp on any handlers installed by WebKit1 in a process where the WebKits coexist.
+
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _takeViewSnapshot]): Deleted.
+        Get rid of an unnecessary bounce through WKContentView.
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::retrieveSnapshotForItem):
+        (WebKit::ViewGestureController::endSwipeGesture):
+        Use the new name, ViewSnapshot.
+
+        * UIProcess/mac/ViewSnapshotStore.h:
+        (WebKit::ViewSnapshot::ViewSnapshot):
+        * UIProcess/mac/ViewSnapshotStore.mm:
+        (WebKit::ViewSnapshotStore::ViewSnapshotStore):
+        (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
+        (WebKit::ViewSnapshotStore::snapshottingContext):
+        Use a custom CAContext for snapshotting so that snapshots don't
+        disappear when the main context is destroyed on hibernation.
+
+        (WebKit::ViewSnapshotStore::removeSnapshotImage):
+        (WebKit::ViewSnapshotStore::pruneSnapshots):
+        (WebKit::ViewSnapshotStore::recordSnapshot):
+        (WebKit::ViewSnapshotStore::getSnapshot):
+        (WebKit::ViewSnapshotStore::discardSnapshots):
+        (WebKit::ViewSnapshot::clearImage):
+        (WebKit::ViewSnapshot::hasImage):
+        (WebKit::createIOSurfaceFromImage): Deleted.
+        (WebKit::ViewSnapshotStore::Snapshot::clearImage): Deleted.
+        (WebKit::ViewSnapshotStore::Snapshot::hasImage): Deleted.
+        Cache by image size instead of counts.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2014-05-04  Pratik Solanki  &lt;psolanki@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reduce calls to CFURLCacheCopySharedURLCache
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import &quot;RemoteObjectRegistryMessages.h&quot;
</span><span class="cx"> #import &quot;UIDelegate.h&quot;
</span><span class="cx"> #import &quot;ViewGestureController.h&quot;
</span><ins>+#import &quot;ViewSnapshotStore.h&quot;
</ins><span class="cx"> #import &quot;WKBackForwardListInternal.h&quot;
</span><span class="cx"> #import &quot;WKBackForwardListItemInternal.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextHandleInternal.h&quot;
</span><span class="lines">@@ -54,6 +55,7 @@
</span><span class="cx"> #import &quot;WebCertificateInfo.h&quot;
</span><span class="cx"> #import &quot;WebContext.h&quot;
</span><span class="cx"> #import &quot;WebFormSubmissionListenerProxy.h&quot;
</span><ins>+#import &quot;WebKitSystemInterface.h&quot;
</ins><span class="cx"> #import &quot;WebPageGroup.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><span class="lines">@@ -71,6 +73,8 @@
</span><span class="cx"> #import &quot;WKWebViewContentProviderRegistry.h&quot;
</span><span class="cx"> #import &lt;CoreGraphics/CGFloat.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIPeripheralHost_Private.h&gt;
</span><ins>+#import &lt;QuartzCore/CARenderServer.h&gt;
+#import &lt;QuartzCore/QuartzCorePrivate.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> @interface UIScrollView (UIScrollViewInternal)
</span><span class="cx"> - (void)_adjustForAutomaticKeyboardInfo:(NSDictionary*)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment;
</span><span class="lines">@@ -493,14 +497,22 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot
</del><ins>+- (WebKit::ViewSnapshot)_takeViewSnapshot
</ins><span class="cx"> {
</span><del>-    // FIXME: We should be able to use acquire an IOSurface directly, instead of going to CGImage here and back in ViewSnapshotStore.
-    UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, self.window.screen.scale);
-    [self drawViewHierarchyInRect:[self bounds] afterScreenUpdates:NO];
-    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-    return image.CGImage;
</del><ins>+    float deviceScale = wkGetScreenScaleFactor();
+    CGSize snapshotSize = self.bounds.size;
+    snapshotSize.width *= deviceScale;
+    snapshotSize.height *= deviceScale;
+
+    WebKit::ViewSnapshot snapshot;
+    snapshot.slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES];
+
+    CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1);
+    CARenderServerCaptureLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, (uint64_t)self.layer, snapshot.slotID, 0, 0, &amp;transform);
+
+    snapshot.imageSizeInBytes = snapshotSize.width * snapshotSize.height * 4;
+
+    return snapshot;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_zoomToPoint:(WebCore::FloatPoint)point atScale:(double)scale
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class WebPageProxy;
</span><ins>+struct ViewSnapshot;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
</span><span class="lines">@@ -61,7 +62,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition;
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot;
</del><ins>+- (WebKit::ViewSnapshot)_takeViewSnapshot;
</ins><span class="cx"> 
</span><span class="cx"> - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset;
</span><span class="cx"> - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -3025,12 +3025,27 @@
</span><span class="cx">     return _data-&gt;_rootLayer.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot
</del><ins>+static RefPtr&lt;IOSurface&gt; createIOSurfaceFromImage(CGImageRef image)
</ins><span class="cx"> {
</span><ins>+    size_t width = CGImageGetWidth(image);
+    size_t height = CGImageGetHeight(image);
+
+    RefPtr&lt;IOSurface&gt; surface = IOSurface::create(IntSize(width, height), ColorSpaceDeviceRGB);
+    RetainPtr&lt;CGContextRef&gt; surfaceContext = surface-&gt;ensurePlatformContext();
+    CGContextDrawImage(surfaceContext.get(), CGRectMake(0, 0, width, height), image);
+    CGContextFlush(surfaceContext.get());
+
+    return surface;
+}
+
+- (ViewSnapshot)_takeViewSnapshot
+{
</ins><span class="cx">     NSWindow *window = self.window;
</span><span class="cx"> 
</span><ins>+    ViewSnapshot snapshot;
+
</ins><span class="cx">     if (![window windowNumber])
</span><del>-        return nullptr;
</del><ins>+        return snapshot;
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: This should use CGWindowListCreateImage once &lt;rdar://problem/15709646&gt; is resolved.
</span><span class="cx">     CGSWindowID windowID = [window windowNumber];
</span><span class="lines">@@ -3059,7 +3074,11 @@
</span><span class="cx">     NSRect croppedImageRect = windowCaptureRect;
</span><span class="cx">     croppedImageRect.origin.y = windowScreenRect.size.height - windowCaptureScreenRect.size.height - NSMinY(windowCaptureRect);
</span><span class="cx"> 
</span><del>-    return adoptCF(CGImageCreateWithImageInRect(windowSnapshotImage.get(), NSRectToCGRect([window convertRectToBacking:croppedImageRect])));
</del><ins>+    auto croppedSnapshotImage = adoptCF(CGImageCreateWithImageInRect(windowSnapshotImage.get(), NSRectToCGRect([window convertRectToBacking:croppedImageRect])));
+
+    snapshot.surface = createIOSurfaceFromImage(croppedSnapshotImage.get());
+    snapshot.imageSizeInBytes = snapshot.surface-&gt;totalBytes();
+    return snapshot;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_wheelEventWasNotHandledByWebCore:(NSEvent *)event
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -34,13 +34,13 @@
</span><span class="cx"> @class WKWebViewConfiguration;
</span><span class="cx"> 
</span><span class="cx"> namespace IPC {
</span><del>-    class DataReference;
</del><ins>+class DataReference;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    struct KeypressCommand;
-    class Image;
-    class SharedBuffer;
</del><ins>+class Image;
+class SharedBuffer;
+struct KeypressCommand;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> class WebContext;
</span><span class="cx"> struct ColorSpaceData;
</span><span class="cx"> struct EditorState;
</span><ins>+struct ViewSnapshot;
</ins><span class="cx"> struct WebPageConfiguration;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -82,7 +83,7 @@
</span><span class="cx"> - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
</span><span class="cx"> - (CALayer *)_acceleratedCompositingModeRootLayer;
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot;
</del><ins>+- (WebKit::ViewSnapshot)_takeViewSnapshot;
</ins><span class="cx"> - (void)_wheelEventWasNotHandledByWebCore:(NSEvent *)event;
</span><span class="cx"> 
</span><span class="cx"> - (void)_setAccessibilityWebProcessToken:(NSData *)data;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -46,8 +46,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    class Cursor;
-    struct ViewportAttributes;
</del><ins>+class Cursor;
+struct ViewportAttributes;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> class WebContextMenuProxy;
</span><span class="cx"> class WebEditCommandProxy;
</span><span class="cx"> class WebPopupMenuProxy;
</span><ins>+struct ViewSnapshot;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="cx"> class NativeWebTouchEvent;
</span><span class="lines">@@ -178,7 +179,7 @@
</span><span class="cx">     virtual void makeFirstResponder() = 0;
</span><span class="cx">     virtual void setAcceleratedCompositingRootLayer(LayerOrView *) = 0;
</span><span class="cx">     virtual LayerOrView *acceleratedCompositingRootLayer() const = 0;
</span><del>-    virtual RetainPtr&lt;CGImageRef&gt; takeViewSnapshot() = 0;
</del><ins>+    virtual ViewSnapshot takeViewSnapshot() = 0;
</ins><span class="cx">     virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&amp;) = 0;
</span><span class="cx">     virtual void clearCustomSwipeViews() = 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -4758,7 +4758,7 @@
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-RetainPtr&lt;CGImageRef&gt; WebPageProxy::takeViewSnapshot()
</del><ins>+ViewSnapshot WebPageProxy::takeViewSnapshot()
</ins><span class="cx"> {
</span><span class="cx">     return m_pageClient.takeViewSnapshot();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -171,6 +171,7 @@
</span><span class="cx"> struct EditorState;
</span><span class="cx"> struct PlatformPopupMenuData;
</span><span class="cx"> struct PrintInfo;
</span><ins>+struct ViewSnapshot;
</ins><span class="cx"> struct WebPopupItem;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIBRATION)
</span><span class="lines">@@ -1066,7 +1067,7 @@
</span><span class="cx">     void recordNavigationSnapshot();
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    RetainPtr&lt;CGImageRef&gt; takeViewSnapshot();
</del><ins>+    ViewSnapshot takeViewSnapshot();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">     virtual LayerOrView *acceleratedCompositingRootLayer() const override;
</span><span class="cx">     virtual LayerHostingMode viewLayerHostingMode() override { return LayerHostingMode::OutOfProcess; }
</span><span class="cx"> 
</span><del>-    virtual RetainPtr&lt;CGImageRef&gt; takeViewSnapshot() override;
</del><ins>+    virtual ViewSnapshot takeViewSnapshot() override;
</ins><span class="cx">     virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&amp;) override;
</span><span class="cx">     virtual void clearCustomSwipeViews() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import &quot;FindIndicator.h&quot;
</span><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;InteractionInformationAtPosition.h&quot;
</span><ins>+#import &quot;ViewSnapshotStore.h&quot;
</ins><span class="cx"> #import &quot;WKContentView.h&quot;
</span><span class="cx"> #import &quot;WKContentViewInteraction.h&quot;
</span><span class="cx"> #import &quot;WKWebViewInternal.h&quot;
</span><span class="lines">@@ -350,9 +351,9 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RetainPtr&lt;CGImageRef&gt; PageClientImpl::takeViewSnapshot()
</del><ins>+ViewSnapshot PageClientImpl::takeViewSnapshot()
</ins><span class="cx"> {
</span><del>-    return [m_contentView _takeViewSnapshot];
</del><ins>+    return [m_webView _takeViewSnapshot];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&amp; event)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #import &lt;WebCore/IOSurface.h&gt;
</span><del>-#import &lt;QuartzCore/QuartzCore.h&gt;
</del><ins>+#import &lt;QuartzCore/QuartzCorePrivate.h&gt;
</ins><span class="cx"> #import &lt;UIKit/UIScreenEdgePanGestureRecognizer.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIViewControllerTransitioning_Private.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIWebTouchEventsGestureRecognizer.h&gt;
</span><span class="lines">@@ -156,19 +156,12 @@
</span><span class="cx">     RetainPtr&lt;UIViewController&gt; snapshotViewController = adoptNS([[UIViewController alloc] init]);
</span><span class="cx">     m_snapshotView = adoptNS([[UIView alloc] initWithFrame:liveSwipeViewFrame]);
</span><span class="cx"> 
</span><del>-    ViewSnapshotStore::Snapshot snapshot;
-    if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot)) {
-#if USE(IOSURFACE)
-        if (snapshot.surface-&gt;setIsVolatile(false) == IOSurface::SurfaceState::Valid) {
-            [m_snapshotView layer].contents = (id)snapshot.surface-&gt;surface();
-            m_currentSwipeSnapshotSurface = snapshot.surface;
-        }
-#else
-        [m_snapshotView layer].contents = (id)snapshot.image.get();
-#endif
-    }
</del><ins>+    ViewSnapshot snapshot;
+    if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot) &amp;&amp; snapshot.hasImage())
+        [m_snapshotView layer].contents = [CAContext objectForSlot:snapshot.slotID];
+
</ins><span class="cx">     [m_snapshotView setBackgroundColor:[UIColor whiteColor]];
</span><del>-    [m_snapshotView layer].contentsGravity = @&quot;topLeft&quot;;
</del><ins>+    [m_snapshotView layer].contentsGravity = kCAGravityTopLeft;
</ins><span class="cx">     [m_snapshotView layer].contentsScale = m_liveSwipeView.window.screen.scale;
</span><span class="cx">     [snapshotViewController setView:m_snapshotView.get()];
</span><span class="cx"> 
</span><span class="lines">@@ -231,7 +224,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ViewSnapshotStore::Snapshot snapshot;
</del><ins>+    ViewSnapshot snapshot;
</ins><span class="cx">     m_targetRenderTreeSize = 0;
</span><span class="cx">     if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot))
</span><span class="cx">         m_targetRenderTreeSize = snapshot.renderTreeSize * swipeSnapshotRemovalRenderTreeSizeTargetFraction;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -78,7 +78,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&amp;)origin frame:(WebKit::WebFrameProxy&amp;)frame request:(WebKit::GeolocationPermissionRequestProxy&amp;)permissionRequest;
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot;
</del><span class="cx"> - (void)_setAccessibilityWebProcessToken:(NSData *)data;
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_scrollToRect:(CGRect)targetRect withOrigin:(CGPoint)origin minimumScrollDistance:(CGFloat)minimumScrollDistance;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -440,11 +440,6 @@
</span><span class="cx">     [[wrapper(_page-&gt;process().context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&amp;origin) frame:toAPI(&amp;frame) request:toAPI(&amp;permissionRequest) window:[self window]];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot
-{
-    return [_webView _takeViewSnapshot];
-}
-
</del><span class="cx"> - (BOOL)_scrollToRect:(CGRect)targetRect withOrigin:(CGPoint)origin minimumScrollDistance:(CGFloat)minimumScrollDistance
</span><span class="cx"> {
</span><span class="cx">     return [_webView _scrollToRect:targetRect origin:origin minimumScrollDistance:minimumScrollDistance];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOScpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.cpp (0 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.cpp        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+#include &quot;WebMemoryPressureHandlerIOS.h&quot;
+
+#if PLATFORM(IOS)
+
+#include &quot;ViewSnapshotStore.h&quot;
+#include &lt;dispatch/private.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebMemoryPressureHandler&amp; WebMemoryPressureHandler::shared()
+{
+    static NeverDestroyed&lt;WebMemoryPressureHandler&gt; memoryPressureHandler;
+    return memoryPressureHandler;
+}
+
+WebMemoryPressureHandler::WebMemoryPressureHandler()
+{
+    // FIXME: This should be able to share code with WebCore's MemoryPressureHandler (and be platform independent).
+    // Right now it cannot because WebKit1 and WebKit2 need to be able to coexist in the UI process,
+    // and you can only have one WebCore::MemoryPressureHandler.
+
+    dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_main_queue());
+    dispatch_set_context(source, this);
+    dispatch_source_set_event_handler(source, ^{
+        ViewSnapshotStore::shared().discardSnapshots();
+    });
+    dispatch_resume(source);
+}
+
+} // namespace WebKit
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOSh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h (0 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * 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 WebMemoryPressureHandler_h
+#define WebMemoryPressureHandler_h
+
+#if PLATFORM(IOS)
+
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+namespace WebKit {
+
+class WebMemoryPressureHandler {
+    friend class NeverDestroyed&lt;WebMemoryPressureHandler&gt;;
+public:
+    static WebMemoryPressureHandler&amp; shared();
+
+private:
+    WebMemoryPressureHandler();
+};
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
+
+#endif // WebMemoryPressureHandler_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">     virtual void exitAcceleratedCompositingMode();
</span><span class="cx">     virtual void updateAcceleratedCompositingMode(const LayerTreeContext&amp;);
</span><span class="cx"> 
</span><del>-    virtual RetainPtr&lt;CGImageRef&gt; takeViewSnapshot() override;
</del><ins>+    virtual ViewSnapshot takeViewSnapshot() override;
</ins><span class="cx">     virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&amp;) override;
</span><span class="cx">     virtual void clearCustomSwipeViews() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;NativeWebWheelEvent.h&quot;
</span><span class="cx"> #import &quot;StringUtilities.h&quot;
</span><ins>+#import &quot;ViewSnapshotStore.h&quot;
</ins><span class="cx"> #import &quot;WKAPICast.h&quot;
</span><span class="cx"> #import &quot;WKFullScreenWindowController.h&quot;
</span><span class="cx"> #import &quot;WKStringCF.h&quot;
</span><span class="lines">@@ -498,7 +499,7 @@
</span><span class="cx">     return m_wkView._acceleratedCompositingModeRootLayer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RetainPtr&lt;CGImageRef&gt; PageClientImpl::takeViewSnapshot()
</del><ins>+ViewSnapshot PageClientImpl::takeViewSnapshot()
</ins><span class="cx"> {
</span><span class="cx">     return [m_wkView _takeViewSnapshot];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -453,7 +453,7 @@
</span><span class="cx"> 
</span><span class="cx"> IOSurface* ViewGestureController::retrieveSnapshotForItem(WebBackForwardListItem* targetItem, FloatSize swipeLayerSize, float topContentInset)
</span><span class="cx"> {
</span><del>-    ViewSnapshotStore::Snapshot snapshot;
</del><ins>+    ViewSnapshot snapshot;
</ins><span class="cx">     if (!ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -632,7 +632,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ViewSnapshotStore::Snapshot snapshot;
</del><ins>+    ViewSnapshot snapshot;
</ins><span class="cx">     uint64_t renderTreeSize = 0;
</span><span class="cx">     if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot))
</span><span class="cx">         renderTreeSize = snapshot.renderTreeSize;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewSnapshotStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.h        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -33,11 +33,30 @@
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+OBJC_CLASS CAContext;
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class WebBackForwardListItem;
</span><span class="cx"> class WebPageProxy;
</span><span class="cx"> 
</span><ins>+struct ViewSnapshot {
+#if PLATFORM(MAC)
+    RefPtr&lt;WebCore::IOSurface&gt; surface;
+#endif
+#if PLATFORM(IOS)
+    uint32_t slotID = 0;
+#endif
+
+    std::chrono::steady_clock::time_point creationTime;
+    uint64_t renderTreeSize;
+    float deviceScaleFactor;
+    size_t imageSizeInBytes = 0;
+
+    void clearImage();
+    bool hasImage() const;
+};
+
</ins><span class="cx"> class ViewSnapshotStore {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(ViewSnapshotStore);
</span><span class="cx"> public:
</span><span class="lines">@@ -46,34 +65,26 @@
</span><span class="cx"> 
</span><span class="cx">     static ViewSnapshotStore&amp; shared();
</span><span class="cx"> 
</span><del>-    struct Snapshot {
-#if USE(IOSURFACE)
-        RefPtr&lt;WebCore::IOSurface&gt; surface;
-#else
-        RetainPtr&lt;CGImageRef&gt; image;
-#endif
-
-        std::chrono::steady_clock::time_point creationTime;
-        uint64_t renderTreeSize;
-        float deviceScaleFactor;
-
-        void clearImage();
-        bool hasImage() const;
-    };
-
</del><span class="cx">     void recordSnapshot(WebPageProxy&amp;);
</span><del>-    bool getSnapshot(WebBackForwardListItem*, Snapshot&amp;);
</del><ins>+    bool getSnapshot(WebBackForwardListItem*, ViewSnapshot&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void disableSnapshotting() { m_enabled = false; }
</span><span class="cx">     void enableSnapshotting() { m_enabled = true; }
</span><span class="cx"> 
</span><ins>+    void discardSnapshots();
+
+#if PLATFORM(IOS)
+    static CAContext *snapshottingContext();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     void pruneSnapshots(WebPageProxy&amp;);
</span><ins>+    void removeSnapshotImage(ViewSnapshot&amp;);
</ins><span class="cx"> 
</span><del>-    HashMap&lt;String, Snapshot&gt; m_snapshotMap;
</del><ins>+    HashMap&lt;String, ViewSnapshot&gt; m_snapshotMap;
</ins><span class="cx"> 
</span><span class="cx">     bool m_enabled;
</span><del>-    unsigned m_snapshotsWithImagesCount;
</del><ins>+    size_t m_snapshotCacheSize;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewSnapshotStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -32,20 +32,30 @@
</span><span class="cx"> #import &lt;WebCore/IOSurface.h&gt;
</span><span class="cx"> #import &lt;WebCore/UUID.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;QuartzCore/QuartzCorePrivate.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-static const int maximumSnapshotCount = 20;
</del><ins>+#if PLATFORM(MAC)
+static const size_t maximumSnapshotCacheSize = 400 * (1024 * 1024);
+#elif PLATFORM(IOS)
+// Because snapshots are not purgeable, we should keep fewer around.
+static const size_t maximumSnapshotCacheSize = 50 * (1024 * 1024);
+#endif
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> ViewSnapshotStore::ViewSnapshotStore()
</span><span class="cx">     : m_enabled(true)
</span><del>-    , m_snapshotsWithImagesCount(0)
</del><ins>+    , m_snapshotCacheSize(0)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ViewSnapshotStore::~ViewSnapshotStore()
</span><span class="cx"> {
</span><ins>+    discardSnapshots();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ViewSnapshotStore&amp; ViewSnapshotStore::shared()
</span><span class="lines">@@ -54,9 +64,36 @@
</span><span class="cx">     return store;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+CAContext *ViewSnapshotStore::snapshottingContext()
+{
+    static CAContext *context;
+    static dispatch_once_t onceToken;
+    dispatch_once(&amp;onceToken, ^{
+        NSDictionary *options = @{
+            kCAContextDisplayName: @&quot;WebKitSnapshotting&quot;,
+            kCAContextIgnoresHitTest: @YES,
+            kCAContextDisplayId : @20000
+        };
+        context = [[CAContext remoteContextWithOptions:options] retain];
+    });
+
+    return context;
+}
+#endif
+
+void ViewSnapshotStore::removeSnapshotImage(ViewSnapshot&amp; snapshot)
+{
+    if (!snapshot.hasImage())
+        return;
+
+    m_snapshotCacheSize -= snapshot.imageSizeInBytes;
+    snapshot.clearImage();
+}
+
</ins><span class="cx"> void ViewSnapshotStore::pruneSnapshots(WebPageProxy&amp; webPageProxy)
</span><span class="cx"> {
</span><del>-    if (m_snapshotsWithImagesCount &lt;= maximumSnapshotCount)
</del><ins>+    if (m_snapshotCacheSize &lt;= maximumSnapshotCacheSize)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     uint32_t currentIndex = webPageProxy.backForwardList().currentIndex();
</span><span class="lines">@@ -89,8 +126,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (mostDistantSnapshotIter != m_snapshotMap.end()) {
</span><del>-        mostDistantSnapshotIter-&gt;value.clearImage();
-        m_snapshotsWithImagesCount--;
</del><ins>+        removeSnapshotImage(mostDistantSnapshotIter-&gt;value);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -107,25 +143,9 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const auto&amp; snapshotIter = m_snapshotMap.find(oldestSnapshotUUID);
</span><del>-    snapshotIter-&gt;value.clearImage();
-    m_snapshotsWithImagesCount--;
</del><ins>+    removeSnapshotImage(snapshotIter-&gt;value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(IOSURFACE)
-static RefPtr&lt;IOSurface&gt; createIOSurfaceFromImage(CGImageRef image)
-{
-    size_t width = CGImageGetWidth(image);
-    size_t height = CGImageGetHeight(image);
-
-    RefPtr&lt;IOSurface&gt; surface = IOSurface::create(IntSize(width, height), ColorSpaceDeviceRGB);
-    RetainPtr&lt;CGContextRef&gt; surfaceContext = surface-&gt;ensurePlatformContext();
-    CGContextDrawImage(surfaceContext.get(), CGRectMake(0, 0, width, height), image);
-    CGContextFlush(surfaceContext.get());
-
-    return surface;
-}
-#endif
-
</del><span class="cx"> void ViewSnapshotStore::recordSnapshot(WebPageProxy&amp; webPageProxy)
</span><span class="cx"> {
</span><span class="cx">     WebBackForwardListItem* item = webPageProxy.backForwardList().currentItem();
</span><span class="lines">@@ -136,43 +156,29 @@
</span><span class="cx">     if (!item)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;CGImageRef&gt; snapshotImage = webPageProxy.takeViewSnapshot();
-    if (!snapshotImage)
-        return;
-
</del><span class="cx">     pruneSnapshots(webPageProxy);
</span><span class="cx"> 
</span><span class="cx">     String oldSnapshotUUID = item-&gt;snapshotUUID();
</span><span class="cx">     if (!oldSnapshotUUID.isEmpty()) {
</span><span class="cx">         const auto&amp; oldSnapshotIter = m_snapshotMap.find(oldSnapshotUUID);
</span><span class="cx">         if (oldSnapshotIter != m_snapshotMap.end()) {
</span><del>-            if (oldSnapshotIter-&gt;value.hasImage())
-                m_snapshotsWithImagesCount--;
</del><ins>+            removeSnapshotImage(oldSnapshotIter-&gt;value);
</ins><span class="cx">             m_snapshotMap.remove(oldSnapshotIter);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     item-&gt;setSnapshotUUID(createCanonicalUUIDString());
</span><del>-    
-    Snapshot snapshot;
</del><ins>+
+    ViewSnapshot snapshot = webPageProxy.takeViewSnapshot();
</ins><span class="cx">     snapshot.creationTime = std::chrono::steady_clock::now();
</span><span class="cx">     snapshot.renderTreeSize = webPageProxy.renderTreeSize();
</span><span class="cx">     snapshot.deviceScaleFactor = webPageProxy.deviceScaleFactor();
</span><span class="cx"> 
</span><del>-#if USE(IOSURFACE)
-    snapshot.surface = createIOSurfaceFromImage(snapshotImage.get());
-    snapshot.surface-&gt;setIsVolatile(true);
-#else
-    snapshot.image = snapshotImage;
-#endif
-
</del><span class="cx">     m_snapshotMap.add(item-&gt;snapshotUUID(), snapshot);
</span><del>-
-    if (snapshot.hasImage())
-        m_snapshotsWithImagesCount++;
</del><ins>+    m_snapshotCacheSize += snapshot.imageSizeInBytes;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ViewSnapshotStore::getSnapshot(WebBackForwardListItem* item, ViewSnapshotStore::Snapshot&amp; snapshot)
</del><ins>+bool ViewSnapshotStore::getSnapshot(WebBackForwardListItem* item, ViewSnapshot&amp; snapshot)
</ins><span class="cx"> {
</span><span class="cx">     if (item-&gt;snapshotUUID().isEmpty())
</span><span class="cx">         return false;
</span><span class="lines">@@ -184,22 +190,27 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ViewSnapshotStore::Snapshot::clearImage()
</del><ins>+void ViewSnapshotStore::discardSnapshots()
</ins><span class="cx"> {
</span><del>-#if USE(IOSURFACE)
-    surface = nullptr;
-#else
-    image = nullptr;
-#endif
</del><ins>+    for (auto&amp; snapshot : m_snapshotMap.values())
+        removeSnapshotImage(snapshot);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ViewSnapshotStore::Snapshot::hasImage() const
</del><ins>+bool ViewSnapshot::hasImage() const
</ins><span class="cx"> {
</span><del>-#if USE(IOSURFACE)
-    return surface;
-#else
-    return image;
</del><ins>+    return imageSizeInBytes;
+}
+
+void ViewSnapshot::clearImage()
+{
+#if PLATFORM(MAC)
+    surface = nullptr;
+#elif PLATFORM(IOS)
+    if (slotID)
+        [ViewSnapshotStore::snapshottingContext() deleteSlot:slotID];
+    slotID = 0;
</ins><span class="cx"> #endif
</span><ins>+    imageSizeInBytes = 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebContextMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -31,13 +31,11 @@
</span><span class="cx"> #import &quot;WKBrowsingContextControllerInternal.h&quot;
</span><span class="cx"> #import &quot;WKBrowsingContextControllerInternal.h&quot;
</span><span class="cx"> #import &quot;WebKitSystemInterface.h&quot;
</span><ins>+#import &quot;WebMemoryPressureHandlerIOS.h&quot;
</ins><span class="cx"> #import &quot;WebPageGroup.h&quot;
</span><span class="cx"> #import &quot;WebProcessCreationParameters.h&quot;
</span><span class="cx"> #import &quot;WebProcessMessages.h&quot;
</span><span class="cx"> #import &quot;WindowServerConnection.h&quot;
</span><del>-#if !PLATFORM(IOS)
-#import &lt;QuartzCore/CARemoteLayerServer.h&gt;
-#endif
</del><span class="cx"> #import &lt;WebCore/Color.h&gt;
</span><span class="cx"> #import &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #import &lt;WebCore/NotImplemented.h&gt;
</span><span class="lines">@@ -50,6 +48,10 @@
</span><span class="cx"> #import &quot;NetworkProcessProxy.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(IOS)
+#import &lt;QuartzCore/CARemoteLayerServer.h&gt;
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx"> 
</span><span class="cx"> #if __has_include(&lt;CFNetwork/CFURLProtocolPriv.h&gt;)
</span><span class="lines">@@ -129,6 +131,10 @@
</span><span class="cx"> {
</span><span class="cx">     registerUserDefaultsIfNeeded();
</span><span class="cx">     registerNotificationObservers();
</span><ins>+
+#if PLATFORM(IOS)
+    WebKit::WebMemoryPressureHandler::shared();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WebContext::platformDefaultApplicationCacheDirectory() const
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (168259 => 168260)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-05 07:08:42 UTC (rev 168259)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-05 07:37:35 UTC (rev 168260)
</span><span class="lines">@@ -509,6 +509,8 @@
</span><span class="cx">                 2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */; };
</span><span class="cx">                 2D2ADF0B16362DDB00197E47 /* PDFPluginAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */; };
</span><span class="cx">                 2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; };
</span><ins>+                2D3EF4421917646300034184 /* WebMemoryPressureHandlerIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.cpp */; };
+                2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */; };
</ins><span class="cx">                 2D429BFD1721E2C700EC681F /* PDFPluginPasswordField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */; };
</span><span class="cx">                 2D47B56C1810714E003A3AEE /* RemoteLayerBackingStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */; };
</span><span class="cx">                 2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47B56B1810714E003A3AEE /* RemoteLayerBackingStore.h */; };
</span><span class="lines">@@ -2332,6 +2334,8 @@
</span><span class="cx">                 2D2ADF0C16363DEC00197E47 /* PDFLayerControllerDetails.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFLayerControllerDetails.h; path = PDF/PDFLayerControllerDetails.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D2ADF0D16364D8200197E47 /* PDFPluginChoiceAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginChoiceAnnotation.h; path = PDF/PDFPluginChoiceAnnotation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginChoiceAnnotation.mm; path = PDF/PDFPluginChoiceAnnotation.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebMemoryPressureHandlerIOS.cpp; path = ios/WebMemoryPressureHandlerIOS.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebMemoryPressureHandlerIOS.h; path = ios/WebMemoryPressureHandlerIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D429BFA1721E2BA00EC681F /* PDFPluginPasswordField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginPasswordField.h; path = PDF/PDFPluginPasswordField.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginPasswordField.mm; path = PDF/PDFPluginPasswordField.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStore.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4503,6 +4507,8 @@
</span><span class="cx">                                 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */,
</span><span class="cx">                                 2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */,
</span><span class="cx">                                 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */,
</span><ins>+                                2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.cpp */,
+                                2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */,
</ins><span class="cx">                                 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */,
</span><span class="cx">                                 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */,
</span><span class="cx">                                 3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */,
</span><span class="lines">@@ -6719,6 +6725,7 @@
</span><span class="cx">                                 514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
</span><span class="cx">                                 CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
</span><span class="cx">                                 515E7730184015800007203F /* UniqueIDBDatabase.h in Headers */,
</span><ins>+                                2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */,
</ins><span class="cx">                                 B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
</span><span class="cx">                                 2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
</span><span class="cx">                                 371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */,
</span><span class="lines">@@ -8552,6 +8559,7 @@
</span><span class="cx">                                 BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */,
</span><span class="cx">                                 7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */,
</span><span class="cx">                                 2684055218B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp in Sources */,
</span><ins>+                                2D3EF4421917646300034184 /* WebMemoryPressureHandlerIOS.cpp in Sources */,
</ins><span class="cx">                                 511B24AA132E097200065A0C /* WebIconDatabase.cpp in Sources */,
</span><span class="cx">                                 51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */,
</span><span class="cx">                                 51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>