Title: [212527] branches/safari-603-branch/Source/WebKit2

Diff

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-17 05:28:07 UTC (rev 212527)
@@ -1,5 +1,41 @@
 2017-02-16  Matthew Hanson  <[email protected]>
 
+        Merge r212312. rdar://problem/30505482
+
+    2017-02-14  Simon Fraser  <[email protected]>
+
+            Add logging and defensive fixes to try to detect problems causing blank tabs
+            https://bugs.webkit.org/show_bug.cgi?id=168270
+            rdar://problem/30505482
+
+            Reviewed by Jon Lee.
+
+            Add release logging when -[WKWebView _beginAnimatedResizeWithUpdates:] and -[WKWebView _endAnimatedResize]
+            are unbalanced across a commit, to detect cases where _endAnimatedResize wasn't called enough times.
+
+            Also log when RemoteLayerTreeHost::updateLayerTree() fails to find a root layer, which should never happen.
+
+            In WebPageProxy, clear m_firstLayerTreeTransactionIdAfterDidCommitLoad on a web process crash.
+
+            * Platform/Logging.h:
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _didCommitLayerTree:]):
+            (-[WKWebView _beginAnimatedResizeWithUpdates:]):
+            (-[WKWebView _endAnimatedResize]):
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::resetState):
+            * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+            * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+            (WebKit::RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed):
+            * UIProcess/mac/RemoteLayerTreeHost.mm:
+            (WebKit::RemoteLayerTreeHost::updateLayerTree):
+            (WebKit::RemoteLayerTreeHost::clearLayers):
+            * WebProcess/WebPage/WebFrame.cpp:
+            (WebKit::WebFrame::WebFrame):
+            * WebProcess/WebPage/WebFrame.h:
+
+2017-02-16  Matthew Hanson  <[email protected]>
+
         Merge r212260. rdar://problem/30481079
 
     2017-02-13  Simon Fraser  <[email protected]>

Modified: branches/safari-603-branch/Source/WebKit2/Platform/Logging.h (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/Platform/Logging.h	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/Platform/Logging.h	2017-02-17 05:28:07 UTC (rev 212527)
@@ -68,6 +68,7 @@
     M(StorageAPI) \
     M(TextInput) \
     M(ViewGestures) \
+    M(ViewState) \
     M(VirtualMemory) \
     M(VisibleRects) \
 

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-17 05:28:07 UTC (rev 212527)
@@ -135,6 +135,8 @@
 #endif
 #endif
 
+#define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(_page && _page->isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__)
+
 @interface UIScrollView (UIScrollViewInternal)
 - (void)_adjustForAutomaticKeyboardInfo:(NSDictionary*)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment;
 - (BOOL)_isScrollingToTop;
@@ -273,6 +275,8 @@
 
     BOOL _delayUpdateVisibleContentRects;
     BOOL _hadDelayedUpdateVisibleContentRects;
+    
+    int _activeAnimatedResizeCount;
 
     Vector<std::function<void ()>> _snapshotsDeferredDuringResize;
     RetainPtr<NSMutableArray> _stableStatePresentationUpdateCallbacks;
@@ -1310,6 +1314,9 @@
         return;
     }
 
+    if (_activeAnimatedResizeCount)
+        RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _didCommitLayerTree:] - %d animated resizes in flight", self, _activeAnimatedResizeCount);
+
     CGSize newContentSize = roundScrollViewContentSize(*_page, [_contentView frame].size);
     [_scrollView _setContentSizePreservingContentOffsetDuringRubberband:newContentSize];
 
@@ -4294,6 +4301,7 @@
         return;
     }
 
+    ++_activeAnimatedResizeCount;
     _resizeAnimationTransformAdjustments = CATransform3DIdentity;
 
     NSUInteger indexOfContentView = [[_scrollView subviews] indexOfObject:_contentView.get()];
@@ -4364,12 +4372,13 @@
 
     if (!_resizeAnimationView) {
         // Paranoia. If _resizeAnimationView is null we'll end up setting a zero scale on the content view.
-        ASSERT_NOT_REACHED();
+        RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _endAnimatedResize:] - _resizeAnimationView is nil", self);
         _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
         [_contentView setHidden:NO];
         return;
     }
     
+    --_activeAnimatedResizeCount;
     NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()];
     [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView];
     [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1];

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-02-17 05:28:07 UTC (rev 212527)
@@ -5420,6 +5420,7 @@
 #endif
 
 #if PLATFORM(IOS)
