Add logging for layout tests when rAF callbacks get suspended and resumed
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 22:23:09 +0000 (22:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jun 2017 22:23:09 +0000 (22:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173326

Patch by Antoine Quint <graouts@apple.com> on 2017-06-13
Reviewed by Simon Fraser.

In order to help diagnose webkit.org/b/168409 we log the ScriptedAnimationController
suspend count when it changes and log the backtrace so that we may understand why it
fails to be set back to 0 when some modern-media-controls tests run.

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::suspend):
(WebCore::ScriptedAnimationController::resume):
(WebCore::ScriptedAnimationController::logSuspendCount):
* dom/ScriptedAnimationController.h:
* page/Settings.in:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::resetToConsistentState):
(WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange):
(WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

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

Source/WebCore/ChangeLog
Source/WebCore/dom/ScriptedAnimationController.cpp
Source/WebCore/dom/ScriptedAnimationController.h
Source/WebCore/page/Settings.in
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl

index d522681..a12d7ff 100644 (file)
@@ -1,3 +1,27 @@
+2017-06-13  Antoine Quint  <graouts@apple.com>
+
+        Add logging for layout tests when rAF callbacks get suspended and resumed
+        https://bugs.webkit.org/show_bug.cgi?id=173326
+
+        Reviewed by Simon Fraser.
+
+        In order to help diagnose webkit.org/b/168409 we log the ScriptedAnimationController
+        suspend count when it changes and log the backtrace so that we may understand why it
+        fails to be set back to 0 when some modern-media-controls tests run.
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::suspend):
+        (WebCore::ScriptedAnimationController::resume):
+        (WebCore::ScriptedAnimationController::logSuspendCount):
+        * dom/ScriptedAnimationController.h:
+        * page/Settings.in:
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::resetToConsistentState):
+        (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange):
+        (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2017-06-13  Jer Noble  <jer.noble@apple.com>
 
         Crash when MSE backed media element changes src/srcObject during PiP
index 855807c..6305e93 100644 (file)
@@ -73,6 +73,7 @@ bool ScriptedAnimationController::requestAnimationFrameEnabled() const
 void ScriptedAnimationController::suspend()
 {
     ++m_suspendCount;
+    logSuspendCount();
 }
 
 void ScriptedAnimationController::resume()
@@ -82,10 +83,23 @@ void ScriptedAnimationController::resume()
     if (m_suspendCount > 0)
         --m_suspendCount;
 
+    logSuspendCount();
+
     if (!m_suspendCount && m_callbacks.size())
         scheduleAnimation();
 }
 
+void ScriptedAnimationController::logSuspendCount()
+{
+#if defined NDEBUG
+    if (!m_document || !m_document->frame() || !m_document->frame()->settings().shouldLogScritedAnimationControllerSuspensionChange())
+        return;
+
+    WTFLogAlways("ScriptedAnimationController::m_suspendCount = %d", m_suspendCount);
+    WTFReportBacktrace();
+#endif
+}
+
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !RELEASE_LOG_DISABLED
 
 static const char* throttlingReasonToString(ScriptedAnimationController::ThrottlingReason reason)
index 08d9967..650bdca 100644 (file)
@@ -93,6 +93,7 @@ private:
     Document* m_document;
     CallbackId m_nextCallbackId { 0 };
     int m_suspendCount { 0 };
+    void logSuspendCount();
 
     void scheduleAnimation();
     void animationTimerFired();
index 01b3417..f4190a5 100644 (file)
@@ -277,6 +277,8 @@ visualViewportEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
 
 inputEventsEnabled initial=true
 
+shouldLogScritedAnimationControllerSuspensionChange initial=true
+
 quickTimePluginReplacementEnabled initial=defaultQuickTimePluginReplacementEnabled
 youTubeFlashPluginReplacementEnabled initial=defaultYouTubeFlashPluginReplacementEnabled
 
index 74b2713..a8d7c02 100644 (file)
@@ -265,6 +265,8 @@ void InternalSettings::resetToConsistentState()
     m_page->mainFrame().setPageAndTextZoomFactors(1, 1);
     m_page->setCanStartMedia(true);
 
+    settings().setShouldLogScritedAnimationControllerSuspensionChange(true);
+
     settings().setForcePendingWebGLPolicy(false);
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     settings().setAllowsAirPlayForMediaPlayback(false);
@@ -730,6 +732,16 @@ void InternalSettings::setWebGPUEnabled(bool enabled)
 #endif
 }
 
+bool InternalSettings::shouldLogScritedAnimationControllerSuspensionChange()
+{
+    return settings().shouldLogScritedAnimationControllerSuspensionChange();
+}
+
+void InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange(bool shouldLogScritedAnimationControllerSuspensionChange)
+{
+    settings().setShouldLogScritedAnimationControllerSuspensionChange(shouldLogScritedAnimationControllerSuspensionChange);
+}
+
 ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
 {
     if (!m_page)
index b9947b7..36e4f11 100644 (file)
@@ -111,6 +111,9 @@ public:
     ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue() const;
     void setForcedPrefersReducedMotionAccessibilityValue(ForcedAccessibilityValue);
 
+    bool shouldLogScritedAnimationControllerSuspensionChange();
+    void setShouldLogScritedAnimationControllerSuspensionChange(bool);
+
     // RuntimeEnabledFeatures.
     static void setIndexedDBWorkersEnabled(bool);
     static void setCSSGridLayoutEnabled(bool);
index 83176db..dfb6953 100644 (file)
@@ -95,7 +95,10 @@ enum ForcedAccessibilityValue { "system", "on", "off" };
 
     [MayThrowException] boolean deferredCSSParserEnabled();
     [MayThrowException] void setDeferredCSSParserEnabled(boolean enabled);
-    
+
+    boolean shouldLogScritedAnimationControllerSuspensionChange();
+    void setShouldLogScritedAnimationControllerSuspensionChange(boolean shouldLogScritedAnimationControllerSuspensionChange);
+
     [MayThrowException] void setShouldMockBoldSystemFontForAccessibility(boolean shouldMock);
 
     attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;