Title: [273758] trunk/Source/WebCore
Revision
273758
Author
[email protected]
Date
2021-03-02 13:31:00 -0800 (Tue, 02 Mar 2021)

Log Message

Move AnimationFrameRate code into a .cpp file
https://bugs.webkit.org/show_bug.cgi?id=222609

Reviewed by Zalan Bujtas.

AnimationFrameRate code is getting larger. It should not all be inline.

Add ANGLEWebKitBridge.* to the project; they were missing.

Sort the Xcode project, deal with unified sources fallout.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/AnimationFrameRate.cpp: Copied from Source/WebCore/platform/graphics/AnimationFrameRate.h.
(WebCore::framesPerSecondNearestFullSpeed):
(WebCore::preferredFrameInterval):
(WebCore::preferredFramesPerSecond):
(WebCore::operator<<):
* platform/graphics/AnimationFrameRate.h:
(WebCore::framesPerSecondNearestFullSpeed): Deleted.
(WebCore::preferredFrameInterval): Deleted.
(WebCore::preferredFramesPerSecond): Deleted.
(WebCore::operator<<): Deleted.
* platform/graphics/cg/ImageUtilitiesCG.cpp:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273757 => 273758)


--- trunk/Source/WebCore/ChangeLog	2021-03-02 21:13:00 UTC (rev 273757)
+++ trunk/Source/WebCore/ChangeLog	2021-03-02 21:31:00 UTC (rev 273758)
@@ -1,3 +1,30 @@
+2021-03-02  Simon Fraser  <[email protected]>
+
+        Move AnimationFrameRate code into a .cpp file
+        https://bugs.webkit.org/show_bug.cgi?id=222609
+
+        Reviewed by Zalan Bujtas.
+
+        AnimationFrameRate code is getting larger. It should not all be inline.
+
+        Add ANGLEWebKitBridge.* to the project; they were missing.
+
+        Sort the Xcode project, deal with unified sources fallout.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/AnimationFrameRate.cpp: Copied from Source/WebCore/platform/graphics/AnimationFrameRate.h.
+        (WebCore::framesPerSecondNearestFullSpeed):
+        (WebCore::preferredFrameInterval):
+        (WebCore::preferredFramesPerSecond):
+        (WebCore::operator<<):
+        * platform/graphics/AnimationFrameRate.h:
+        (WebCore::framesPerSecondNearestFullSpeed): Deleted.
+        (WebCore::preferredFrameInterval): Deleted.
+        (WebCore::preferredFramesPerSecond): Deleted.
+        (WebCore::operator<<): Deleted.
+        * platform/graphics/cg/ImageUtilitiesCG.cpp:
+
 2021-03-02  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Enable simplified vertical alignment for non-empty root inline box

Modified: trunk/Source/WebCore/Sources.txt (273757 => 273758)


--- trunk/Source/WebCore/Sources.txt	2021-03-02 21:13:00 UTC (rev 273757)
+++ trunk/Source/WebCore/Sources.txt	2021-03-02 21:31:00 UTC (rev 273758)
@@ -1918,6 +1918,7 @@
 platform/gamepad/GamepadConstants.cpp
 platform/gamepad/GamepadProvider.cpp
 platform/graphics/ANGLEWebKitBridge.cpp
+platform/graphics/AnimationFrameRate.cpp
 platform/graphics/BitmapImage.cpp
 platform/graphics/Color.cpp
 platform/graphics/ColorBlending.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (273757 => 273758)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-02 21:13:00 UTC (rev 273757)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-02 21:31:00 UTC (rev 273758)
@@ -6136,6 +6136,9 @@
 		0F790F3D2517CE6D009BA034 /* DisplayView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayView.cpp; sourceTree = "<group>"; };
 		0F790F3F2517CE6D009BA034 /* DisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayView.h; sourceTree = "<group>"; };
 		0F7DF1471E2BF1A60095951B /* WebCoreJSClientData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreJSClientData.cpp; sourceTree = "<group>"; };
+		0F7E475125EEB79A0013F909 /* AnimationFrameRate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AnimationFrameRate.cpp; sourceTree = "<group>"; };
+		0F7E475325EEB79B0013F909 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
+		0F7E475425EEB79B0013F909 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
 		0F850FE21ED7C18300FB77A7 /* PerformanceLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceLoggingClient.h; sourceTree = "<group>"; };
 		0F8682FA25707F4700C08BB5 /* DisplayStackingItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayStackingItem.h; sourceTree = "<group>"; };
 		0F8682FC25707F4700C08BB5 /* DisplayStackingItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayStackingItem.cpp; sourceTree = "<group>"; };
@@ -17479,8 +17482,8 @@
 				313591031E7DDC6000F30630 /* RTCIceTransportState.h */,
 				07221BAA17CF0AD400848E51 /* RTCPeerConnectionHandlerClient.h */,
 				41A48A9D1E8312EB00D2AC2D /* RTCPeerConnectionState.h */,