+    m_firstLayerTreeTransactionIdAfterDidCommitLoad = 0;
     m_lastVisibleContentRectUpdate = VisibleContentRectUpdateInfo();
     m_dynamicViewportSizeUpdateWaitingForTarget = false;
     m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false;

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h	2017-02-17 05:28:07 UTC (rev 212527)
@@ -56,6 +56,8 @@
     
     bool hasDebugIndicator() const { return !!m_debugIndicatorLayerTreeHost; }
 
+    bool isAlwaysOnLoggingAllowed() const;
+
 private:
     void sizeDidChange() override;
     void deviceScaleFactorDidChange() override;

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2017-02-17 05:28:07 UTC (rev 212527)
@@ -473,4 +473,9 @@
     return m_remoteLayerTreeHost.rootLayer();
 }
 
+bool RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed() const
+{
+    return m_webPageProxy.isAlwaysOnLoggingAllowed();
+}
+
 } // namespace WebKit

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2017-02-17 05:28:07 UTC (rev 212527)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "RemoteLayerTreeHost.h"
 
+#import "Logging.h"
 #import "RemoteLayerTreeDrawingAreaProxy.h"
 #import "RemoteLayerTreePropertyApplier.h"
 #import "RemoteLayerTreeTransaction.h"
@@ -48,6 +49,8 @@
 
 namespace WebKit {
 
+#define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(m_drawingArea.isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__)
+
 RemoteLayerTreeHost::RemoteLayerTreeHost(RemoteLayerTreeDrawingAreaProxy& drawingArea)
     : m_drawingArea(drawingArea)
     , m_rootLayer(nullptr)
@@ -72,6 +75,10 @@
 
     bool rootLayerChanged = false;
     LayerOrView *rootLayer = getLayer(transaction.rootLayerID());
+    
+    if (!rootLayer)
+        RELEASE_LOG_IF_ALLOWED("%p RemoteLayerTreeHost::updateLayerTree - failed to find root layer with ID %llu", this, transaction.rootLayerID());
+
     if (m_rootLayer != rootLayer) {
         m_rootLayer = rootLayer;
         rootLayerChanged = true;
@@ -194,9 +201,7 @@
     }
 
     m_layers.clear();
-
-    if (m_rootLayer)
-        m_rootLayer = nullptr;
+    m_rootLayer = nullptr;
 }
 
 static NSString* const WKLayerIDPropertyKey = @"WKLayerID";

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2017-02-17 05:28:07 UTC (rev 212527)
@@ -147,16 +147,8 @@
 }
 
 WebFrame::WebFrame(std::unique_ptr<WebFrameLoaderClient> frameLoaderClient)
-    : m_coreFrame(0)
-    , m_policyListenerID(0)
-    , m_policyFunction(0)
-    , m_policyDownloadID(0)
-    , m_frameLoaderClient(WTFMove(frameLoaderClient))
-    , m_loadListener(0)
+    : m_frameLoaderClient(WTFMove(frameLoaderClient))
     , m_frameID(generateFrameID())
-#if PLATFORM(IOS)
-    , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
-#endif
 {
     m_frameLoaderClient->setWebFrame(this);
     WebProcess::singleton().addWebFrame(m_frameID, this);

Modified: branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h (212526 => 212527)


--- branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2017-02-17 05:28:03 UTC (rev 212526)
+++ branches/safari-603-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2017-02-17 05:28:07 UTC (rev 212527)
@@ -169,19 +169,19 @@
     static PassRefPtr<WebFrame> create(std::unique_ptr<WebFrameLoaderClient>);
     WebFrame(std::unique_ptr<WebFrameLoaderClient>);
 
-    WebCore::Frame* m_coreFrame;
+    WebCore::Frame* m_coreFrame { nullptr };
 
-    uint64_t m_policyListenerID;
-    WebCore::FramePolicyFunction m_policyFunction;
-    DownloadID m_policyDownloadID;
+    uint64_t m_policyListenerID { 0 };
+    WebCore::FramePolicyFunction m_policyFunction { nullptr };
+    DownloadID m_policyDownloadID { 0 };
 
     std::unique_ptr<WebFrameLoaderClient> m_frameLoaderClient;
-    LoadListener* m_loadListener;
+    LoadListener* m_loadListener { nullptr };
     
-    uint64_t m_frameID;
+    uint64_t m_frameID { 0 };
 
 #if PLATFORM(IOS)
-    uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
+    uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad { 0 };
 #endif
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to