Title: [256388] branches/safari-609-branch
Revision
256388
Author
alanc...@apple.com
Date
2020-02-11 15:55:17 -0800 (Tue, 11 Feb 2020)

Log Message

Cherry-pick r255518. rdar://problem/59298166

    [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
    https://bugs.webkit.org/show_bug.cgi?id=206934
    <rdar://problem/58991581>

    Source/WebKit:

    Reviewed by Brady Eidson.

    Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and
    report the process as unresponsive while still launching or very shortly after. When a service worker is reported as
    unresponsive, we would kill it.

    To address the issue, several changes were made:
    - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc)
    - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness
      check relies on IPC to the process and we cannot send the IPC until after the process has launched.

    * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
    (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
    * UIProcess/ProvisionalPageProxy.cpp:
    (WebKit::ProvisionalPageProxy::goToBackForwardItem):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::launchProcessForReload):
    (WebKit::WebPageProxy::launchProcessWithItem):
    (WebKit::WebPageProxy::loadRequestWithNavigationShared):
    (WebKit::WebPageProxy::loadFile):
    (WebKit::WebPageProxy::loadDataWithNavigationShared):
    (WebKit::WebPageProxy::loadAlternateHTML):
    (WebKit::WebPageProxy::loadWebArchiveData):
    (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
    (WebKit::WebPageProxy::stopLoading):
    (WebKit::WebPageProxy::reload):
    (WebKit::WebPageProxy::goToBackForwardItem):
    (WebKit::WebPageProxy::dispatchActivityStateChange):
    (WebKit::WebPageProxy::processNextQueuedMouseEvent):
    (WebKit::WebPageProxy::handleKeyboardEvent):
    (WebKit::WebPageProxy::handleGestureEvent):
    (WebKit::WebPageProxy::handlePreventableTouchEvent):
    (WebKit::WebPageProxy::handleTouchEvent):
    (WebKit::WebPageProxy::runJavaScriptAlert):
    (WebKit::WebPageProxy::runJavaScriptConfirm):
    (WebKit::WebPageProxy::runJavaScriptPrompt):
    (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
    (WebKit::WebPageProxy::runOpenPanel):
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::mayBecomeUnresponsive):
    (WebKit::WebProcessProxy::didFinishLaunching):
    (WebKit::WebProcessProxy::startResponsivenessTimer):
    (WebKit::WebProcessProxy::isResponsive):
    * UIProcess/WebProcessProxy.h:
    (WebKit::WebProcessProxy::responsivenessTimer):

    LayoutTests:

    Unskip test which should no longer be flaky.

    * platform/ios-wk2/TestExpectations:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255518 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (256387 => 256388)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-02-11 23:55:17 UTC (rev 256388)
@@ -1,5 +1,79 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r255518. rdar://problem/59298166
+
+    [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
+    https://bugs.webkit.org/show_bug.cgi?id=206934
+    <rdar://problem/58991581>
+    
+    Source/WebKit:
+    
+    Reviewed by Brady Eidson.
+    
+    Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and
+    report the process as unresponsive while still launching or very shortly after. When a service worker is reported as
+    unresponsive, we would kill it.
+    
+    To address the issue, several changes were made:
+    - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc)
+    - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness
+      check relies on IPC to the process and we cannot send the IPC until after the process has launched.
+    
+    * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
+    (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
+    * UIProcess/ProvisionalPageProxy.cpp:
+    (WebKit::ProvisionalPageProxy::goToBackForwardItem):
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::launchProcessForReload):
+    (WebKit::WebPageProxy::launchProcessWithItem):
+    (WebKit::WebPageProxy::loadRequestWithNavigationShared):
+    (WebKit::WebPageProxy::loadFile):
+    (WebKit::WebPageProxy::loadDataWithNavigationShared):
+    (WebKit::WebPageProxy::loadAlternateHTML):
+    (WebKit::WebPageProxy::loadWebArchiveData):
+    (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
+    (WebKit::WebPageProxy::stopLoading):
+    (WebKit::WebPageProxy::reload):
+    (WebKit::WebPageProxy::goToBackForwardItem):
+    (WebKit::WebPageProxy::dispatchActivityStateChange):
+    (WebKit::WebPageProxy::processNextQueuedMouseEvent):
+    (WebKit::WebPageProxy::handleKeyboardEvent):
+    (WebKit::WebPageProxy::handleGestureEvent):
+    (WebKit::WebPageProxy::handlePreventableTouchEvent):
+    (WebKit::WebPageProxy::handleTouchEvent):
+    (WebKit::WebPageProxy::runJavaScriptAlert):
+    (WebKit::WebPageProxy::runJavaScriptConfirm):
+    (WebKit::WebPageProxy::runJavaScriptPrompt):
+    (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
+    (WebKit::WebPageProxy::runOpenPanel):
+    * UIProcess/WebProcessProxy.cpp:
+    (WebKit::WebProcessProxy::mayBecomeUnresponsive):
+    (WebKit::WebProcessProxy::didFinishLaunching):
+    (WebKit::WebProcessProxy::startResponsivenessTimer):
+    (WebKit::WebProcessProxy::isResponsive):
+    * UIProcess/WebProcessProxy.h:
+    (WebKit::WebProcessProxy::responsivenessTimer):
+    
+    LayoutTests:
+    
+    Unskip test which should no longer be flaky.
+    
+    * platform/ios-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-31  Chris Dumez  <cdu...@apple.com>
+
+            [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
+            https://bugs.webkit.org/show_bug.cgi?id=206934
+            <rdar://problem/58991581>
+
+            Unskip test which should no longer be flaky.
+
+            * platform/ios-wk2/TestExpectations:
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255379. rdar://problem/59298188
 
     2020-01-29  Jacob Uphoff  <jacob_uph...@apple.com>

Modified: branches/safari-609-branch/LayoutTests/platform/ios-wk2/TestExpectations (256387 => 256388)


--- branches/safari-609-branch/LayoutTests/platform/ios-wk2/TestExpectations	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/LayoutTests/platform/ios-wk2/TestExpectations	2020-02-11 23:55:17 UTC (rev 256388)
@@ -1351,4 +1351,3 @@
 
 webkit.org/b/205308 accessibility/smart-invert-reference.html [ ImageOnlyFailure ]
 
-webkit.org/b/206934 imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html [ Pass Failure ]

Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-11 23:55:17 UTC (rev 256388)
@@ -1,5 +1,121 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r255518. rdar://problem/59298166
+
+    [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
+    https://bugs.webkit.org/show_bug.cgi?id=206934
+    <rdar://problem/58991581>
+    
+    Source/WebKit:
+    
+    Reviewed by Brady Eidson.
+    
+    Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and
+    report the process as unresponsive while still launching or very shortly after. When a service worker is reported as
+    unresponsive, we would kill it.
+    
+    To address the issue, several changes were made:
+    - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc)
+    - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness
+      check relies on IPC to the process and we cannot send the IPC until after the process has launched.
+    
+    * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
+    (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
+    * UIProcess/ProvisionalPageProxy.cpp:
+    (WebKit::ProvisionalPageProxy::goToBackForwardItem):
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::launchProcessForReload):
+    (WebKit::WebPageProxy::launchProcessWithItem):
+    (WebKit::WebPageProxy::loadRequestWithNavigationShared):
+    (WebKit::WebPageProxy::loadFile):
+    (WebKit::WebPageProxy::loadDataWithNavigationShared):
+    (WebKit::WebPageProxy::loadAlternateHTML):
+    (WebKit::WebPageProxy::loadWebArchiveData):
+    (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
+    (WebKit::WebPageProxy::stopLoading):
+    (WebKit::WebPageProxy::reload):
+    (WebKit::WebPageProxy::goToBackForwardItem):
+    (WebKit::WebPageProxy::dispatchActivityStateChange):
+    (WebKit::WebPageProxy::processNextQueuedMouseEvent):
+    (WebKit::WebPageProxy::handleKeyboardEvent):
+    (WebKit::WebPageProxy::handleGestureEvent):
+    (WebKit::WebPageProxy::handlePreventableTouchEvent):
+    (WebKit::WebPageProxy::handleTouchEvent):
+    (WebKit::WebPageProxy::runJavaScriptAlert):
+    (WebKit::WebPageProxy::runJavaScriptConfirm):
+    (WebKit::WebPageProxy::runJavaScriptPrompt):
+    (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
+    (WebKit::WebPageProxy::runOpenPanel):
+    * UIProcess/WebProcessProxy.cpp:
+    (WebKit::WebProcessProxy::mayBecomeUnresponsive):
+    (WebKit::WebProcessProxy::didFinishLaunching):
+    (WebKit::WebProcessProxy::startResponsivenessTimer):
+    (WebKit::WebProcessProxy::isResponsive):
+    * UIProcess/WebProcessProxy.h:
+    (WebKit::WebProcessProxy::responsivenessTimer):
+    
+    LayoutTests:
+    
+    Unskip test which should no longer be flaky.
+    
+    * platform/ios-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-31  Chris Dumez  <cdu...@apple.com>
+
+            [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
+            https://bugs.webkit.org/show_bug.cgi?id=206934
+            <rdar://problem/58991581>
+
+            Reviewed by Brady Eidson.
+
+            Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and
+            report the process as unresponsive while still launching or very shortly after. When a service worker is reported as
+            unresponsive, we would kill it.
+
+            To address the issue, several changes were made:
+            - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc)
+            - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness
+              check relies on IPC to the process and we cannot send the IPC until after the process has launched.
+
+            * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
+            (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
+            * UIProcess/ProvisionalPageProxy.cpp:
+            (WebKit::ProvisionalPageProxy::goToBackForwardItem):
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::launchProcessForReload):
+            (WebKit::WebPageProxy::launchProcessWithItem):
+            (WebKit::WebPageProxy::loadRequestWithNavigationShared):
+            (WebKit::WebPageProxy::loadFile):
+            (WebKit::WebPageProxy::loadDataWithNavigationShared):
+            (WebKit::WebPageProxy::loadAlternateHTML):
+            (WebKit::WebPageProxy::loadWebArchiveData):
+            (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
+            (WebKit::WebPageProxy::stopLoading):
+            (WebKit::WebPageProxy::reload):
+            (WebKit::WebPageProxy::goToBackForwardItem):
+            (WebKit::WebPageProxy::dispatchActivityStateChange):
+            (WebKit::WebPageProxy::processNextQueuedMouseEvent):
+            (WebKit::WebPageProxy::handleKeyboardEvent):
+            (WebKit::WebPageProxy::handleGestureEvent):
+            (WebKit::WebPageProxy::handlePreventableTouchEvent):
+            (WebKit::WebPageProxy::handleTouchEvent):
+            (WebKit::WebPageProxy::runJavaScriptAlert):
+            (WebKit::WebPageProxy::runJavaScriptConfirm):
+            (WebKit::WebPageProxy::runJavaScriptPrompt):
+            (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
+            (WebKit::WebPageProxy::runOpenPanel):
+            * UIProcess/WebProcessProxy.cpp:
+            (WebKit::WebProcessProxy::mayBecomeUnresponsive):
+            (WebKit::WebProcessProxy::didFinishLaunching):
+            (WebKit::WebProcessProxy::startResponsivenessTimer):
+            (WebKit::WebProcessProxy::isResponsive):
+            * UIProcess/WebProcessProxy.h:
+            (WebKit::WebProcessProxy::responsivenessTimer):
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255158. rdar://problem/59298137
 
     Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp	2020-02-11 23:55:17 UTC (rev 256388)
@@ -175,7 +175,7 @@
     m_isWaitingForDidUpdateBackingStoreState = false;
 
     // Stop the responsiveness timer that was started in sendUpdateBackingStoreState.
-    process().responsivenessTimer().stop();
+    process().stopResponsivenessTimer();
 
     if (layerTreeContext != m_layerTreeContext) {
         if (layerTreeContext.isEmpty() && !m_layerTreeContext.isEmpty()) {
@@ -319,7 +319,7 @@
     if (m_isWaitingForDidUpdateBackingStoreState) {
         // Start the responsiveness timer. We will stop it when we hear back from the WebProcess
         // in didUpdateBackingStoreState.
-        process().responsivenessTimer().start();
+        process().startResponsivenessTimer();
     }
 
     if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) {

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2020-02-11 23:55:17 UTC (rev 256388)
@@ -181,7 +181,7 @@
     });
     send(Messages::WebPage::UpdateBackForwardListForReattach(WTFMove(itemStates)));
     send(Messages::WebPage::GoToBackForwardItem(navigation.navigationID(), item.itemID(), *navigation.backForwardFrameLoadType(), WebCore::ShouldTreatAsContinuingLoad::Yes, WTFMove(websitePolicies)));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 }
 
 inline bool ProvisionalPageProxy::validateInput(FrameIdentifier frameID, const Optional<uint64_t>& navigationID)

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-02-11 23:55:17 UTC (rev 256388)
@@ -962,7 +962,7 @@
 
     // We allow stale content when reloading a WebProcess that's been killed or crashed.
     send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), m_backForwardList->currentItem()->itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, WTF::nullopt));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 
     return navigation;
 }
@@ -985,7 +985,7 @@
     auto navigation = m_navigationState->createBackForwardNavigation(item, m_backForwardList->currentItem(), FrameLoadType::IndexedBackForward);
 
     send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item.itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, WTF::nullopt));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 
     return navigation;
 }
