<!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>[176097] trunk/Source</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/176097">176097</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-11-13 15:27:26 -0800 (Thu, 13 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Fire a layout milestone on session restore based on render tree size
https://bugs.webkit.org/show_bug.cgi?id=138711
rdar://problem/16033854

Reviewed by Anders Carlsson.
Source/WebCore:

New layout milestone for session restore based on render tree size. Only used
in WK2 at present.

* page/LayoutMilestones.h:

Source/WebKit2:

Add a session-restore layout milestone which fires after restoring a session,
when the render tree size reaches 50% of the size saved in the session state.

* Shared/SessionState.h: Add renderTreeSize.
* UIProcess/API/Cocoa/WKWebView.mm:
(layoutMilestones): Translate from SPI to WebCore milestones.
* UIProcess/API/Cocoa/WKWebViewPrivate.h: New iOS-only milestone, er, event.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::renderingProgressEvents): Translate from WebCore milestone to rendering event.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Init stuff.
(WebKit::WebPageProxy::sessionState):
(WebKit::WebPageProxy::restoreFromSessionState): Zero out the target render tree size,
then get it out of session state and set the flag to say that we haven't reached it yet.
(WebKit::WebPageProxy::listenForLayoutMilestones): Set a flag to know that we should fire
the milestone. The other milestones get sent directly to WebCore.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::exceedsRenderTreeSizeSizeThreshold): Return true when we've reached 50%.
(WebKit::WebPageProxy::didCommitLayerTree): Fire the milestone when appropriate.
* UIProcess/mac/LegacySessionStateCoding.cpp: Rev the session state data for iOS
(where doing so is less disruptive). Standardize some CFString constants.
(WebKit::encodeSessionHistory): Wrap for legibility.
(WebKit::encodeLegacySessionState): Make a CFNumber for render tree size, and store
it in the root dictionary.
(WebKit::decodeBackForwardTreeNode): Move a comment to match another similar block.
(WebKit::decodeLegacySessionState): Decode render tree size and store it.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageLayoutMilestonesh">trunk/Source/WebCore/page/LayoutMilestones.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionStateh">trunk/Source/WebKit2/Shared/SessionState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStatemm">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm</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="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp">trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebCore/ChangeLog        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-11-13  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [WK2] Fire a layout milestone on session restore based on render tree size
+        https://bugs.webkit.org/show_bug.cgi?id=138711
+        rdar://problem/16033854
+
+        Reviewed by Anders Carlsson.
+
+        New layout milestone for session restore based on render tree size. Only used
+        in WK2 at present.
+
+        * page/LayoutMilestones.h:
+
</ins><span class="cx"> 2014-11-13  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Policy client not called for navigations through the page cache
</span></span></pre></div>
<a id="trunkSourceWebCorepageLayoutMilestonesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/LayoutMilestones.h (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/LayoutMilestones.h        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebCore/page/LayoutMilestones.h        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -37,7 +37,8 @@
</span><span class="cx">     DidHitRelevantRepaintedObjectsAreaThreshold = 1 &lt;&lt; 2,
</span><span class="cx">     DidFirstFlushForHeaderLayer = 1 &lt;&lt; 3,
</span><span class="cx">     DidFirstLayoutAfterSuppressedIncrementalRendering = 1 &lt;&lt; 4,
</span><del>-    DidFirstPaintAfterSuppressedIncrementalRendering = 1 &lt;&lt; 5
</del><ins>+    DidFirstPaintAfterSuppressedIncrementalRendering = 1 &lt;&lt; 5,
+    ReachedSessionRestorationRenderTreeSizeThreshold = 1 &lt;&lt; 6 // FIXME: only implemented by WK2 currently.
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef unsigned LayoutMilestones;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-11-13  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [WK2] Fire a layout milestone on session restore based on render tree size
+        https://bugs.webkit.org/show_bug.cgi?id=138711
+        rdar://problem/16033854
+
+        Reviewed by Anders Carlsson.
+        
+        Add a session-restore layout milestone which fires after restoring a session,
+        when the render tree size reaches 50% of the size saved in the session state.
+
+        * Shared/SessionState.h: Add renderTreeSize.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (layoutMilestones): Translate from SPI to WebCore milestones.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h: New iOS-only milestone, er, event.
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::renderingProgressEvents): Translate from WebCore milestone to rendering event.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy): Init stuff.
+        (WebKit::WebPageProxy::sessionState):
+        (WebKit::WebPageProxy::restoreFromSessionState): Zero out the target render tree size,
+        then get it out of session state and set the flag to say that we haven't reached it yet.
+        (WebKit::WebPageProxy::listenForLayoutMilestones): Set a flag to know that we should fire
+        the milestone. The other milestones get sent directly to WebCore.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::exceedsRenderTreeSizeSizeThreshold): Return true when we've reached 50%.
+        (WebKit::WebPageProxy::didCommitLayerTree): Fire the milestone when appropriate.
+        * UIProcess/mac/LegacySessionStateCoding.cpp: Rev the session state data for iOS
+        (where doing so is less disruptive). Standardize some CFString constants.
+        (WebKit::encodeSessionHistory): Wrap for legibility.
+        (WebKit::encodeLegacySessionState): Make a CFNumber for render tree size, and store
+        it in the root dictionary.
+        (WebKit::decodeBackForwardTreeNode): Move a comment to match another similar block.
+        (WebKit::decodeLegacySessionState): Decode render tree size and store it.
+
</ins><span class="cx"> 2014-11-13  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Adjust the WKBundlePageOverlay Data Detectors SPI
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SessionState.h (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionState.h        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/Shared/SessionState.h        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -140,6 +140,7 @@
</span><span class="cx"> 
</span><span class="cx"> struct SessionState {
</span><span class="cx">     BackForwardListState backForwardListState;
</span><ins>+    uint64_t renderTreeSize;
</ins><span class="cx">     WebCore::URL provisionalURL;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -1808,6 +1808,9 @@
</span><span class="cx">     if (events &amp; _WKRenderingProgressEventFirstPaintWithSignificantArea)
</span><span class="cx">         milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
</span><span class="cx"> 
</span><ins>+    if (events &amp; _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold)
+        milestones |= WebCore::ReachedSessionRestorationRenderTreeSizeThreshold;
+
</ins><span class="cx">     return milestones;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> typedef NS_OPTIONS(NSUInteger, _WKRenderingProgressEvents) {
</span><span class="cx">     _WKRenderingProgressEventFirstLayout = 1 &lt;&lt; 0,
</span><span class="cx">     _WKRenderingProgressEventFirstPaintWithSignificantArea = 1 &lt;&lt; 2,
</span><ins>+    _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA) = 1 &lt;&lt; 3
</ins><span class="cx"> } WK_ENUM_AVAILABLE(10_10, 8_0);
</span><span class="cx"> 
</span><span class="cx"> typedef NS_ENUM(NSInteger, _WKPaginationMode) {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -673,6 +673,9 @@
</span><span class="cx">     if (milestones &amp; WebCore::DidHitRelevantRepaintedObjectsAreaThreshold)
</span><span class="cx">         events |= _WKRenderingProgressEventFirstPaintWithSignificantArea;
</span><span class="cx"> 
</span><ins>+    if (milestones &amp; WebCore::ReachedSessionRestorationRenderTreeSizeThreshold)
+        events |= _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold;
+
</ins><span class="cx">     return events;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -361,6 +361,9 @@
</span><span class="cx">     , m_isShowingNavigationGestureSnapshot(false)
</span><span class="cx">     , m_pageCount(0)
</span><span class="cx">     , m_renderTreeSize(0)
</span><ins>+    , m_sessionRestorationRenderTreeSize(0)
+    , m_wantsSessionRestorationRenderTreeSizeThresholdEvent(false)
+    , m_hitRenderTreeSizeThreshold(false)
</ins><span class="cx">     , m_shouldSendEventsSynchronously(false)
</span><span class="cx">     , m_suppressVisibilityUpdates(false)
</span><span class="cx">     , m_autoSizingShouldExpandToViewHeight(false)
</span><span class="lines">@@ -1931,11 +1934,15 @@
</span><span class="cx">     if (!provisionalURLString.isEmpty())
</span><span class="cx">         sessionState.provisionalURL = URL(URL(), provisionalURLString);
</span><span class="cx"> 
</span><ins>+    sessionState.renderTreeSize = renderTreeSize();
</ins><span class="cx">     return sessionState;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t WebPageProxy::restoreFromSessionState(SessionState sessionState, bool navigate)
</span><span class="cx"> {
</span><ins>+    m_sessionRestorationRenderTreeSize = 0;
+    m_hitRenderTreeSizeThreshold = false;
+
</ins><span class="cx">     bool hasBackForwardList = !!sessionState.backForwardListState.currentIndex;
</span><span class="cx"> 
</span><span class="cx">     if (hasBackForwardList) {
</span><span class="lines">@@ -1947,8 +1954,11 @@
</span><span class="cx">         process().send(Messages::WebPage::RestoreSession(m_backForwardList-&gt;itemStates()), m_pageID);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // FIXME: Navigating should be separate from state restoration.
</ins><span class="cx">     if (navigate) {
</span><del>-        // FIXME: Navigating should be separate from state restoration.
</del><ins>+        m_sessionRestorationRenderTreeSize = sessionState.renderTreeSize;
+        if (!m_sessionRestorationRenderTreeSize)
+            m_hitRenderTreeSizeThreshold = true; // If we didn't get data on renderTreeSize, just don't fire the milestone.
</ins><span class="cx"> 
</span><span class="cx">         if (!sessionState.provisionalURL.isNull())
</span><span class="cx">             return loadRequest(sessionState.provisionalURL);
</span><span class="lines">@@ -2107,6 +2117,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><ins>+    
+    m_wantsSessionRestorationRenderTreeSizeThresholdEvent = milestones &amp; WebCore::ReachedSessionRestorationRenderTreeSizeThreshold;
</ins><span class="cx"> 
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -1557,6 +1557,9 @@
</span><span class="cx">     WebCore::IntRect m_visibleScrollerThumbRect;
</span><span class="cx"> 
</span><span class="cx">     uint64_t m_renderTreeSize;
</span><ins>+    uint64_t m_sessionRestorationRenderTreeSize;
+    bool m_wantsSessionRestorationRenderTreeSizeThresholdEvent;
+    bool m_hitRenderTreeSizeThreshold;
</ins><span class="cx"> 
</span><span class="cx">     bool m_shouldSendEventsSynchronously;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -332,6 +332,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t committedSize)
+{
+    const double thesholdSizeFraction = 0.5; // Empirically-derived.
+    return committedSize &gt; thresholdSize * thesholdSizeFraction;
+}
+
</ins><span class="cx"> void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp; layerTreeTransaction)
</span><span class="cx"> {
</span><span class="cx">     m_pageExtendedBackgroundColor = layerTreeTransaction.pageExtendedBackgroundColor();
</span><span class="lines">@@ -349,6 +355,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_pageClient.didCommitLayerTree(layerTreeTransaction);
</span><ins>+
+    if (m_wantsSessionRestorationRenderTreeSizeThresholdEvent &amp;&amp; !m_hitRenderTreeSizeThreshold
+        &amp;&amp; exceedsRenderTreeSizeSizeThreshold(m_sessionRestorationRenderTreeSize, layerTreeTransaction.renderTreeSize())) {
+        m_hitRenderTreeSizeThreshold = true;
+        m_loaderClient-&gt;didLayout(this, WebCore::ReachedSessionRestorationRenderTreeSizeThreshold, nullptr);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, std::function&lt;void (const WebCore::IntPoint&amp;, uint32_t, uint32_t, uint32_t, CallbackBase::Error)&gt; callbackFunction)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacLegacySessionStateCodingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (176096 => 176097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2014-11-13 23:22:50 UTC (rev 176096)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp        2014-11-13 23:27:26 UTC (rev 176097)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> static const CFStringRef sessionHistoryKey = CFSTR(&quot;SessionHistory&quot;);
</span><span class="cx"> static const CFStringRef provisionalURLKey = CFSTR(&quot;ProvisionalURL&quot;);
</span><ins>+static const CFStringRef renderTreeSizeKey = CFSTR(&quot;RenderTreeSize&quot;);
</ins><span class="cx"> 
</span><span class="cx"> // Session history keys.
</span><span class="cx"> static const uint32_t sessionHistoryVersion = 1;
</span><span class="lines">@@ -50,9 +51,9 @@
</span><span class="cx"> 
</span><span class="cx"> // Session history entry keys.
</span><span class="cx"> static const CFStringRef sessionHistoryEntryURLKey = CFSTR(&quot;SessionHistoryEntryURL&quot;);
</span><del>-static CFStringRef sessionHistoryEntryTitleKey = CFSTR(&quot;SessionHistoryEntryTitle&quot;);
-static CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR(&quot;SessionHistoryEntryOriginalURL&quot;);
-static CFStringRef sessionHistoryEntryDataKey = CFSTR(&quot;SessionHistoryEntryData&quot;);
</del><ins>+static const CFStringRef sessionHistoryEntryTitleKey = CFSTR(&quot;SessionHistoryEntryTitle&quot;);
+static const CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR(&quot;SessionHistoryEntryOriginalURL&quot;);
+static const CFStringRef sessionHistoryEntryDataKey = CFSTR(&quot;SessionHistoryEntryData&quot;);
</ins><span class="cx"> 
</span><span class="cx"> // Session history entry data.
</span><span class="cx"> const uint32_t sessionHistoryEntryDataVersion = 2;
</span><span class="lines">@@ -426,7 +427,12 @@
</span><span class="cx">         auto originalURL = item.pageState.mainFrameState.originalURLString.createCFString();
</span><span class="cx">         auto data = encodeSessionHistoryEntryData(item.pageState.mainFrameState);
</span><span class="cx"> 
</span><del>-        auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryOriginalURLKey, originalURL.get() }, { sessionHistoryEntryDataKey, data.get() } });
</del><ins>+        auto entryDictionary = createDictionary({
+            { sessionHistoryEntryURLKey, url.get() },
+            { sessionHistoryEntryTitleKey, title.get() },
+            { sessionHistoryEntryOriginalURLKey, originalURL.get() },
+            { sessionHistoryEntryDataKey, data.get() },
+        });
</ins><span class="cx"> 
</span><span class="cx">         CFArrayAppendValue(entries.get(), entryDictionary.get());
</span><span class="cx">     }
</span><span class="lines">@@ -441,12 +447,21 @@
</span><span class="cx"> {
</span><span class="cx">     auto sessionHistoryDictionary = encodeSessionHistory(sessionState.backForwardListState);
</span><span class="cx">     auto provisionalURLString = sessionState.provisionalURL.isNull() ? nullptr : sessionState.provisionalURL.string().createCFString();
</span><ins>+    RetainPtr&lt;CFNumberRef&gt; renderTreeSizeNumber(adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &amp;sessionState.renderTreeSize)));
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CFDictionaryRef&gt; stateDictionary;
</span><del>-    if (provisionalURLString)
-        stateDictionary = createDictionary({ { sessionHistoryKey, sessionHistoryDictionary.get() }, { provisionalURLKey, provisionalURLString.get() } });
-    else
-        stateDictionary = createDictionary({ { sessionHistoryKey, sessionHistoryDictionary.get() } });
</del><ins>+    if (provisionalURLString) {
+        stateDictionary = createDictionary({
+            { sessionHistoryKey, sessionHistoryDictionary.get() },
+            { provisionalURLKey, provisionalURLString.get() },
+            { renderTreeSizeKey, renderTreeSizeNumber.get() }
+        });
+    } else {
+        stateDictionary = createDictionary({
+            { sessionHistoryKey, sessionHistoryDictionary.get() },
+            { renderTreeSizeKey, renderTreeSizeNumber.get() }
+        });
+    }
</ins><span class="cx"> 
</span><span class="cx">     auto writeStream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(kCFAllocatorDefault, nullptr));
</span><span class="cx">     if (!writeStream)
</span><span class="lines">@@ -902,8 +917,8 @@
</span><span class="cx"> 
</span><span class="cx">     decoder &gt;&gt; frameState.target;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
</ins><span class="cx">     // FIXME: iOS should not use the legacy session state decoder.
</span><del>-#if PLATFORM(IOS)
</del><span class="cx">     decoder &gt;&gt; frameState.exposedContentRect;
</span><span class="cx">     decoder &gt;&gt; frameState.unobscuredContentRect;
</span><span class="cx">     decoder &gt;&gt; frameState.minimumLayoutSizeInScrollViewCoordinates;
</span><span class="lines">@@ -1087,6 +1102,11 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (auto renderTreeSize = dynamic_cf_cast&lt;CFNumberRef&gt;(CFDictionaryGetValue(sessionStateDictionary.get(), renderTreeSizeKey)))
+        CFNumberGetValue(renderTreeSize, kCFNumberSInt64Type, &amp;sessionState.renderTreeSize);
+    else
+        sessionState.renderTreeSize = 0;
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>