+				412BA5FE218C651800365474 /* RTCPMuxPolicy.h */,
 				413CC11C25E7D98D00D59C4B /* RTCPriorityType.h */,
-				412BA5FE218C651800365474 /* RTCPMuxPolicy.h */,
 				412DE4B6219285BF0075F3A7 /* RTCRtpCapabilities.h */,
 				41E0A7DC23BB63DB00561060 /* RTCRtpCodecCapability.h */,
 				31EB54DD1E7DC74400C1623B /* RTCRtpTransceiverDirection.h */,
@@ -26647,6 +26650,9 @@
 				3721493318F0B6D600156EDC /* opentype */,
 				49E911B20EF86D27009D0CAF /* transforms */,
 				7299BC6423D686A600CC6883 /* AlphaPremultiplication.h */,
+				0F7E475325EEB79B0013F909 /* ANGLEWebKitBridge.cpp */,
+				0F7E475425EEB79B0013F909 /* ANGLEWebKitBridge.h */,
+				0F7E475125EEB79A0013F909 /* AnimationFrameRate.cpp */,
 				722A815C238FD50500C00583 /* AnimationFrameRate.h */,
 				BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */,
 				A89943270B42338700D7C802 /* BitmapImage.cpp */,
@@ -26659,9 +26665,9 @@
 				7C514E0224AF80580050710F /* ColorConversion.cpp */,
 				7C514E0024AF80580050710F /* ColorConversion.h */,
 				3103B7DE1DB01556008BB890 /* ColorHash.h */,
+				BC4A23EB25EC160200AAC630 /* ColorLuminance.h */,
 				7CAC6AE8247F082000E61D59 /* ColorMatrix.h */,
 				BC10137B25C3624B00DC773C /* ColorModels.h */,
-				BC4A23EB25EC160200AAC630 /* ColorLuminance.h */,
 				7CD1E69224ABF6240089C419 /* ColorSerialization.cpp */,
 				7CD1E69124ABF6240089C419 /* ColorSerialization.h */,
 				BCAFEDAF25966D050030E6AA /* ColorSpace.cpp */,
@@ -31608,6 +31614,7 @@
 				3103B7DF1DB01567008BB890 /* ColorHash.h in Headers */,
 				F55B3DB41251F12D003EF269 /* ColorInputType.h in Headers */,
 				CE5169E721F1B84700EA4F78 /* ColorIOS.h in Headers */,
+				BC4A23EC25EC160200AAC630 /* ColorLuminance.h in Headers */,
 				EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */,
 				7CAC6AE9247F082F00E61D59 /* ColorMatrix.h in Headers */,
 				BC10137C25C3624B00DC773C /* ColorModels.h in Headers */,
@@ -31873,7 +31880,6 @@
 				A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */,
 				715AD7212050513F00D592DC /* CSSTransition.h in Headers */,
 				371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */,
-				BC4A23EC25EC160200AAC630 /* ColorLuminance.h in Headers */,
 				0F6B707A237BC36D0052CA47 /* CSSUnits.h in Headers */,
 				DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
 				BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
@@ -34598,6 +34604,7 @@
 				078E094217D16E1C00420AA1 /* RTCPeerConnectionHandlerClient.h in Headers */,
 				419E6EC92566D278002B5010 /* RTCPeerConnectionIceErrorEvent.h in Headers */,
 				078E092417D14D1C00420AA1 /* RTCPeerConnectionIceEvent.h in Headers */,
+				413CC11D25E7D98E00D59C4B /* RTCPriorityType.h in Headers */,
 				4114FE3225BEBD19009D9F20 /* RTCRtcpParameters.h in Headers */,
 				412DE4B8219285C00075F3A7 /* RTCRtpCapabilities.h in Headers */,
 				5E2C43631BCEE32B0001E2BC /* RTCRtpReceiver.h in Headers */,