@@ -1275,7 +1275,7 @@
 #else
     process->send(Messages::WebPage::LoadRequest(loadParameters), webPageID);
 #endif
-    process->responsivenessTimer().start();
+    process->startResponsivenessTimer();
 }
 
 RefPtr<API::Navigation> WebPageProxy::loadFile(const String& fileURLString, const String& resourceDirectoryURLString, API::Object* userData)
@@ -1330,7 +1330,7 @@
 #else
     send(Messages::WebPage::LoadRequest(loadParameters));
 #endif
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 
     return navigation;
 }
@@ -1376,7 +1376,7 @@
 
     process->assumeReadAccessToBaseURL(*this, baseURL);
     process->send(Messages::WebPage::LoadData(loadParameters), webPageID);
-    process->responsivenessTimer().start();
+    process->startResponsivenessTimer();
 }
 
 void WebPageProxy::loadAlternateHTML(const IPC::DataReference& htmlData, const String& encoding, const URL& baseURL, const URL& unreachableURL, API::Object* userData)
@@ -1419,7 +1419,7 @@
     m_process->assumeReadAccessToBaseURL(*this, baseURL);
     m_process->assumeReadAccessToBaseURL(*this, unreachableURL);
     send(Messages::WebPage::LoadAlternateHTML(loadParameters));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 }
 
 void WebPageProxy::loadWebArchiveData(API::Data* webArchiveData, API::Object* userData)
