Title: [218640] trunk
Revision
218640
Author
[email protected]
Date
2017-06-21 11:37:02 -0700 (Wed, 21 Jun 2017)

Log Message

Add logging to identify when the Page suspends scripted animations
https://bugs.webkit.org/show_bug.cgi?id=173626

Patch by Antoine Quint <[email protected]> on 2017-06-21
Reviewed by Tim Horton.

Source/WebCore:

We have a longstanding issue that some media/modern-media-controls tests time out due to
requestAnimationFrame callbacks not being serviced, which is tracked by webkit.org/b/173628.
We added some logging to identify when ScriptedAnimationController would get suspended in
webkit.org/b/173326. This logging points to the fact that the reason rAF callbacks aren't
serviced is because Document::requestAnimationFrame() suspends rAF when the page reports
that scripted animations ought to be suspended, which is true when m_scriptedAnimationsSuspended
is true. This patch adds logging that tracks when this flag is set, provided a new setting
shouldLogScriptedAnimationControllerSuspensionChange is true.

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::logSuspendCount):
* page/Page.cpp:
(WebCore::Page::suspendScriptedAnimations):
(WebCore::Page::resumeScriptedAnimations):
* page/Settings.in:

Source/WebKit/mac:

Add a new preference to control the new shouldLogScriptedAnimationControllerSuspensionChange settings
through WebKit. This is specific to WK1 since the issue we're trying to pinpoint only occurs on WK1 bots.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences shouldLogScriptedAnimationControllerSuspensionChange]):
(-[WebPreferences setShouldLogScriptedAnimationControllerSuspensionChange:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

Turn the new logging on for WK1/DRT since the issue we're trying to pinpoint only occurs on WK1 bots.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (218639 => 218640)


--- trunk/Source/WebCore/ChangeLog	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebCore/ChangeLog	2017-06-21 18:37:02 UTC (rev 218640)
@@ -1,3 +1,26 @@
+2017-06-21  Antoine Quint  <[email protected]>
+
+        Add logging to identify when the Page suspends scripted animations
+        https://bugs.webkit.org/show_bug.cgi?id=173626
+
+        Reviewed by Tim Horton.
+
+        We have a longstanding issue that some media/modern-media-controls tests time out due to
+        requestAnimationFrame callbacks not being serviced, which is tracked by webkit.org/b/173628.
+        We added some logging to identify when ScriptedAnimationController would get suspended in
+        webkit.org/b/173326. This logging points to the fact that the reason rAF callbacks aren't
+        serviced is because Document::requestAnimationFrame() suspends rAF when the page reports
+        that scripted animations ought to be suspended, which is true when m_scriptedAnimationsSuspended
+        is true. This patch adds logging that tracks when this flag is set, provided a new setting
+        shouldLogScriptedAnimationControllerSuspensionChange is true.
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::logSuspendCount):
+        * page/Page.cpp:
+        (WebCore::Page::suspendScriptedAnimations):
+        (WebCore::Page::resumeScriptedAnimations):
+        * page/Settings.in:
+
 2017-06-21  Basuke Suzuki  <[email protected]>
 
         [Curl] Extract CurlDownloadManager as shared background task handler

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (218639 => 218640)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-06-21 18:37:02 UTC (rev 218640)
@@ -93,10 +93,11 @@
 
 void ScriptedAnimationController::logSuspendCount()
 {
-#if !defined(NDEBUG)
-    WTFLogAlways("ScriptedAnimationController::m_suspendCount = %d", m_suspendCount);
+    if (!m_document || !m_document->frame() || !m_document->frame()->settings().shouldLogScriptedAnimationControllerSuspensionChange())
+        return;
+
+    WTFLogAlways("\nScriptedAnimationController::m_suspendCount = %d", m_suspendCount);
     WTFReportBacktrace();
-#endif
 }
 
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !RELEASE_LOG_DISABLED

Modified: trunk/Source/WebCore/page/Page.cpp (218639 => 218640)


--- trunk/Source/WebCore/page/Page.cpp	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebCore/page/Page.cpp	2017-06-21 18:37:02 UTC (rev 218640)
@@ -1145,6 +1145,11 @@
 
 void Page::suspendScriptedAnimations()
 {
+    if (settings().shouldLogScriptedAnimationControllerSuspensionChange()) {
+        WTFLogAlways("\nPage::suspendScriptedAnimations()");
+        WTFReportBacktrace();
+    }
+
     m_scriptedAnimationsSuspended = true;
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
@@ -1154,6 +1159,11 @@
 
 void Page::resumeScriptedAnimations()
 {
+    if (settings().shouldLogScriptedAnimationControllerSuspensionChange()) {
+        WTFLogAlways("\nPage::resumeScriptedAnimations()");
+        WTFReportBacktrace();
+    }
+
     m_scriptedAnimationsSuspended = false;
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())

Modified: trunk/Source/WebCore/page/Settings.in (218639 => 218640)


--- trunk/Source/WebCore/page/Settings.in	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebCore/page/Settings.in	2017-06-21 18:37:02 UTC (rev 218640)
@@ -299,3 +299,5 @@
 constantPropertiesEnabled initial=false
 
 viewportFitEnabled initial=false
+
+shouldLogScriptedAnimationControllerSuspensionChange initial=false

Modified: trunk/Source/WebKit/mac/ChangeLog (218639 => 218640)


--- trunk/Source/WebKit/mac/ChangeLog	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-06-21 18:37:02 UTC (rev 218640)
@@ -1,3 +1,22 @@
+2017-06-21  Antoine Quint  <[email protected]>
+
+        Add logging to identify when the Page suspends scripted animations
+        https://bugs.webkit.org/show_bug.cgi?id=173626
+
+        Reviewed by Tim Horton.
+
+        Add a new preference to control the new shouldLogScriptedAnimationControllerSuspensionChange settings
+        through WebKit. This is specific to WK1 since the issue we're trying to pinpoint only occurs on WK1 bots.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences shouldLogScriptedAnimationControllerSuspensionChange]):
+        (-[WebPreferences setShouldLogScriptedAnimationControllerSuspensionChange:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-06-20  Myles C. Maxfield  <[email protected]>
 
         Disable font variations on macOS Sierra and iOS 10

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (218639 => 218640)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2017-06-21 18:37:02 UTC (rev 218640)
@@ -241,3 +241,4 @@
 #define WebKitUserTimingEnabledPreferenceKey @"WebKitUserTimingEnabled"
 #define WebKitResourceTimingEnabledPreferenceKey @"WebKitResourceTimingEnabled"
 #define WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey @"WebKitMediaContentTypesRequiringHardwareSupport"
+#define WebKitShouldLogScriptedAnimationControllerSuspensionChangePreferenceKey @"WebKitShouldLogScriptedAnimationControllerSuspensionChange"

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (218639 => 218640)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2017-06-21 18:37:02 UTC (rev 218640)
@@ -671,6 +671,7 @@
         @NO, WebKitMediaUserGestureInheritsFromDocument,
         @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
+        @NO, WebKitShouldLogScriptedAnimationControllerSuspensionChangePreferenceKey,
         nil];
 
 #if !PLATFORM(IOS)
@@ -3137,6 +3138,16 @@
     [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
 }
 
+- (BOOL)shouldLogScriptedAnimationControllerSuspensionChange
+{
+    return [self _boolValueForKey:WebKitShouldLogScriptedAnimationControllerSuspensionChangePreferenceKey];
+}
+
+- (void)setShouldLogScriptedAnimationControllerSuspensionChange:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitShouldLogScriptedAnimationControllerSuspensionChangePreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (218639 => 218640)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2017-06-21 18:37:02 UTC (rev 218640)
@@ -584,4 +584,7 @@
 
 @property (nonatomic) NSString *mediaContentTypesRequiringHardwareSupport;
 
+- (void)setShouldLogScriptedAnimationControllerSuspensionChange:(BOOL)flag;
+- (BOOL)shouldLogScriptedAnimationControllerSuspensionChange;
+
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (218639 => 218640)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-21 18:37:02 UTC (rev 218640)
@@ -2846,6 +2846,7 @@
 
     settings.setVisualViewportEnabled([preferences visualViewportEnabled]);
     settings.setMediaContentTypesRequiringHardwareSupport([preferences mediaContentTypesRequiringHardwareSupport]);
+    settings.setShouldLogScriptedAnimationControllerSuspensionChange([preferences shouldLogScriptedAnimationControllerSuspensionChange]);
 
     switch ([preferences storageBlockingPolicy]) {
     case WebAllowAllStorage:

Modified: trunk/Tools/ChangeLog (218639 => 218640)


--- trunk/Tools/ChangeLog	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Tools/ChangeLog	2017-06-21 18:37:02 UTC (rev 218640)
@@ -1,3 +1,15 @@
+2017-06-21  Antoine Quint  <[email protected]>
+
+        Add logging to identify when the Page suspends scripted animations
+        https://bugs.webkit.org/show_bug.cgi?id=173626
+
+        Reviewed by Tim Horton.
+
+        Turn the new logging on for WK1/DRT since the issue we're trying to pinpoint only occurs on WK1 bots.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+
 2017-06-21  Chris Fleizach  <[email protected]>
 
         AX: Cannot call setValue() on contenteditable or ARIA text controls

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (218639 => 218640)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-06-21 17:08:02 UTC (rev 218639)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-06-21 18:37:02 UTC (rev 218640)
@@ -966,6 +966,8 @@
     [preferences setResourceTimingEnabled:YES];
     [preferences setUserTimingEnabled:YES];
 
+    [preferences setShouldLogScriptedAnimationControllerSuspensionChange:YES];
+
     [WebPreferences _clearNetworkLoaderSession];
     [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to