Changeset 236500 in webkit
- Timestamp:
- Sep 26, 2018, 5:06:11 AM (8 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 14 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/WKWebView.mm (modified) (2 diffs)
-
UIProcess/API/Cocoa/WKWebViewInternal.h (modified) (1 diff)
-
UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h (modified) (2 diffs)
-
UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (modified) (6 diffs)
-
UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h (modified) (2 diffs)
-
UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (modified) (6 diffs)
-
UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
UIProcess/WebPageProxy.h (modified) (2 diffs)
-
UIProcess/ios/PageClientImplIOS.mm (modified) (1 diff)
-
UIProcess/ios/WKContentView.h (modified) (1 diff)
-
UIProcess/ios/WKContentView.mm (modified) (1 diff)
-
UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
UIProcess/mac/WebPageProxyMac.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r236497 r236500 1 2018-09-26 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=189695 5 <rdar://problem/44551146> 6 7 Reviewed by Simon Fraser. 8 9 Freeze the layers on UI process side during process swap. 10 11 * UIProcess/API/Cocoa/WKWebView.mm: 12 (-[WKWebView _processWillChange]): 13 14 Shared work of _processWillSwap and _processDidExit. 15 16 (-[WKWebView _processWillSwap]): 17 (-[WKWebView _processDidExit]): 18 19 Split into two functions. Don't reset scroll position and similar when doing navigation swap. 20 21 * UIProcess/API/Cocoa/WKWebViewInternal.h: 22 * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: 23 * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: 24 (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): 25 (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost): 26 27 Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host 28 the frozen layers. 29 30 (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 31 (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator): 32 (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate): 33 (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate): 34 (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension): 35 (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const): 36 (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const): 37 * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: 38 * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: 39 (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost): 40 (WebKit::RemoteLayerTreeHost::updateLayerTree): 41 (WebKit::RemoteLayerTreeHost::animationDidStart): 42 (WebKit::RemoteLayerTreeHost::animationDidEnd): 43 (WebKit::RemoteLayerTreeHost::detachFromDrawingArea): 44 45 Clear the DrawingArea backpointer. 46 47 * UIProcess/WebPageProxy.cpp: 48 (WebKit::WebPageProxy::continueNavigationInNewProcess): 49 (WebKit::WebPageProxy::resetState): 50 51 Detach and save the current RemoteLayerTreeHost on navigation swap. 52 53 * UIProcess/WebPageProxy.h: 54 * UIProcess/ios/PageClientImplIOS.mm: 55 (WebKit::PageClientImpl::processWillSwap): 56 57 Avoid reseting the scroll position. 58 59 * UIProcess/ios/WebPageProxyIOS.mm: 60 (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): 61 62 Drop the frozen layers after setting the new root layer. 63 64 * UIProcess/mac/WebPageProxyMac.mm: 65 (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): 66 67 For completeness do this also on Mac (where remote layers are currently not used). 68 1 69 2018-09-25 Ryosuke Niwa <rniwa@webkit.org> 2 70 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r236086 r236500 1655 1655 } 1656 1656 1657 - (void)_process DidExit1658 { 1659 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processDidExit]", self);1657 - (void)_processWillSwapOrDidExit 1658 { 1659 // FIXME: Which ones of these need to be done in the process swap case and which ones in the exit case? 1660 1660 [self _hidePasswordView]; 1661 1661 [self _cancelAnimatedResize]; 1662 [_contentView setFrame:self.bounds];1663 [_scrollView setBackgroundColor:[UIColor whiteColor]];1664 [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];1665 [_scrollView setZoomScale:1];1666 1662 1667 1663 _viewportMetaTagWidth = WebCore::ViewportArguments::ValueAuto; … … 1694 1690 1695 1691 _avoidsUnsafeArea = YES; 1692 } 1693 1694 - (void)_processWillSwap 1695 { 1696 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processWillSwap]", self); 1697 [self _processWillSwapOrDidExit]; 1698 } 1699 1700 - (void)_processDidExit 1701 { 1702 RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processDidExit]", self); 1703 1704 [self _processWillSwapOrDidExit]; 1705 1706 [_contentView setFrame:self.bounds]; 1707 [_scrollView setBackgroundColor:[UIColor whiteColor]]; 1708 [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]]; 1709 [_scrollView setZoomScale:1]; 1710 1696 1711 } 1697 1712 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
r235925 r236500 83 83 #if PLATFORM(IOS) 84 84 - (void)_processDidExit; 85 - (void)_processWillSwap; 85 86 - (void)_didRelaunchProcess; 86 87 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
r233781 r236500 44 44 virtual ~RemoteLayerTreeDrawingAreaProxy(); 45 45 46 const RemoteLayerTreeHost& remoteLayerTreeHost() const { return m_remoteLayerTreeHost; } 46 const RemoteLayerTreeHost& remoteLayerTreeHost() const { return *m_remoteLayerTreeHost; } 47 std::unique_ptr<RemoteLayerTreeHost> detachRemoteLayerTreeHost(); 47 48 48 49 void acceleratedAnimationDidStart(uint64_t layerID, const String& key, MonotonicTime startTime); … … 101 102 void sendUpdateGeometry(); 102 103 103 RemoteLayerTreeHostm_remoteLayerTreeHost;104 std::unique_ptr<RemoteLayerTreeHost> m_remoteLayerTreeHost; 104 105 bool m_isWaitingForDidUpdateGeometry { false }; 105 106 enum DidUpdateMessageState { DoesNotNeedDidUpdate, NeedsDidUpdate, MissedCommit }; -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
r235265 r236500 108 108 RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy(WebPageProxy& webPageProxy) 109 109 : DrawingAreaProxy(DrawingAreaTypeRemoteLayerTree, webPageProxy) 110 , m_remoteLayerTreeHost( *this)110 , m_remoteLayerTreeHost(std::make_unique<RemoteLayerTreeHost>(*this)) 111 111 { 112 112 #if HAVE(IOSURFACE) … … 132 132 } 133 133 134 135 std::unique_ptr<RemoteLayerTreeHost> RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost() 136 { 137 m_remoteLayerTreeHost->detachFromDrawingArea(); 138 return WTFMove(m_remoteLayerTreeHost); 139 } 140 141 134 142 #if PLATFORM(IOS) 135 143 WKOneShotDisplayLinkHandler *RemoteLayerTreeDrawingAreaProxy::displayLinkHandler() … … 195 203 m_webPageProxy.editorStateChanged(layerTreeTransaction.editorState()); 196 204 197 if (m_remoteLayerTreeHost .updateLayerTree(layerTreeTransaction)) {205 if (m_remoteLayerTreeHost->updateLayerTree(layerTreeTransaction)) { 198 206 if (layerTreeTransaction.transactionID() >= m_transactionIDForUnhidingContent) 199 m_webPageProxy.setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost .rootLayer());207 m_webPageProxy.setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost->rootLayer()); 200 208 else 201 m_remoteLayerTreeHost .detachRootLayer();209 m_remoteLayerTreeHost->detachRootLayer(); 202 210 } 203 211 … … 330 338 { 331 339 // Make sure we're the last sublayer. 332 CALayer *rootLayer = asLayer(m_remoteLayerTreeHost .rootLayer());340 CALayer *rootLayer = asLayer(m_remoteLayerTreeHost->rootLayer()); 333 341 [m_tileMapHostLayer removeFromSuperlayer]; 334 342 [rootLayer addSublayer:m_tileMapHostLayer.get()]; … … 470 478 { 471 479 m_transactionIDForUnhidingContent = nextLayerTreeTransactionID(); 472 m_remoteLayerTreeHost .detachRootLayer();480 m_remoteLayerTreeHost->detachRootLayer(); 473 481 } 474 482 475 483 void RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate() 476 484 { 477 m_remoteLayerTreeHost .detachRootLayer();485 m_remoteLayerTreeHost->detachRootLayer(); 478 486 } 479 487 480 488 void RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension() 481 489 { 482 m_remoteLayerTreeHost .mapAllIOSurfaceBackingStore();490 m_remoteLayerTreeHost->mapAllIOSurfaceBackingStore(); 483 491 } 484 492 485 493 bool RemoteLayerTreeDrawingAreaProxy::hasVisibleContent() const 486 494 { 487 return m_remoteLayerTreeHost .rootLayer();495 return m_remoteLayerTreeHost->rootLayer(); 488 496 } 489 497 … … 495 503 LayerOrView* RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting(uint64_t layerID) const 496 504 { 497 return m_remoteLayerTreeHost .layerWithIDForTesting(layerID);505 return m_remoteLayerTreeHost->layerWithIDForTesting(layerID); 498 506 } 499 507 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h
r229174 r236500 62 62 void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *); 63 63 64 void detachFromDrawingArea(); 64 65 void clearLayers(); 65 66 … … 79 80 void layerWillBeRemoved(WebCore::GraphicsLayer::PlatformLayerID); 80 81 81 RemoteLayerTreeDrawingAreaProxy & m_drawingArea;82 LayerOrView *m_rootLayer ;82 RemoteLayerTreeDrawingAreaProxy* m_drawingArea { nullptr }; 83 LayerOrView *m_rootLayer { nullptr }; 83 84 HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<LayerOrView>> m_layers; 84 85 HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> m_animationDelegates; 85 bool m_isDebugLayerTreeHost ;86 bool m_isDebugLayerTreeHost { false }; 86 87 }; 87 88 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
r235365 r236500 50 50 using namespace WebCore; 51 51 52 #define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(m_drawingArea .isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__)52 #define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(m_drawingArea && m_drawingArea->isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__) 53 53 54 54 RemoteLayerTreeHost::RemoteLayerTreeHost(RemoteLayerTreeDrawingAreaProxy& drawingArea) 55 : m_drawingArea(drawingArea) 56 , m_rootLayer(nullptr) 57 , m_isDebugLayerTreeHost(false) 55 : m_drawingArea(&drawingArea) 58 56 { 59 57 } … … 69 67 bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& transaction, float indicatorScaleFactor) 70 68 { 69 if (!m_drawingArea) 70 return false; 71 71 72 for (const auto& createdLayer : transaction.createdLayers()) { 72 73 const RemoteLayerTreeTransaction::LayerProperties* properties = transaction.changedLayerProperties().get(createdLayer.layerID); … … 92 93 auto layerContentsType = RemoteLayerBackingStore::LayerContentsType::IOSurface; 93 94 #else 94 auto layerContentsType = m_drawingArea .hasDebugIndicator() ? RemoteLayerBackingStore::LayerContentsType::IOSurface : RemoteLayerBackingStore::LayerContentsType::CAMachPort;95 auto layerContentsType = m_drawingArea->hasDebugIndicator() ? RemoteLayerBackingStore::LayerContentsType::IOSurface : RemoteLayerBackingStore::LayerContentsType::CAMachPort; 95 96 #endif 96 97 … … 161 162 void RemoteLayerTreeHost::animationDidStart(WebCore::GraphicsLayer::PlatformLayerID layerID, CAAnimation *animation, MonotonicTime startTime) 162 163 { 164 if (!m_drawingArea) 165 return; 166 163 167 CALayer *layer = asLayer(getLayer(layerID)); 164 168 if (!layer) … … 174 178 175 179 if (!animationKey.isEmpty()) 176 m_drawingArea .acceleratedAnimationDidStart(layerID, animationKey, startTime);180 m_drawingArea->acceleratedAnimationDidStart(layerID, animationKey, startTime); 177 181 } 178 182 179 183 void RemoteLayerTreeHost::animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID layerID, CAAnimation *animation) 180 184 { 185 if (!m_drawingArea) 186 return; 187 181 188 CALayer *layer = asLayer(getLayer(layerID)); 182 189 if (!layer) … … 192 199 193 200 if (!animationKey.isEmpty()) 194 m_drawingArea.acceleratedAnimationDidEnd(layerID, animationKey); 201 m_drawingArea->acceleratedAnimationDidEnd(layerID, animationKey); 202 } 203 204 void RemoteLayerTreeHost::detachFromDrawingArea() 205 { 206 m_drawingArea = nullptr; 195 207 } 196 208 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r236494 r236500 2508 2508 m_pageLoadState.setPendingAPIRequestURL(transaction, item->url()); 2509 2509 2510 auto itemStates = m_backForwardList-> filteredItemStates([this, targetItem = item](WebBackForwardListItem& item) {2510 auto itemStates = m_backForwardList->filteredItemStates([this, targetItem = item](WebBackForwardListItem& item) { 2511 2511 if (auto* page = item.suspendedPage()) { 2512 2512 if (page->process() == m_process.ptr()) … … 6018 6018 m_scrollingPerformanceData = nullptr; 6019 6019 #endif 6020 m_drawingArea = nullptr; 6020 6021 if (m_drawingArea) { 6022 #if PLATFORM(COCOA) 6023 if (resetStateReason == ResetStateReason::NavigationSwap && is<RemoteLayerTreeDrawingAreaProxy>(*m_drawingArea)) { 6024 // Keep layers around in frozen state to avoid flashing during process swaps. 6025 m_frozenRemoteLayerTreeHost = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_drawingArea).detachRemoteLayerTreeHost(); 6026 } 6027 #endif 6028 m_drawingArea = nullptr; 6029 } 6021 6030 closeOverlayedViews(); 6022 6031 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r236485 r236500 224 224 class NativeWebWheelEvent; 225 225 class PageClient; 226 class RemoteLayerTreeHost; 226 227 class RemoteLayerTreeScrollingPerformanceData; 227 228 class RemoteLayerTreeTransaction; … … 1862 1863 1863 1864 std::unique_ptr<DrawingAreaProxy> m_drawingArea; 1864 #if ENABLE(ASYNC_SCROLLING) && PLATFORM(COCOA) 1865 #if PLATFORM(COCOA) 1866 std::unique_ptr<RemoteLayerTreeHost> m_frozenRemoteLayerTreeHost; 1867 #if ENABLE(ASYNC_SCROLLING) 1865 1868 std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy; 1866 1869 #endif 1867 1870 #endif 1868 1871 Ref<WebProcessProxy> m_process; 1869 1872 Ref<WebPageGroup> m_pageGroup; -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r236257 r236500 212 212 void PageClientImpl::processWillSwap() 213 213 { 214 // FIXME: It didn't really exit.215 processDidExit();214 [m_contentView _processWillSwap]; 215 [m_webView _processWillSwap]; 216 216 } 217 217 -
trunk/Source/WebKit/UIProcess/ios/WKContentView.h
r230383 r236500 86 86 - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; 87 87 - (void)_processDidExit; 88 - (void)_processWillSwap; 88 89 - (void)_didRelaunchProcess; 89 90 - (void)_setAcceleratedCompositingRootView:(UIView *)rootView; -
trunk/Source/WebKit/UIProcess/ios/WKContentView.mm
r233723 r236500 522 522 } 523 523 524 - (void)_processWillSwap 525 { 526 // FIXME: Should we do something differently? 527 [self _processDidExit]; 528 } 529 524 530 - (void)_didRelaunchProcess 525 531 { -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r236154 r236500 994 994 { 995 995 pageClient().setAcceleratedCompositingRootLayer(rootLayer); 996 m_frozenRemoteLayerTreeHost = nullptr; 996 997 } 997 998 -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r235903 r236500 41 41 #import "PageClientImplMac.h" 42 42 #import "PluginComplexTextInputState.h" 43 #import "RemoteLayerTreeHost.h" 43 44 #import "StringUtilities.h" 44 45 #import "TextChecker.h" … … 459 460 { 460 461 pageClient().setAcceleratedCompositingRootLayer(rootLayer); 462 m_frozenRemoteLayerTreeHost = nullptr; 461 463 } 462 464
Note:
See TracChangeset
for help on using the changeset viewer.