@@ -1446,7 +1446,7 @@
     addPlatformLoadParameters(loadParameters);
 
     send(Messages::WebPage::LoadData(loadParameters));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 }
 
 void WebPageProxy::navigateToPDFLinkWithSimulatedClick(const String& urlString, IntPoint documentPoint, IntPoint screenPoint)
@@ -1465,7 +1465,7 @@
         launchProcess(RegistrableDomain { URL(URL(), urlString) }, ProcessLaunchReason::InitialProcess);
 
     send(Messages::WebPage::NavigateToPDFLinkWithSimulatedClick(urlString, documentPoint, screenPoint));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 }
 
 void WebPageProxy::stopLoading()
@@ -1482,7 +1482,7 @@
         m_provisionalPage->cancel();
         m_provisionalPage = nullptr;
     }
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 }
 
 RefPtr<API::Navigation> WebPageProxy::reload(OptionSet<WebCore::ReloadOption> options)
@@ -1513,7 +1513,7 @@
         navigation->setUserContentExtensionsEnabled(false);
 
     send(Messages::WebPage::Reload(navigation->navigationID(), options.toRaw(), sandboxExtensionHandle));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 
 #if ENABLE(SPEECH_SYNTHESIS)
     resetSpeechSynthesizer();
@@ -1582,7 +1582,7 @@
     m_pageLoadState.setPendingAPIRequest(transaction, { navigation ? navigation->navigationID() : 0, item.url() });
 
     send(Messages::WebPage::GoToBackForwardItem(navigation ? navigation->navigationID() : 0, item.itemID(), frameLoadType, ShouldTreatAsContinuingLoad::No, WTF::nullopt));
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
 
     return navigation;
 }
