Changeset 176097 in webkit
- Timestamp:
- Nov 13, 2014, 3:27:26 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176096 r176097 1 2014-11-13 Simon Fraser <simon.fraser@apple.com> 2 3 [WK2] Fire a layout milestone on session restore based on render tree size 4 https://bugs.webkit.org/show_bug.cgi?id=138711 5 rdar://problem/16033854 6 7 Reviewed by Anders Carlsson. 8 9 New layout milestone for session restore based on render tree size. Only used 10 in WK2 at present. 11 12 * page/LayoutMilestones.h: 13 1 14 2014-11-13 Dan Bernstein <mitz@apple.com> 2 15 -
trunk/Source/WebCore/page/LayoutMilestones.h
r149317 r176097 38 38 DidFirstFlushForHeaderLayer = 1 << 3, 39 39 DidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4, 40 DidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5 40 DidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5, 41 ReachedSessionRestorationRenderTreeSizeThreshold = 1 << 6 // FIXME: only implemented by WK2 currently. 41 42 }; 42 43 -
trunk/Source/WebKit2/ChangeLog
r176086 r176097 1 2014-11-13 Simon Fraser <simon.fraser@apple.com> 2 3 [WK2] Fire a layout milestone on session restore based on render tree size 4 https://bugs.webkit.org/show_bug.cgi?id=138711 5 rdar://problem/16033854 6 7 Reviewed by Anders Carlsson. 8 9 Add a session-restore layout milestone which fires after restoring a session, 10 when the render tree size reaches 50% of the size saved in the session state. 11 12 * Shared/SessionState.h: Add renderTreeSize. 13 * UIProcess/API/Cocoa/WKWebView.mm: 14 (layoutMilestones): Translate from SPI to WebCore milestones. 15 * UIProcess/API/Cocoa/WKWebViewPrivate.h: New iOS-only milestone, er, event. 16 * UIProcess/Cocoa/NavigationState.mm: 17 (WebKit::renderingProgressEvents): Translate from WebCore milestone to rendering event. 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::WebPageProxy::WebPageProxy): Init stuff. 20 (WebKit::WebPageProxy::sessionState): 21 (WebKit::WebPageProxy::restoreFromSessionState): Zero out the target render tree size, 22 then get it out of session state and set the flag to say that we haven't reached it yet. 23 (WebKit::WebPageProxy::listenForLayoutMilestones): Set a flag to know that we should fire 24 the milestone. The other milestones get sent directly to WebCore. 25 * UIProcess/WebPageProxy.h: 26 * UIProcess/ios/WebPageProxyIOS.mm: 27 (WebKit::exceedsRenderTreeSizeSizeThreshold): Return true when we've reached 50%. 28 (WebKit::WebPageProxy::didCommitLayerTree): Fire the milestone when appropriate. 29 * UIProcess/mac/LegacySessionStateCoding.cpp: Rev the session state data for iOS 30 (where doing so is less disruptive). Standardize some CFString constants. 31 (WebKit::encodeSessionHistory): Wrap for legibility. 32 (WebKit::encodeLegacySessionState): Make a CFNumber for render tree size, and store 33 it in the root dictionary. 34 (WebKit::decodeBackForwardTreeNode): Move a comment to match another similar block. 35 (WebKit::decodeLegacySessionState): Decode render tree size and store it. 36 1 37 2014-11-13 Tim Horton <timothy_horton@apple.com> 2 38 -
trunk/Source/WebKit2/Shared/SessionState.h
r170989 r176097 141 141 struct SessionState { 142 142 BackForwardListState backForwardListState; 143 uint64_t renderTreeSize; 143 144 WebCore::URL provisionalURL; 144 145 }; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r175980 r176097 1809 1809 milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold; 1810 1810 1811 if (events & _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold) 1812 milestones |= WebCore::ReachedSessionRestorationRenderTreeSizeThreshold; 1813 1811 1814 return milestones; 1812 1815 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r173233 r176097 31 31 _WKRenderingProgressEventFirstLayout = 1 << 0, 32 32 _WKRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2, 33 _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA) = 1 << 3 33 34 } WK_ENUM_AVAILABLE(10_10, 8_0); 34 35 -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r171858 r176097 674 674 events |= _WKRenderingProgressEventFirstPaintWithSignificantArea; 675 675 676 if (milestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold) 677 events |= _WKRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold; 678 676 679 return events; 677 680 } -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r176011 r176097 362 362 , m_pageCount(0) 363 363 , m_renderTreeSize(0) 364 , m_sessionRestorationRenderTreeSize(0) 365 , m_wantsSessionRestorationRenderTreeSizeThresholdEvent(false) 366 , m_hitRenderTreeSizeThreshold(false) 364 367 , m_shouldSendEventsSynchronously(false) 365 368 , m_suppressVisibilityUpdates(false) … … 1932 1935 sessionState.provisionalURL = URL(URL(), provisionalURLString); 1933 1936 1937 sessionState.renderTreeSize = renderTreeSize(); 1934 1938 return sessionState; 1935 1939 } … … 1937 1941 uint64_t WebPageProxy::restoreFromSessionState(SessionState sessionState, bool navigate) 1938 1942 { 1943 m_sessionRestorationRenderTreeSize = 0; 1944 m_hitRenderTreeSizeThreshold = false; 1945 1939 1946 bool hasBackForwardList = !!sessionState.backForwardListState.currentIndex; 1940 1947 … … 1948 1955 } 1949 1956 1957 // FIXME: Navigating should be separate from state restoration. 1950 1958 if (navigate) { 1951 // FIXME: Navigating should be separate from state restoration. 1959 m_sessionRestorationRenderTreeSize = sessionState.renderTreeSize; 1960 if (!m_sessionRestorationRenderTreeSize) 1961 m_hitRenderTreeSizeThreshold = true; // If we didn't get data on renderTreeSize, just don't fire the milestone. 1952 1962 1953 1963 if (!sessionState.provisionalURL.isNull()) … … 2108 2118 if (!isValid()) 2109 2119 return; 2120 2121 m_wantsSessionRestorationRenderTreeSizeThresholdEvent = milestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold; 2110 2122 2111 2123 m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r176011 r176097 1558 1558 1559 1559 uint64_t m_renderTreeSize; 1560 uint64_t m_sessionRestorationRenderTreeSize; 1561 bool m_wantsSessionRestorationRenderTreeSizeThresholdEvent; 1562 bool m_hitRenderTreeSizeThreshold; 1560 1563 1561 1564 bool m_shouldSendEventsSynchronously; -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r175153 r176097 333 333 } 334 334 335 static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t committedSize) 336 { 337 const double thesholdSizeFraction = 0.5; // Empirically-derived. 338 return committedSize > thresholdSize * thesholdSizeFraction; 339 } 340 335 341 void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction) 336 342 { … … 350 356 351 357 m_pageClient.didCommitLayerTree(layerTreeTransaction); 358 359 if (m_wantsSessionRestorationRenderTreeSizeThresholdEvent && !m_hitRenderTreeSizeThreshold 360 && exceedsRenderTreeSizeSizeThreshold(m_sessionRestorationRenderTreeSize, layerTreeTransaction.renderTreeSize())) { 361 m_hitRenderTreeSizeThreshold = true; 362 m_loaderClient->didLayout(this, WebCore::ReachedSessionRestorationRenderTreeSizeThreshold, nullptr); 363 } 352 364 } 353 365 -
trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp
r174400 r176097 41 41 static const CFStringRef sessionHistoryKey = CFSTR("SessionHistory"); 42 42 static const CFStringRef provisionalURLKey = CFSTR("ProvisionalURL"); 43 static const CFStringRef renderTreeSizeKey = CFSTR("RenderTreeSize"); 43 44 44 45 // Session history keys. … … 51 52 // Session history entry keys. 52 53 static const CFStringRef sessionHistoryEntryURLKey = CFSTR("SessionHistoryEntryURL"); 53 static CFStringRef sessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle");54 static CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL");55 static CFStringRef sessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData");54 static const CFStringRef sessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle"); 55 static const CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL"); 56 static const CFStringRef sessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData"); 56 57 57 58 // Session history entry data. … … 427 428 auto data = encodeSessionHistoryEntryData(item.pageState.mainFrameState); 428 429 429 auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryOriginalURLKey, originalURL.get() }, { sessionHistoryEntryDataKey, data.get() } }); 430 auto entryDictionary = createDictionary({ 431 { sessionHistoryEntryURLKey, url.get() }, 432 { sessionHistoryEntryTitleKey, title.get() }, 433 { sessionHistoryEntryOriginalURLKey, originalURL.get() }, 434 { sessionHistoryEntryDataKey, data.get() }, 435 }); 430 436 431 437 CFArrayAppendValue(entries.get(), entryDictionary.get()); … … 442 448 auto sessionHistoryDictionary = encodeSessionHistory(sessionState.backForwardListState); 443 449 auto provisionalURLString = sessionState.provisionalURL.isNull() ? nullptr : sessionState.provisionalURL.string().createCFString(); 450 RetainPtr<CFNumberRef> renderTreeSizeNumber(adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &sessionState.renderTreeSize))); 444 451 445 452 RetainPtr<CFDictionaryRef> stateDictionary; 446 if (provisionalURLString) 447 stateDictionary = createDictionary({ { sessionHistoryKey, sessionHistoryDictionary.get() }, { provisionalURLKey, provisionalURLString.get() } }); 448 else 449 stateDictionary = createDictionary({ { sessionHistoryKey, sessionHistoryDictionary.get() } }); 453 if (provisionalURLString) { 454 stateDictionary = createDictionary({ 455 { sessionHistoryKey, sessionHistoryDictionary.get() }, 456 { provisionalURLKey, provisionalURLString.get() }, 457 { renderTreeSizeKey, renderTreeSizeNumber.get() } 458 }); 459 } else { 460 stateDictionary = createDictionary({ 461 { sessionHistoryKey, sessionHistoryDictionary.get() }, 462 { renderTreeSizeKey, renderTreeSizeNumber.get() } 463 }); 464 } 450 465 451 466 auto writeStream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(kCFAllocatorDefault, nullptr)); … … 903 918 decoder >> frameState.target; 904 919 920 #if PLATFORM(IOS) 905 921 // FIXME: iOS should not use the legacy session state decoder. 906 #if PLATFORM(IOS)907 922 decoder >> frameState.exposedContentRect; 908 923 decoder >> frameState.unobscuredContentRect; … … 1088 1103 } 1089 1104 1105 if (auto renderTreeSize = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(sessionStateDictionary.get(), renderTreeSizeKey))) 1106 CFNumberGetValue(renderTreeSize, kCFNumberSInt64Type, &sessionState.renderTreeSize); 1107 else 1108 sessionState.renderTreeSize = 0; 1109 1090 1110 return true; 1091 1111 }
Note:
See TracChangeset
for help on using the changeset viewer.