Title: [286565] trunk/Source
Revision
286565
Author
[email protected]
Date
2021-12-06 13:15:39 -0800 (Mon, 06 Dec 2021)

Log Message

Add a call to os_signpost to tag a momentum scroll animation
https://bugs.webkit.org/show_bug.cgi?id=233885

Reviewed by Tim Horton.

Source/WebCore:

Use the momentum "Began" and "Ended" events to mark the start/end of a momentum scroll
as an animation via os_signost.

Put the code in ScrollingEffectsController rather than MomentumEventDispatcher so that
non-generated momentum gets marked too.

* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::handleWheelEvent):

Source/WTF:

* wtf/SystemTracing.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (286564 => 286565)


--- trunk/Source/WTF/ChangeLog	2021-12-06 21:06:11 UTC (rev 286564)
+++ trunk/Source/WTF/ChangeLog	2021-12-06 21:15:39 UTC (rev 286565)
@@ -1,3 +1,12 @@
+2021-12-06  Simon Fraser  <[email protected]>
+
+        Add a call to os_signpost to tag a momentum scroll animation
+        https://bugs.webkit.org/show_bug.cgi?id=233885
+
+        Reviewed by Tim Horton.
+
+        * wtf/SystemTracing.h:
+
 2021-12-06  Antoine Quint  <[email protected]>
 
         [Web Animations] Add a way to run scripted animations

Modified: trunk/Source/WTF/wtf/SystemTracing.h (286564 => 286565)


--- trunk/Source/WTF/wtf/SystemTracing.h	2021-12-06 21:06:11 UTC (rev 286564)
+++ trunk/Source/WTF/wtf/SystemTracing.h	2021-12-06 21:15:39 UTC (rev 286565)
@@ -196,6 +196,7 @@
 WTF_EXPORT_PRIVATE os_log_t WTFSignpostLogHandle();
 WTF_EXTERN_C_END
 
+// These macros only emit signposts on internal builds when WEBKIT_SIGNPOSTS_ENABLED is set.
 #define WTFEmitSignpost(pointer, name, ...) \
     WTFEmitSignpostWithFunction(os_signpost_event_emit, (pointer), name, ##__VA_ARGS__)
 
@@ -214,6 +215,21 @@
     } \
 } while (0)
 
+// These macros emit signposts on all builds.
+#define WTFEmitSignpostAlways(name, format, ...) \
+    do { os_signpost_event_emit(WTFSignpostLogHandle(), OS_SIGNPOST_ID_EXCLUSIVE, name, format, ##__VA_ARGS__); } } while (0)
+
+#define WTFBeginSignpostIntervalAlways(name, format, ...) \
+    do { os_signpost_interval_begin(WTFSignpostLogHandle(), OS_SIGNPOST_ID_EXCLUSIVE, name, format, ##__VA_ARGS__); } while (0)
+
+#define WTF_OS_SIGNPOST_ANIMATION_INTERVAL_TAG "isAnimation=YES"
+
+#define WTFBeginAnimationSignpostIntervalAlways(name, format, ...) \
+    do { os_signpost_interval_begin(WTFSignpostLogHandle(), OS_SIGNPOST_ID_EXCLUSIVE, name, format " " WTF_OS_SIGNPOST_ANIMATION_INTERVAL_TAG, ##__VA_ARGS__); } while (0)
+
+#define WTFEndSignpostIntervalAlways(name, format, ...) \
+    do { os_signpost_interval_end(WTFSignpostLogHandle(), OS_SIGNPOST_ID_EXCLUSIVE, name, format, ##__VA_ARGS__); } while (0)
+
 #else
 
 #define WTFEmitSignpost(pointer, name, ...) do { } while (0)
@@ -220,4 +236,9 @@
 #define WTFBeginSignpost(pointer, name, ...) do { } while (0)
 #define WTFEndSignpost(pointer, name, ...) do { } while (0)
 
+#define WTFEmitSignpostAlways(name, format, ...) do { } while (0)
+#define WTFBeginSignpostIntervalAlways(name, format, ...) do { } while (0)
+#define WTFBeginAnimationSignpostIntervalAlways(name, format, ...) do { } while (0)
+#define WTFEndSignpostIntervalAlways(name, format, ...) do { } while (0)
+
 #endif

Modified: trunk/Source/WebCore/ChangeLog (286564 => 286565)


--- trunk/Source/WebCore/ChangeLog	2021-12-06 21:06:11 UTC (rev 286564)
+++ trunk/Source/WebCore/ChangeLog	2021-12-06 21:15:39 UTC (rev 286565)
@@ -1,3 +1,19 @@
+2021-12-06  Simon Fraser  <[email protected]>
+
+        Add a call to os_signpost to tag a momentum scroll animation
+        https://bugs.webkit.org/show_bug.cgi?id=233885
+
+        Reviewed by Tim Horton.
+
+        Use the momentum "Began" and "Ended" events to mark the start/end of a momentum scroll
+        as an animation via os_signost.
+
+        Put the code in ScrollingEffectsController rather than MomentumEventDispatcher so that
+        non-generated momentum gets marked too.
+
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::handleWheelEvent):
+
 2021-12-06  Devin Rousso  <[email protected]>
 
         Change IDL `Date` to be backed by `WallTime` to avoid confusion when converting to native dates

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (286564 => 286565)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-06 21:06:11 UTC (rev 286564)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-06 21:15:39 UTC (rev 286565)
@@ -34,6 +34,7 @@
 #import <pal/spi/mac/NSScrollViewSPI.h>
 #import <sys/sysctl.h>
 #import <sys/time.h>
+#import <wtf/SystemTracing.h>
 #import <wtf/text/TextStream.h>
 
 #if PLATFORM(MAC)
@@ -177,6 +178,10 @@
     delta = deltaAlignedToDominantAxis(delta);
 
     auto momentumPhase = wheelEvent.momentumPhase();
+    
+    if (momentumPhase == PlatformWheelEventPhase::Began)
+        WTFBeginAnimationSignpostIntervalAlways("Momentum scroll", "");
+    
     if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase::Began || momentumPhase == PlatformWheelEventPhase::Changed))
         m_momentumScrollInProgress = true;
 
@@ -219,6 +224,7 @@
     }
 
     if (m_momentumScrollInProgress && momentumPhase == PlatformWheelEventPhase::Ended) {
+        WTFEndSignpostIntervalAlways("Momentum scroll", "");
         m_momentumScrollInProgress = false;
         m_ignoreMomentumScrolls = false;
         m_lastMomentumScrollTimestamp = { };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to