@@ -1936,7 +1936,7 @@
             // If we've started the responsiveness timer as part of telling the web process to update the backing store
             // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
             // stop the unresponsiveness timer here.
-            m_process->responsivenessTimer().stop();
+            m_process->stopResponsivenessTimer();
         }
     }
 
@@ -2466,10 +2466,10 @@
 
     WebEvent::Type eventType = event.type();
     if (eventType == WebEvent::MouseDown || eventType == WebEvent::MouseForceChanged || eventType == WebEvent::MouseForceDown)
-        m_process->responsivenessTimer().startWithLazyStop();
+        m_process->startResponsivenessTimer(WebProcessProxy::UseLazyStop::Yes);
     else if (eventType != WebEvent::MouseMove) {
         // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
-        m_process->responsivenessTimer().start();
+        m_process->startResponsivenessTimer();
     }
 
     LOG(MouseHandling, "UIProcess: sent mouse event %s (queue size %zu)", webMouseEventTypeString(eventType), m_mouseEventQueue.size());
@@ -2648,11 +2648,7 @@
 
     m_keyEventQueue.append(event);
 
-    ResponsivenessTimer& responsivenessTimer = m_process->responsivenessTimer();
-    if (event.type() == WebEvent::KeyDown)
-        responsivenessTimer.startWithLazyStop();
-    else
-        responsivenessTimer.start();
+    m_process->startResponsivenessTimer(event.type() == WebEvent::KeyDown ? WebProcessProxy::UseLazyStop::Yes : WebProcessProxy::UseLazyStop::No);
 
     if (m_keyEventQueue.size() == 1) { // Otherwise, sent from DidReceiveEvent message handler.
         LOG(KeyHandling, " UI process: sent keyEvent from handleKeyboardEvent");
@@ -2823,11 +2819,7 @@
     m_gestureEventQueue.append(event);
     // FIXME: Consider doing some coalescing here.
 
-    ResponsivenessTimer& responsivenessTimer = m_process->responsivenessTimer();
-    if (event.type() == WebEvent::GestureStart || event.type() == WebEvent::GestureChange)
-        responsivenessTimer.startWithLazyStop();
-    else
-        responsivenessTimer.start();
+    m_process->startResponsivenessTimer((event.type() == WebEvent::GestureStart || event.type() == WebEvent::GestureChange) ? WebProcessProxy::UseLazyStop::Yes ? WebProcessProxy::UseLazyStop::No);
 
     send(Messages::EventDispatcher::GestureEvent(m_webPageID, event), 0);
 }