@@ -35090,7 +35097,6 @@
 				71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */,
 				B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */,
 				8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */,
-				413CC11D25E7D98E00D59C4B /* RTCPriorityType.h in Headers */,
 				B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */,
 				B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
 				8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,

Copied: trunk/Source/WebCore/platform/graphics/AnimationFrameRate.cpp (from rev 273754, trunk/Source/WebCore/platform/graphics/AnimationFrameRate.h) (0 => 273758)


--- trunk/Source/WebCore/platform/graphics/AnimationFrameRate.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/AnimationFrameRate.cpp	2021-03-02 21:31:00 UTC (rev 273758)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "config.h"
+#include "AnimationFrameRate.h"
+
+namespace WebCore {
+
+FramesPerSecond framesPerSecondNearestFullSpeed(FramesPerSecond nominalFramesPerSecond)
+{
+    if (nominalFramesPerSecond <= FullSpeedFramesPerSecond)
+        return nominalFramesPerSecond;
+
+    float fullSpeedRatio = nominalFramesPerSecond / FullSpeedFramesPerSecond;
+    FramesPerSecond floorSpeed = nominalFramesPerSecond / std::floor(fullSpeedRatio);
+    FramesPerSecond ceilSpeed = nominalFramesPerSecond / std::ceil(fullSpeedRatio);
+
+    return fullSpeedRatio - std::floor(fullSpeedRatio) <= 0.5 ? floorSpeed : ceilSpeed;
+}
+
+Seconds preferredFrameInterval(const OptionSet<ThrottlingReason>& reasons, Optional<FramesPerSecond> nominalFramesPerSecond)
+{
+    if (reasons.contains(ThrottlingReason::OutsideViewport))
+        return AggressiveThrottlingAnimationInterval;
+
+    if (!nominalFramesPerSecond || *nominalFramesPerSecond == FullSpeedFramesPerSecond) {
+        // FIXME: handle ThrottlingReason::VisuallyIdle
+        if (reasons.containsAny({ ThrottlingReason::LowPowerMode, ThrottlingReason::NonInteractedCrossOriginFrame }))
+            return HalfSpeedThrottlingAnimationInterval;
+        return FullSpeedAnimationInterval;
+    }
+
+    auto framesPerSecond = framesPerSecondNearestFullSpeed(*nominalFramesPerSecond);
+    auto interval = Seconds(1.0 / framesPerSecond);
+
+    if (reasons.containsAny({ ThrottlingReason::LowPowerMode, ThrottlingReason::NonInteractedCrossOriginFrame, ThrottlingReason::VisuallyIdle }))
+        interval *= IntervalThrottlingFactor;
+
+    return interval;
+}
+
+FramesPerSecond preferredFramesPerSecond(Seconds preferredFrameInterval)
+{
+    if (preferredFrameInterval == FullSpeedAnimationInterval)
+        return FullSpeedFramesPerSecond;
+
+    if (preferredFrameInterval == HalfSpeedThrottlingAnimationInterval)
+        return HalfSpeedThrottlingFramesPerSecond;
+
+    return std::round(1 / preferredFrameInterval.seconds());
+}
+
+TextStream& operator<<(TextStream& ts, const OptionSet<ThrottlingReason>& reasons)
+{
+    bool didAppend = false;
+
+    for (auto reason : reasons) {
+        if (didAppend)
+            ts << "|";
+        switch (reason) {
+        case ThrottlingReason::VisuallyIdle:
+            ts << "VisuallyIdle";
+            break;
+        case ThrottlingReason::OutsideViewport:
+            ts << "OutsideViewport";
+            break;
+        case ThrottlingReason::LowPowerMode:
+            ts << "LowPowerMode";
+            break;
+        case ThrottlingReason::NonInteractedCrossOriginFrame:
+            ts << "NonInteractiveCrossOriginFrame";
+            break;
+        }
+        didAppend = true;
+    }
+
+    if (reasons.isEmpty())
+        ts << "[Unthrottled]";
+    return ts;
+}
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/AnimationFrameRate.h (273757 => 273758)


--- trunk/Source/WebCore/platform/graphics/AnimationFrameRate.h	2021-03-02 21:13:00 UTC (rev 273757)
+++ trunk/Source/WebCore/platform/graphics/AnimationFrameRate.h	2021-03-02 21:31:00 UTC (rev 273758)
@@ -50,77 +50,10 @@
 constexpr const FramesPerSecond FullSpeedFramesPerSecond = 60;
 constexpr const FramesPerSecond HalfSpeedThrottlingFramesPerSecond = 30;
 
-inline FramesPerSecond framesPerSecondNearestFullSpeed(FramesPerSecond nominalFramesPerSecond)
-{
-    if (nominalFramesPerSecond <= FullSpeedFramesPerSecond)
-        return nominalFramesPerSecond;
+WEBCORE_EXPORT FramesPerSecond framesPerSecondNearestFullSpeed(FramesPerSecond);
+WEBCORE_EXPORT Seconds preferredFrameInterval(const OptionSet<ThrottlingReason>&, Optional<FramesPerSecond> nominalFramesPerSecond);
+WEBCORE_EXPORT FramesPerSecond preferredFramesPerSecond(Seconds);
 
-    float fullSpeedRatio = nominalFramesPerSecond / FullSpeedFramesPerSecond;
-    FramesPerSecond floorSpeed = nominalFramesPerSecond / std::floor(fullSpeedRatio);
-    FramesPerSecond ceilSpeed = nominalFramesPerSecond / std::ceil(fullSpeedRatio);
+WEBCORE_EXPORT TextStream& operator<<(TextStream&, const OptionSet<ThrottlingReason>&);
 
-    return fullSpeedRatio - std::floor(fullSpeedRatio) <= 0.5 ? floorSpeed : ceilSpeed;
 }
-
-inline Seconds preferredFrameInterval(const OptionSet<ThrottlingReason>& reasons, Optional<FramesPerSecond> nominalFramesPerSecond)
-{
-    if (reasons.contains(ThrottlingReason::OutsideViewport))
-        return AggressiveThrottlingAnimationInterval;
-
-    if (!nominalFramesPerSecond || *nominalFramesPerSecond == FullSpeedFramesPerSecond) {
-        // FIXME: handle ThrottlingReason::VisuallyIdle
-        if (reasons.containsAny({ ThrottlingReason::LowPowerMode, ThrottlingReason::NonInteractedCrossOriginFrame }))
-            return HalfSpeedThrottlingAnimationInterval;
-        return FullSpeedAnimationInterval;
-    }
-
-    auto framesPerSecond = framesPerSecondNearestFullSpeed(*nominalFramesPerSecond);
-    auto interval = Seconds(1.0 / framesPerSecond);
-
-    if (reasons.containsAny({ ThrottlingReason::LowPowerMode, ThrottlingReason::NonInteractedCrossOriginFrame, ThrottlingReason::VisuallyIdle }))
-        interval *= IntervalThrottlingFactor;
-
-    return interval;
-}
-
-inline FramesPerSecond preferredFramesPerSecond(Seconds preferredFrameInterval)
-{
-    if (preferredFrameInterval == FullSpeedAnimationInterval)
-        return FullSpeedFramesPerSecond;
-
-    if (preferredFrameInterval == HalfSpeedThrottlingAnimationInterval)
-        return HalfSpeedThrottlingFramesPerSecond;
-
-    return std::round(1 / preferredFrameInterval.seconds());
-}
-
-inline TextStream& operator<<(TextStream& ts, const OptionSet<ThrottlingReason>& reasons)
-{
-    bool didAppend = false;
-
-    for (auto reason : reasons) {
-        if (didAppend)
-            ts << "|";
-        switch (reason) {
-        case ThrottlingReason::VisuallyIdle:
-            ts << "VisuallyIdle";
-            break;
-        case ThrottlingReason::OutsideViewport:
-            ts << "OutsideViewport";
-            break;
-        case ThrottlingReason::LowPowerMode:
-            ts << "LowPowerMode";
-            break;
-        case ThrottlingReason::NonInteractedCrossOriginFrame:
-            ts << "NonInteractiveCrossOriginFrame";
-            break;
-        }
-        didAppend = true;
-    }
-
-    if (reasons.isEmpty())
-        ts << "[Unthrottled]";
-    return ts;
-}
-
-}

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp (273757 => 273758)


--- trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	2021-03-02 21:13:00 UTC (rev 273757)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	2021-03-02 21:31:00 UTC (rev 273758)
@@ -28,6 +28,7 @@
 
 #include "Logging.h"
 #include "MIMETypeRegistry.h"
+#include "UTIUtilities.h"
 #include <ImageIO/ImageIO.h>
 #include <wtf/FileSystem.h>
 #include <wtf/text/CString.h>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to