Changeset 233561 in webkit
- Timestamp:
- Jul 5, 2018, 9:56:40 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r233553 r233561 1 2018-07-05 Simon Fraser <simon.fraser@apple.com> 2 3 Address two possible causes of missing tiles in iOS Safari, and add logging to gather more data about other possible causes 4 https://bugs.webkit.org/show_bug.cgi?id=187376 5 rdar://problem/40941118 6 7 Reviewed by Tim Horton. 8 9 We have continual reports of users experiencing missing tiles in MobileSafari, where loading a page 10 shows the tiles at the top, but we don't render new tiles as the user scrolls down. This is consistent 11 with failing to dispatch visible content rect updates via -[WKWebView _updateVisibleContentRects]. 12 13 This patch addresses two possible (but unlikely) causes. First, it resets _currentlyAdjustingScrollViewInsetsForKeyboard 14 after a web process crash. Second, it catches exceptions thrown by [webView _updateVisibleContentRects] 15 and resets _hasScheduledVisibleRectUpdate. 16 17 This patch also adds release logging that fires if over 1s has elapsed between scheduling 18 a visible content rect update and trying to re-schedule, and logging for all reasons that 19 -_updateVisibleContentRects returns early. 20 21 * UIProcess/API/Cocoa/WKWebView.mm: 22 (-[WKWebView _initializeWithConfiguration:]): 23 (-[WKWebView _processDidExit]): 24 (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]): 25 (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): 26 (-[WKWebView _updateVisibleContentRects]): 27 1 28 2018-07-05 Olivia Barnett <obarnett@apple.com> 2 29 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r233552 r233561 182 182 #if PLATFORM(IOS) 183 183 static const uint32_t firstSDKVersionWithLinkPreviewEnabledByDefault = 0xA0000; 184 static const Seconds delayBeforeNoVisibleContentsRectsLogging = 1_s; 184 185 #endif 185 186 … … 357 358 358 359 _WKDragInteractionPolicy _dragInteractionPolicy; 360 361 // For release-logging for <rdar://problem/39281269>. 362 MonotonicTime _timeOfRequestForVisibleContentRectUpdate; 363 MonotonicTime _timeOfLastVisibleContentRectUpdate; 359 364 #endif 360 365 #if PLATFORM(MAC) … … 727 732 #if PLATFORM(IOS) 728 733 _dragInteractionPolicy = _WKDragInteractionPolicyDefault; 734 735 _timeOfRequestForVisibleContentRectUpdate = MonotonicTime::now(); 736 _timeOfLastVisibleContentRectUpdate = MonotonicTime::now(); 729 737 #if PLATFORM(WATCHOS) 730 738 _allowsViewportShrinkToFit = YES; … … 1693 1701 _delayUpdateVisibleContentRects = NO; 1694 1702 _hadDelayedUpdateVisibleContentRects = NO; 1703 _currentlyAdjustingScrollViewInsetsForKeyboard = NO; 1695 1704 _lastSentViewLayoutSize = std::nullopt; 1696 1705 _lastSentMaximumUnobscuredSize = std::nullopt; … … 2712 2721 [CATransaction addCommitHandler:[retainedSelf] { 2713 2722 WKWebView *webView = retainedSelf.get(); 2714 if (![webView _isValid]) 2723 if (![webView _isValid]) { 2724 RELEASE_LOG_IF(webView._page && webView._page->isAlwaysOnLoggingAllowed(), ViewState, "In CATransaction preCommitHandler, WKWebView %p is invalid", webView); 2715 2725 return; 2716 [webView _updateVisibleContentRects]; 2726 } 2727 2728 @try { 2729 [webView _updateVisibleContentRects]; 2730 } @catch (NSException *exception) { 2731 RELEASE_LOG_IF(webView._page && webView._page->isAlwaysOnLoggingAllowed(), ViewState, "In CATransaction preCommitHandler, -[WKWebView %p _updateVisibleContentRects] threw an exception", webView); 2732 } 2717 2733 webView->_hasScheduledVisibleRectUpdate = NO; 2718 2734 } forPhase:kCATransactionPhasePreCommit]; … … 2721 2737 - (void)_scheduleVisibleContentRectUpdateAfterScrollInView:(UIScrollView *)scrollView 2722 2738 { 2739 RELEASE_ASSERT(isMainThread()); 2740 2723 2741 _visibleContentRectUpdateScheduledFromScrollViewInStableState = [self _scrollViewIsInStableState:scrollView]; 2724 2742 2725 if (_hasScheduledVisibleRectUpdate) 2743 if (_hasScheduledVisibleRectUpdate) { 2744 auto timeNow = MonotonicTime::now(); 2745 if ((timeNow - _timeOfRequestForVisibleContentRectUpdate) > delayBeforeNoVisibleContentsRectsLogging) { 2746 RELEASE_LOG_IF_ALLOWED("-[WKWebView %p _scheduleVisibleContentRectUpdateAfterScrollInView]: _hasScheduledVisibleRectUpdate is true but haven't updated visible content rects for %.2fs (last update was %.2fs ago)", 2747 self, (timeNow - _timeOfRequestForVisibleContentRectUpdate).value(), (timeNow - _timeOfLastVisibleContentRectUpdate).value()); 2748 } 2726 2749 return; 2750 } 2727 2751 2728 2752 _hasScheduledVisibleRectUpdate = YES; 2753 _timeOfRequestForVisibleContentRectUpdate = MonotonicTime::now(); 2729 2754 2730 2755 CATransactionPhase transactionPhase = [CATransaction currentPhase]; … … 2787 2812 [_passwordView setFrame:self.bounds]; 2788 2813 [_customContentView web_computedContentInsetDidChange]; 2814 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _updateVisibleContentRects:] - usesStandardContentView is NO, bailing", self); 2789 2815 return; 2790 2816 } … … 2792 2818 if (_delayUpdateVisibleContentRects) { 2793 2819 _hadDelayedUpdateVisibleContentRects = YES; 2820 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _updateVisibleContentRects:] - _delayUpdateVisibleContentRects is YES, bailing", self); 2794 2821 return; 2795 2822 } … … 2798 2825 || (_needsResetViewStateAfterCommitLoadForMainFrame && ![_contentView sizeChangedSinceLastVisibleContentRectUpdate]) 2799 2826 || [_scrollView isZoomBouncing] 2800 || _currentlyAdjustingScrollViewInsetsForKeyboard) 2827 || _currentlyAdjustingScrollViewInsetsForKeyboard) { 2828 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _updateVisibleContentRects:] - scroll view state is non-stable, bailing (_dynamicViewportUpdateMode %d, _needsResetViewStateAfterCommitLoadForMainFrame %d, sizeChangedSinceLastVisibleContentRectUpdate %d, [_scrollView isZoomBouncing] %d, _currentlyAdjustingScrollViewInsetsForKeyboard %d)", 2829 self, _dynamicViewportUpdateMode, _needsResetViewStateAfterCommitLoadForMainFrame, [_contentView sizeChangedSinceLastVisibleContentRectUpdate], [_scrollView isZoomBouncing], _currentlyAdjustingScrollViewInsetsForKeyboard); 2801 2830 return; 2831 } 2802 2832 2803 2833 CGRect visibleRectInContentCoordinates = [self _visibleContentRect]; … … 2845 2875 callback(); 2846 2876 } 2877 2878 auto timeNow = MonotonicTime::now(); 2879 if ((timeNow - _timeOfRequestForVisibleContentRectUpdate) > delayBeforeNoVisibleContentsRectsLogging) 2880 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _updateVisibleContentRects:] finally ran %.2fs after begin scheduled", self, (timeNow - _timeOfRequestForVisibleContentRectUpdate).value()); 2881 2882 _timeOfLastVisibleContentRectUpdate = timeNow; 2847 2883 } 2848 2884
Note:
See TracChangeset
for help on using the changeset viewer.