@@ -2898,7 +2890,7 @@
         return;
     }
 
-    m_process->responsivenessTimer().start();
+    m_process->startResponsivenessTimer();
     bool handled = false;
     bool replyReceived = sendSync(Messages::WebPage::TouchEventSync(event), Messages::WebPage::TouchEventSync::Reply(handled), 1_s, IPC::SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply);
     // If the sync request has timed out, we should consider the event handled. The Web Process is too busy to answer any questions, so the default action is also likely to have issues.
@@ -2910,7 +2902,7 @@
         pageClient().doneDeferringNativeGestures(handled);
     else if (handled)
         m_handledSynchronousTouchEventWhileDispatchingPreventableTouchStart = true;
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 }
 
 void WebPageProxy::resetPotentialTapSecurityOrigin()
@@ -2954,7 +2946,7 @@
     // we do not send any of the events to the page even if is has listeners.
     if (!m_isPageSuspended) {
         m_touchEventQueue.append(event);
-        m_process->responsivenessTimer().start();
+        m_process->startResponsivenessTimer();
         send(Messages::WebPage::TouchEvent(event));
     } else {
         if (m_touchEventQueue.isEmpty()) {
@@ -5431,7 +5423,7 @@
 #endif
 
     // Since runJavaScriptAlert() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     if (m_controlledByAutomation) {
         if (auto* automationSession = process().processPool().automationSession())
@@ -5450,7 +5442,7 @@
 #endif
 
     // Since runJavaScriptConfirm() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     if (m_controlledByAutomation) {
         if (auto* automationSession = process().processPool().automationSession())
@@ -5469,7 +5461,7 @@
     exitFullscreenImmediately();
 #endif
     // Since runJavaScriptPrompt() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     if (m_controlledByAutomation) {
         if (auto* automationSession = process().processPool().automationSession())
@@ -5636,7 +5628,7 @@
     }
 
     // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer and the tryClose timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
     m_tryCloseTimeoutTimer.stop();
     m_uiClient->runBeforeUnloadConfirmPanel(*this, message, frame, WTFMove(securityOrigin),
         [this, weakThis = makeWeakPtr(*this), completionHandler = WTFMove(reply)](bool shouldClose) mutable {
@@ -5688,7 +5680,7 @@
     }
 
     // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     if (!m_uiClient->runOpenPanel(*this, frame, WTFMove(frameSecurityOrigin), parameters.ptr(), m_openPanelResultListener.get())) {
         if (!pageClient().handleRunOpenPanel(this, frame, parameters.ptr(), m_openPanelResultListener.get()))
@@ -6247,7 +6239,7 @@
         return;
 
     // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     // Showing a popup menu runs a nested runloop, which can handle messages that cause |this| to get closed.
     Ref<WebPageProxy> protect(*this);
@@ -6290,7 +6282,7 @@
     m_activeContextMenu = pageClient().createContextMenuProxy(*this, WTFMove(contextMenuContextData), userData);
 
     // Since showContextMenu() can spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     // m_activeContextMenu might get cleared if WebPageProxy code is re-entered from the menu runloop or delegates.
     Ref<WebContextMenuProxy> protector(*m_activeContextMenu);
@@ -6637,7 +6629,7 @@
     case WebEvent::GestureChange:
     case WebEvent::GestureEnd:
 #endif
-        m_process->responsivenessTimer().stop();
+        m_process->stopResponsivenessTimer();
         break;
     }
 
@@ -7877,7 +7869,7 @@
 void WebPageProxy::runModal()
 {
     // Since runModal() can (and probably will) spin a nested run loop we need to turn off the responsiveness timer.
-    m_process->responsivenessTimer().stop();
+    m_process->stopResponsivenessTimer();
 
     // Our Connection's run loop might have more messages waiting to be handled after this RunModal message.
     // To make sure they are handled inside of the nested modal run loop we must first signal the Connection's

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2020-02-11 23:55:17 UTC (rev 256388)
@@ -858,7 +858,26 @@
 
 bool WebProcessProxy::mayBecomeUnresponsive()
 {
-    return !platformIsBeingDebugged();
+#if !defined(NDEBUG) || ASAN_ENABLED
+    // Disable responsiveness checks in slow builds to avoid false positives.
+    return false;
+#else
+    if (platformIsBeingDebugged())
+        return false;
+
+    static bool isLibgmallocEnabled = [] {
+        char* variable = getenv("DYLD_INSERT_LIBRARIES");
+        if (!variable)
+            return false;
+        if (!strstr(variable, "libgmalloc"))
+            return false;
+        return true;
+    }();
+    if (isLibgmallocEnabled)
+        return false;
+
+    return true;
+#endif
 }
 
 void WebProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
@@ -887,6 +906,11 @@
 
     unblockAccessibilityServerIfNeeded();
 #endif
+
+    if (m_shouldStartResponsivenessTimerWhenLaunched) {
+        auto useLazyStop = *std::exchange(m_shouldStartResponsivenessTimerWhenLaunched, WTF::nullopt);
+        startResponsivenessTimer(useLazyStop);
+    }
 }
 
 WebFrameProxy* WebProcessProxy::webFrame(FrameIdentifier frameID) const
@@ -1117,6 +1141,19 @@
     responsivenessTimer().stop();
 }
 
+void WebProcessProxy::startResponsivenessTimer(UseLazyStop useLazyStop)
+{
+    if (isLaunching()) {
+        m_shouldStartResponsivenessTimerWhenLaunched = useLazyStop;
+        return;
+    }
+
+    if (useLazyStop == UseLazyStop::Yes)
+        responsivenessTimer().startWithLazyStop();
+    else
+        responsivenessTimer().start();
+}
+
 void WebProcessProxy::enableSuddenTermination()
 {
     if (state() != State::Running)
@@ -1337,7 +1374,7 @@
     if (callback)
         m_isResponsiveCallbacks.append(WTFMove(callback));
 
-    responsivenessTimer().start();
+    startResponsivenessTimer();
     send(Messages::WebProcess::MainThreadPing(), 0);
 }
 

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.h (256387 => 256388)


--- branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2020-02-11 23:55:13 UTC (rev 256387)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/WebProcessProxy.h	2020-02-11 23:55:17 UTC (rev 256388)
@@ -174,7 +174,6 @@
 
     RefPtr<API::UserInitiatedAction> userInitiatedActivity(uint64_t);
 
-    ResponsivenessTimer& responsivenessTimer() { return m_responsivenessTimer; }
     bool isResponsive() const;
 
     WebFrameProxy* webFrame(WebCore::FrameIdentifier) const;
@@ -214,6 +213,8 @@
 
     void requestTermination(ProcessTerminationReason);
 
+    enum class UseLazyStop : bool { No, Yes };
+    void startResponsivenessTimer(UseLazyStop = UseLazyStop::No);
     void stopResponsivenessTimer();
 
     RefPtr<API::Object> transformHandlesToObjects(API::Object*);
@@ -406,6 +407,7 @@
 
     static const HashSet<String>& platformPathsWithAssumedReadAccess();
 
+    ResponsivenessTimer& responsivenessTimer() { return m_responsivenessTimer; }
     void updateBackgroundResponsivenessTimer();
 
     void processDidTerminateOrFailedToLaunch();
@@ -527,6 +529,7 @@
     bool m_hasCommittedAnyProvisionalLoads { false };
     bool m_isPrewarmed;
     bool m_hasAudibleWebPage { false };
+    Optional<UseLazyStop> m_shouldStartResponsivenessTimerWhenLaunched;
 
 #if PLATFORM(WATCHOS)
     std::unique_ptr<ProcessThrottler::BackgroundActivity> m_backgroundActivityForFullscreenFormControls;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to