Changeset 255150 in webkit
- Timestamp:
- Jan 27, 2020 9:26:07 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r255140 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-27 Antti Koivisto <antti@apple.com> 2 15 -
trunk/LayoutTests/fast/animation/css-animation-throttling-lowPowerMode.html
r255131 r255150 26 26 jsTestIsAsync = true; 27 27 28 if (window.internals)29 internals.settings.setRenderingUpdateThrottlingEnabled(true);30 31 28 const element = document.getElementById("testElement"); 32 29 element.onanimationstart = function() { -
trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe.html
r255131 r255150 6 6 description("Tests that requestAnimationFrame is throttled in subframes that are outside the viewport"); 7 7 window.jsTestIsAsync = true; 8 9 if (window.internals)10 internals.settings.setRenderingUpdateThrottlingEnabled(true);11 8 12 9 function checkSubframesThrottled() -
trunk/LayoutTests/fast/animation/request-animation-frame-throttling-detached-iframe.html
r255131 r255150 6 6 description("Test that requestAnimationFrame gets the right throttling in an iframe when inserted into a document."); 7 7 jsTestIsAsync = true; 8 9 if (window.internals)10 internals.settings.setRenderingUpdateThrottlingEnabled(true);11 8 12 9 let i = 0; -
trunk/LayoutTests/fast/animation/request-animation-frame-throttling-lowPowerMode-expected.txt
r255131 r255150 4 4 5 5 6 PASS farmesPerSecond < 35 is true 6 PASS internals.isRequestAnimationFrameThrottled() is false 7 PASS internals.requestAnimationFrameInterval is Infinity 8 rAFHandle = requestAnimationFrame(doWork); 9 PASS internals.isRequestAnimationFrameThrottled() is false 10 PASS internals.requestAnimationFrameInterval is 0.015 11 internals.setLowPowerModeEnabled(true); 12 PASS internals.isRequestAnimationFrameThrottled() is true 13 PASS internals.requestAnimationFrameInterval is 0.030 14 cancelAnimationFrame(rAFHandle); 15 PASS internals.isRequestAnimationFrameThrottled() is true 16 PASS internals.requestAnimationFrameInterval is 0.030 17 rAFHandle = requestAnimationFrame(doWork); 18 PASS internals.isRequestAnimationFrameThrottled() is true 19 PASS internals.requestAnimationFrameInterval is 0.030 20 internals.setLowPowerModeEnabled(false); 21 PASS internals.isRequestAnimationFrameThrottled() is false 22 PASS internals.requestAnimationFrameInterval is 0.015 7 23 PASS successfullyParsed is true 8 24 -
trunk/LayoutTests/fast/animation/request-animation-frame-throttling-lowPowerMode.html
r255131 r255150 2 2 <html> 3 3 <body> 4 <script src="../../resources/js-test-pre.js"></script> 5 <script> 6 description("Test that requestAnimationFrame gets throttled in low power mode."); 7 window.jsTestIsAsync = true; 4 <script src="../../resources/js-test-pre.js"></script> 5 <script> 6 description("Test that requestAnimationFrame gets throttled in low power mode."); 8 7 9 if (window.internals) { 10 internals.settings.setRenderingUpdateThrottlingEnabled(true); 11 internals.setLowPowerModeEnabled(true); 12 } 8 let rAFHandle; 9 let i = 0; 10 function doWork() 11 { 12 i++; 13 rAFHandle = requestAnimationFrame(doWork); 14 } 13 15 14 var start = null; 15 var farmesPerSecond = 0; 16 function doWork(timestamp) { 17 if (!start) 18 start = timestamp; 19 if (timestamp - start < 1000) { 20 ++farmesPerSecond; 21 window.requestAnimationFrame(doWork); 22 } 23 else { 24 // The LowPowerMode throttling interval = 30_ms. The frame rate ~= 33.3 fps. 25 shouldBeTrue("farmesPerSecond < 35"); 26 finishJSTest(); 27 } 28 } 29 window.requestAnimationFrame(doWork); 30 </script> 31 <script src="../../resources/js-test-post.js"></script> 16 shouldBeFalse("internals.isRequestAnimationFrameThrottled()"); 17 shouldBe("internals.requestAnimationFrameInterval", "Infinity"); 18 evalAndLog("rAFHandle = requestAnimationFrame(doWork);"); 19 shouldBeFalse("internals.isRequestAnimationFrameThrottled()"); 20 shouldBe("internals.requestAnimationFrameInterval", "0.015"); 21 evalAndLog("internals.setLowPowerModeEnabled(true);"); 22 shouldBeTrue("internals.isRequestAnimationFrameThrottled()"); 23 shouldBe("internals.requestAnimationFrameInterval", "0.030"); 24 evalAndLog("cancelAnimationFrame(rAFHandle);"); 25 shouldBeTrue("internals.isRequestAnimationFrameThrottled()"); 26 shouldBe("internals.requestAnimationFrameInterval", "0.030"); 27 evalAndLog("rAFHandle = requestAnimationFrame(doWork);"); 28 shouldBeTrue("internals.isRequestAnimationFrameThrottled()"); 29 shouldBe("internals.requestAnimationFrameInterval", "0.030"); 30 evalAndLog("internals.setLowPowerModeEnabled(false);"); 31 shouldBeFalse("internals.isRequestAnimationFrameThrottled()"); 32 shouldBe("internals.requestAnimationFrameInterval", "0.015"); 33 </script> 34 <script src="../../resources/js-test-post.js"></script> 32 35 </body> 33 36 </html> -
trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html
r255131 r255150 14 14 description("Tests that requestAnimationFrame is throttled in subframes that are cross-origin, and not in same-origin frames"); 15 15 window.jsTestIsAsync = true; 16 17 if (window.internals) 18 internals.settings.setRenderingUpdateThrottlingEnabled(true); 19 16 20 17 var crossOriginFrame; 21 18 var sameOriginFrame -
trunk/Source/WebCore/ChangeLog
r255149 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-27 Antoine Quint <graouts@apple.com> 2 15 -
trunk/Source/WebCore/Headers.cmake
r255149 r255150 1036 1036 platform/graphics/AlphaPremultiplication.h 1037 1037 platform/graphics/ANGLEWebKitBridge.h 1038 platform/graphics/AnimationFrameRate.h1039 1038 platform/graphics/AudioTrackPrivate.h 1040 1039 platform/graphics/BitmapImage.h -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r255149 r255150 2145 2145 72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2146 2146 72283F0E230B268C00F5D828 /* ImagePaintingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2147 722A815D238FDAF000C00583 /* AnimationFrameRate.h in Headers */ = {isa = PBXBuildFile; fileRef = 722A815C238FD50500C00583 /* AnimationFrameRate.h */; settings = {ATTRIBUTES = (Private, ); }; };2148 2147 724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; }; 2149 2148 724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54E1DC7F25B00A91FFB /* ActivityState.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 9641 9640 721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; }; 9642 9641 721443462240CAD200F12FF7 /* SVGValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValueProperty.h; sourceTree = "<group>"; }; 9643 722A815C238FD50500C00583 /* AnimationFrameRate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnimationFrameRate.h; sourceTree = "<group>"; };9644 9642 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; }; 9645 9643 724ED32A1A3A7E5400F5F13C /* EXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTBlendMinMax.h; sourceTree = "<group>"; }; … … 25056 25054 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */, 25057 25055 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */, 25058 722A815C238FD50500C00583 /* AnimationFrameRate.h */,25059 25056 BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */, 25060 25057 A89943270B42338700D7C802 /* BitmapImage.cpp */, … … 29103 29100 71E2C42621C935280024F8C8 /* AnimationEffectPhase.h in Headers */, 29104 29101 319848011A1D817B00A13318 /* AnimationEvent.h in Headers */, 29105 722A815D238FDAF000C00583 /* AnimationFrameRate.h in Headers */,29106 29102 49E912AD0EFAC906009D0CAF /* AnimationList.h in Headers */, 29107 29103 714C7C661FDAD2A100F2BEE1 /* AnimationPlaybackEvent.h in Headers */, -
trunk/Source/WebCore/animation/DocumentTimeline.cpp
r255141 r255150 45 45 #include <JavaScriptCore/VM.h> 46 46 47 static const Seconds defaultAnimationInterval { 15_ms }; 48 static const Seconds throttledAnimationInterval { 30_ms }; 49 47 50 namespace WebCore { 48 51 … … 196 199 } 197 200 201 void DocumentTimeline::updateThrottlingState() 202 { 203 scheduleAnimationResolution(); 204 } 205 198 206 Seconds DocumentTimeline::animationInterval() const 199 207 { 200 208 if (!m_document || !m_document->page()) 201 209 return Seconds::infinity(); 202 return m_document->page()-> preferredRenderingUpdateInterval();210 return m_document->page()->isLowPowerModeEnabled() ? throttledAnimationInterval : defaultAnimationInterval; 203 211 } 204 212 -
trunk/Source/WebCore/animation/DocumentTimeline.h
r255141 r255150 75 75 void updateAnimationsAndSendEvents(DOMHighResTimeStamp timestamp); 76 76 77 void updateThrottlingState(); 77 78 WEBCORE_EXPORT Seconds animationInterval() const; 78 79 WEBCORE_EXPORT void suspendAnimations(); -
trunk/Source/WebCore/dom/Document.cpp
r255141 r255150 6505 6505 m_scriptedAnimationController->suspend(); 6506 6506 6507 if (page() && page()->isLowPowerModeEnabled()) 6508 m_scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::LowPowerMode); 6509 6507 6510 if (!topOrigin().canAccess(securityOrigin()) && !hasHadUserInteraction()) 6508 m_scriptedAnimationController->addThrottlingReason( ThrottlingReason::NonInteractedCrossOriginFrame);6511 m_scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame); 6509 6512 } 6510 6513 … … 6745 6748 if (static_cast<bool>(time) && m_scriptedAnimationController) { 6746 6749 // It's OK to always remove NonInteractedCrossOriginFrame even if this frame isn't cross-origin. 6747 m_scriptedAnimationController->removeThrottlingReason( ThrottlingReason::NonInteractedCrossOriginFrame);6750 m_scriptedAnimationController->removeThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame); 6748 6751 } 6749 6752 -
trunk/Source/WebCore/dom/ScriptedAnimationController.cpp
r255131 r255150 1 1 /* 2 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2019 Apple Inc. All rights reserved.4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 28 27 #include "ScriptedAnimationController.h" 29 28 29 #include "Chrome.h" 30 #include "ChromeClient.h" 31 #include "CustomHeaderFields.h" 32 #include "DOMWindow.h" 33 #include "Document.h" 34 #include "DocumentLoader.h" 35 #include "Frame.h" 36 #include "FrameView.h" 30 37 #include "InspectorInstrumentation.h" 38 #include "Logging.h" 31 39 #include "Page.h" 32 40 #include "RequestAnimationFrameCallback.h" 33 41 #include "Settings.h" 42 #include <algorithm> 43 #include <wtf/Ref.h> 34 44 #include <wtf/SystemTracing.h> 45 #include <wtf/text/StringBuilder.h> 46 47 // Allow a little more than 60fps to make sure we can at least hit that frame rate. 48 static const Seconds fullSpeedAnimationInterval { 15_ms }; 49 // Allow a little more than 30fps to make sure we can at least hit that frame rate. 50 static const Seconds halfSpeedThrottlingAnimationInterval { 30_ms }; 51 static const Seconds aggressiveThrottlingAnimationInterval { 10_s }; 52 53 #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(page() && page()->isAlwaysOnLoggingAllowed(), PerformanceLogging, "%p - ScriptedAnimationController::" fmt, this, ##__VA_ARGS__) 35 54 36 55 namespace WebCore { … … 38 57 ScriptedAnimationController::ScriptedAnimationController(Document& document) 39 58 : m_document(makeWeakPtr(document)) 59 , m_animationTimer(*this, &ScriptedAnimationController::animationTimerFired) 40 60 { 41 61 } … … 46 66 { 47 67 return m_document && m_document->settings().requestAnimationFrameEnabled(); 48 }49 50 Page* ScriptedAnimationController::page() const51 {52 return m_document ? m_document->page() : nullptr;53 }54 55 Seconds ScriptedAnimationController::preferredScriptedAnimationInterval() const56 {57 if (auto* page = this->page())58 return page->renderingUpdateThrottlingEnabled() ? preferredFrameInterval(m_throttlingReasons) : FullSpeedAnimationInterval;59 return FullSpeedAnimationInterval;60 }61 62 Seconds ScriptedAnimationController::interval() const63 {64 if (auto* page = this->page())65 return std::max(preferredScriptedAnimationInterval(), page->preferredRenderingUpdateInterval());66 return FullSpeedAnimationInterval;67 68 } 68 69 … … 83 84 } 84 85 86 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !RELEASE_LOG_DISABLED 87 88 static const char* throttlingReasonToString(ScriptedAnimationController::ThrottlingReason reason) 89 { 90 switch (reason) { 91 case ScriptedAnimationController::ThrottlingReason::VisuallyIdle: 92 return "VisuallyIdle"; 93 case ScriptedAnimationController::ThrottlingReason::OutsideViewport: 94 return "OutsideViewport"; 95 case ScriptedAnimationController::ThrottlingReason::LowPowerMode: 96 return "LowPowerMode"; 97 case ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame: 98 return "NonInteractiveCrossOriginFrame"; 99 } 100 } 101 102 static String throttlingReasonsToString(OptionSet<ScriptedAnimationController::ThrottlingReason> reasons) 103 { 104 if (reasons.isEmpty()) 105 return "[Unthrottled]"_s; 106 107 StringBuilder builder; 108 for (auto reason : reasons) { 109 if (!builder.isEmpty()) 110 builder.append('|'); 111 builder.append(throttlingReasonToString(reason)); 112 } 113 return builder.toString(); 114 } 115 116 #endif 117 118 void ScriptedAnimationController::addThrottlingReason(ThrottlingReason reason) 119 { 120 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 121 if (m_throttlingReasons.contains(reason)) 122 return; 123 124 m_throttlingReasons.add(reason); 125 126 RELEASE_LOG_IF_ALLOWED("addThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data()); 127 128 if (m_animationTimer.isActive()) { 129 m_animationTimer.stop(); 130 scheduleAnimation(); 131 } 132 #else 133 UNUSED_PARAM(reason); 134 #endif 135 } 136 137 void ScriptedAnimationController::removeThrottlingReason(ThrottlingReason reason) 138 { 139 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 140 if (!m_throttlingReasons.contains(reason)) 141 return; 142 143 m_throttlingReasons.remove(reason); 144 145 RELEASE_LOG_IF_ALLOWED("removeThrottlingReason(%s) -> %s", throttlingReasonToString(reason), throttlingReasonsToString(m_throttlingReasons).utf8().data()); 146 147 if (m_animationTimer.isActive()) { 148 m_animationTimer.stop(); 149 scheduleAnimation(); 150 } 151 #else 152 UNUSED_PARAM(reason); 153 #endif 154 } 155 85 156 bool ScriptedAnimationController::isThrottled() const 86 157 { 87 if (auto* page = this->page()) 88 return page->renderingUpdateThrottlingEnabled() && (page->isRenderingUpdateThrottled() || !m_throttlingReasons.isEmpty()); 158 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 159 return !m_throttlingReasons.isEmpty(); 160 #else 89 161 return false; 90 } 91 92 bool ScriptedAnimationController::isThrottledRelativeToPage() const 93 { 94 if (auto* page = this->page()) 95 return page->preferredRenderingUpdateInterval() < preferredScriptedAnimationInterval(); 96 return false; 97 } 98 99 bool ScriptedAnimationController::shouldRescheduleRequestAnimationFrame(DOMHighResTimeStamp timestamp) const 100 { 101 return isThrottledRelativeToPage() && Seconds(timestamp - m_lastAnimationFrameTimestamp) < preferredScriptedAnimationInterval(); 162 #endif 102 163 } 103 164 104 165 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(Ref<RequestAnimationFrameCallback>&& callback) 105 166 { 106 CallbackId callbackId = ++m_nextCallbackId;167 ScriptedAnimationController::CallbackId id = ++m_nextCallbackId; 107 168 callback->m_firedOrCancelled = false; 108 callback->m_id = callbackId;169 callback->m_id = id; 109 170 m_callbacks.append(WTFMove(callback)); 110 171 111 172 if (m_document) 112 InspectorInstrumentation::didRequestAnimationFrame(*m_document, callbackId);173 InspectorInstrumentation::didRequestAnimationFrame(*m_document, id); 113 174 114 175 if (!m_suspendCount) 115 176 scheduleAnimation(); 116 return callbackId; 117 } 118 119 void ScriptedAnimationController::cancelCallback(CallbackId callbackId) 120 { 121 bool cancelled = m_callbacks.removeFirstMatching([&](auto& callback) { 122 if (callback->m_id != callbackId) 123 return false; 124 callback->m_firedOrCancelled = true; 125 return true; 126 }); 127 128 if (cancelled && m_document) 129 InspectorInstrumentation::didCancelAnimationFrame(*m_document, callbackId); 177 return id; 178 } 179 180 void ScriptedAnimationController::cancelCallback(CallbackId id) 181 { 182 for (size_t i = 0; i < m_callbacks.size(); ++i) { 183 if (m_callbacks[i]->m_id == id) { 184 m_callbacks[i]->m_firedOrCancelled = true; 185 InspectorInstrumentation::didCancelAnimationFrame(*m_document, id); 186 m_callbacks.remove(i); 187 return; 188 } 189 } 130 190 } 131 191 … … 135 195 return; 136 196 137 if (shouldRescheduleRequestAnimationFrame(timestamp)) {138 scheduleAnimation();139 return;140 }141 142 197 TraceScope tracingScope(RAFCallbackStart, RAFCallbackEnd); 143 198 … … 169 224 }); 170 225 171 m_lastAnimationFrameTimestamp = timestamp;172 173 226 if (m_callbacks.size()) 174 227 scheduleAnimation(); 175 228 } 176 229 230 Seconds ScriptedAnimationController::interval() const 231 { 232 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 233 if (m_throttlingReasons.contains(ThrottlingReason::VisuallyIdle) || m_throttlingReasons.contains(ThrottlingReason::OutsideViewport)) 234 return aggressiveThrottlingAnimationInterval; 235 236 if (m_throttlingReasons.contains(ThrottlingReason::LowPowerMode)) 237 return halfSpeedThrottlingAnimationInterval; 238 239 if (m_throttlingReasons.contains(ThrottlingReason::NonInteractedCrossOriginFrame)) 240 return halfSpeedThrottlingAnimationInterval; 241 242 ASSERT(m_throttlingReasons.isEmpty()); 243 #endif 244 return fullSpeedAnimationInterval; 245 } 246 247 Page* ScriptedAnimationController::page() const 248 { 249 return m_document ? m_document->page() : nullptr; 250 } 251 177 252 void ScriptedAnimationController::scheduleAnimation() 178 253 { … … 180 255 return; 181 256 182 if (auto* page = this->page()) 183 page->renderingUpdateScheduler().scheduleTimedRenderingUpdate(); 184 } 185 186 } 257 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 258 if (!m_isUsingTimer && !isThrottled()) { 259 if (auto* page = this->page()) { 260 page->renderingUpdateScheduler().scheduleTimedRenderingUpdate(); 261 return; 262 } 263 264 m_isUsingTimer = true; 265 } 266 #endif 267 if (m_animationTimer.isActive()) 268 return; 269 270 Seconds animationInterval = interval(); 271 Seconds scheduleDelay = std::max(animationInterval - Seconds(m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0_s); 272 273 if (isThrottled()) { 274 // FIXME: not ideal to snapshot time both in now() and nowTimestamp(), the latter of which also has reduced resolution. 275 MonotonicTime now = MonotonicTime::now(); 276 277 MonotonicTime fireTime = now + scheduleDelay; 278 Seconds alignmentInterval = 10_ms; 279 // Snap to the nearest alignmentInterval. 280 Seconds alignment = (fireTime + alignmentInterval / 2) % alignmentInterval; 281 MonotonicTime alignedFireTime = fireTime - alignment; 282 scheduleDelay = alignedFireTime - now; 283 } 284 285 m_animationTimer.startOneShot(scheduleDelay); 286 } 287 288 void ScriptedAnimationController::animationTimerFired() 289 { 290 m_lastAnimationFrameTimestamp = m_document->domWindow()->nowTimestamp(); 291 serviceRequestAnimationFrameCallbacks(m_lastAnimationFrameTimestamp); 292 } 293 294 } -
trunk/Source/WebCore/dom/ScriptedAnimationController.h
r255131 r255150 1 1 /* 2 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2019 Apple Inc. All rights reserved.4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 27 26 #pragma once 28 27 29 #include "AnimationFrameRate.h"30 28 #include "DOMHighResTimeStamp.h" 29 #include "Timer.h" 31 30 #include <wtf/OptionSet.h> 32 31 #include <wtf/RefCounted.h> 33 32 #include <wtf/RefPtr.h> 34 33 #include <wtf/Vector.h> 35 #include <wtf/WeakPtr.h>36 34 37 35 namespace WebCore { … … 51 49 void clearDocumentPointer() { m_document = nullptr; } 52 50 bool requestAnimationFrameEnabled() const; 53 WEBCORE_EXPORT Seconds interval() const;54 51 55 52 typedef int CallbackId; … … 61 58 void suspend(); 62 59 void resume(); 63 64 void addThrottlingReason(ThrottlingReason reason) { m_throttlingReasons.add(reason); } 65 void removeThrottlingReason(ThrottlingReason reason) { m_throttlingReasons.remove(reason); } 60 61 enum class ThrottlingReason { 62 VisuallyIdle = 1 << 0, 63 OutsideViewport = 1 << 1, 64 LowPowerMode = 1 << 2, 65 NonInteractedCrossOriginFrame = 1 << 3, 66 }; 67 void addThrottlingReason(ThrottlingReason); 68 void removeThrottlingReason(ThrottlingReason); 69 66 70 WEBCORE_EXPORT bool isThrottled() const; 71 WEBCORE_EXPORT Seconds interval() const; 67 72 68 73 private: 69 74 ScriptedAnimationController(Document&); 70 75 76 void scheduleAnimation(); 77 void animationTimerFired(); 78 71 79 Page* page() const; 72 Seconds preferredScriptedAnimationInterval() const;73 bool isThrottledRelativeToPage() const;74 bool shouldRescheduleRequestAnimationFrame(DOMHighResTimeStamp) const;75 void scheduleAnimation();76 80 77 using CallbackList = Vector<RefPtr<RequestAnimationFrameCallback>>;81 typedef Vector<RefPtr<RequestAnimationFrameCallback>> CallbackList; 78 82 CallbackList m_callbacks; 79 DOMHighResTimeStamp m_lastAnimationFrameTimestamp { 0 };80 83 81 84 WeakPtr<Document> m_document; … … 83 86 int m_suspendCount { 0 }; 84 87 88 Timer m_animationTimer; 89 double m_lastAnimationFrameTimestamp { 0 }; 90 91 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 85 92 OptionSet<ThrottlingReason> m_throttlingReasons; 93 bool m_isUsingTimer { false }; 94 #endif 86 95 }; 87 96 -
trunk/Source/WebCore/page/FrameView.cpp
r255131 r255150 2525 2525 if (auto* scriptedAnimationController = document->scriptedAnimationController()) { 2526 2526 if (shouldThrottle) 2527 scriptedAnimationController->addThrottlingReason( ThrottlingReason::OutsideViewport);2527 scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::OutsideViewport); 2528 2528 else 2529 scriptedAnimationController->removeThrottlingReason( ThrottlingReason::OutsideViewport);2529 scriptedAnimationController->removeThrottlingReason(ScriptedAnimationController::ThrottlingReason::OutsideViewport); 2530 2530 } 2531 2531 -
trunk/Source/WebCore/page/Page.cpp
r255131 r255150 23 23 #include "ActivityStateChangeObserver.h" 24 24 #include "AlternativeTextClient.h" 25 #include "AnimationFrameRate.h"26 25 #include "ApplicationCacheStorage.h" 27 26 #include "AuthenticatorCoordinator.h" … … 1373 1372 } 1374 1373 1375 bool Page::renderingUpdateThrottlingEnabled() const 1376 { 1377 return m_settings->renderingUpdateThrottlingEnabled(); 1378 } 1379 1380 void Page::renderingUpdateThrottlingEnabledChanged() 1381 { 1382 renderingUpdateScheduler().adjustRenderingUpdateFrequency(); 1383 } 1384 1385 bool Page::isRenderingUpdateThrottled() const 1386 { 1387 return renderingUpdateThrottlingEnabled() && !m_throttlingReasons.isEmpty(); 1388 } 1389 1390 Seconds Page::preferredRenderingUpdateInterval() const 1391 { 1392 return renderingUpdateThrottlingEnabled() ? preferredFrameInterval(m_throttlingReasons) : FullSpeedAnimationInterval; 1374 enum class ThrottlingReasonOperation { Add, Remove }; 1375 static void updateScriptedAnimationsThrottlingReason(Page& page, ThrottlingReasonOperation operation, ScriptedAnimationController::ThrottlingReason reason) 1376 { 1377 page.forEachDocument([&] (Document& document) { 1378 if (auto* controller = document.scriptedAnimationController()) { 1379 if (operation == ThrottlingReasonOperation::Add) 1380 controller->addThrottlingReason(reason); 1381 else 1382 controller->removeThrottlingReason(reason); 1383 } 1384 }); 1393 1385 } 1394 1386 1395 1387 void Page::setIsVisuallyIdleInternal(bool isVisuallyIdle) 1396 1388 { 1397 if (isVisuallyIdle == m_throttlingReasons.contains(ThrottlingReason::VisuallyIdle)) 1398 return; 1399 1400 m_throttlingReasons = m_throttlingReasons ^ ThrottlingReason::VisuallyIdle; 1401 1402 if (renderingUpdateThrottlingEnabled()) 1403 renderingUpdateScheduler().adjustRenderingUpdateFrequency(); 1389 updateScriptedAnimationsThrottlingReason(*this, isVisuallyIdle ? ThrottlingReasonOperation::Add : ThrottlingReasonOperation::Remove, ScriptedAnimationController::ThrottlingReason::VisuallyIdle); 1404 1390 } 1405 1391 1406 1392 void Page::handleLowModePowerChange(bool isLowPowerModeEnabled) 1407 1393 { 1408 if (isLowPowerModeEnabled == m_throttlingReasons.contains(ThrottlingReason::LowPowerMode)) 1409 return; 1410 1411 m_throttlingReasons = m_throttlingReasons ^ ThrottlingReason::LowPowerMode; 1412 1413 if (renderingUpdateThrottlingEnabled()) 1414 renderingUpdateScheduler().adjustRenderingUpdateFrequency(); 1415 1416 if (!RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled()) 1394 updateScriptedAnimationsThrottlingReason(*this, isLowPowerModeEnabled ? ThrottlingReasonOperation::Add : ThrottlingReasonOperation::Remove, ScriptedAnimationController::ThrottlingReason::LowPowerMode); 1395 if (RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled()) { 1396 forEachDocument([] (Document& document) { 1397 if (auto timeline = document.existingTimeline()) 1398 timeline->updateThrottlingState(); 1399 }); 1400 } else 1417 1401 mainFrame().animation().updateThrottlingState(); 1418 1419 1402 updateDOMTimerAlignmentInterval(); 1420 1403 } -
trunk/Source/WebCore/page/Page.h
r255131 r255150 22 22 23 23 #include "ActivityState.h" 24 #include "AnimationFrameRate.h"25 24 #include "DisabledAdaptations.h" 26 25 #include "Document.h" … … 699 698 WEBCORE_EXPORT void setLowPowerModeEnabledOverrideForTesting(Optional<bool>); 700 699 701 bool renderingUpdateThrottlingEnabled() const;702 void renderingUpdateThrottlingEnabledChanged();703 bool isRenderingUpdateThrottled() const;704 Seconds preferredRenderingUpdateInterval() const;705 706 700 WEBCORE_EXPORT void applicationWillResignActive(); 707 701 WEBCORE_EXPORT void applicationDidEnterBackground(); … … 999 993 bool m_hasResourceLoadClient { false }; 1000 994 Vector<UserContentURLPattern> m_corsDisablingPatterns; 1001 OptionSet<ThrottlingReason> m_throttlingReasons;1002 995 }; 1003 996 -
trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp
r255131 r255150 43 43 } 44 44 45 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && PLATFORM(IOS_FAMILY)46 void RenderingUpdateScheduler::adjustFramesPerSecond()47 {48 Seconds interval = m_page.preferredRenderingUpdateInterval();49 // CADisplayLink.preferredFramesPerSecond is an integer. So a fraction PreferredFramesPerSecond can't be set.50 if (interval < 1_s)51 DisplayRefreshMonitorManager::sharedManager().setPreferredFramesPerSecond(*this, preferredFramesPerSecond(interval));52 }53 #endif54 55 void RenderingUpdateScheduler::adjustRenderingUpdateFrequency()56 {57 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && PLATFORM(IOS_FAMILY)58 adjustFramesPerSecond();59 #endif60 if (isScheduled()) {61 clearScheduled();62 scheduleTimedRenderingUpdate();63 }64 }65 66 45 void RenderingUpdateScheduler::scheduleTimedRenderingUpdate() 67 46 { … … 77 56 tracePoint(ScheduleRenderingUpdate); 78 57 79 Seconds interval = m_page.preferredRenderingUpdateInterval(); 58 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 59 if (!DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this)) 60 #endif 61 startTimer(Seconds(1.0 / 60)); 80 62 81 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 82 // CADisplayLink.preferredFramesPerSecond is an integer. Fall back to timer if the PreferredFramesPerSecond is a fraction. 83 if (interval < 1_s) { 84 #if PLATFORM(IOS_FAMILY) 85 if (!m_isMonitorCreated) { 86 adjustFramesPerSecond(); 87 m_isMonitorCreated = true; 88 } 89 #else 90 if (interval == FullSpeedAnimationInterval) 91 #endif 92 m_scheduled = DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this); 93 } 94 #endif 95 96 if (!isScheduled()) 97 startTimer(interval); 63 m_scheduled = true; 98 64 } 99 65 … … 109 75 m_refreshTimer = makeUnique<Timer>(*this, &RenderingUpdateScheduler::displayRefreshFired); 110 76 m_refreshTimer->startOneShot(delay); 111 m_scheduled = true;112 77 } 113 78 -
trunk/Source/WebCore/page/RenderingUpdateScheduler.h
r255131 r255150 47 47 48 48 RenderingUpdateScheduler(Page&); 49 50 void adjustRenderingUpdateFrequency();51 49 void scheduleTimedRenderingUpdate(); 52 50 void scheduleImmediateRenderingUpdate(); … … 59 57 private: 60 58 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 61 #if PLATFORM(IOS_FAMILY)62 void adjustFramesPerSecond();63 #endif64 59 RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const final; 65 60 void displayRefreshFired() final; … … 73 68 74 69 Page& m_page; 75 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && PLATFORM(IOS_FAMILY)76 bool m_isMonitorCreated;77 #endif78 70 bool m_scheduled { false }; 79 71 std::unique_ptr<Timer> m_refreshTimer; -
trunk/Source/WebCore/page/Settings.yaml
r255131 r255150 766 766 onChange: hiddenPageCSSAnimationSuspensionEnabledChanged 767 767 768 renderingUpdateThrottlingEnabled:769 initial: true770 onChange: renderingUpdateThrottlingEnabledChanged771 772 768 storageBlockingPolicy: 773 769 type: SecurityOrigin::StorageBlockingPolicy -
trunk/Source/WebCore/page/SettingsBase.cpp
r255131 r255150 408 408 } 409 409 410 void SettingsBase::renderingUpdateThrottlingEnabledChanged()411 {412 if (m_page)413 m_page->renderingUpdateThrottlingEnabledChanged();414 }415 416 410 void SettingsBase::resourceUsageOverlayVisibleChanged() 417 411 { -
trunk/Source/WebCore/page/SettingsBase.h
r255131 r255150 195 195 void hiddenPageDOMTimerThrottlingStateChanged(); 196 196 void hiddenPageCSSAnimationSuspensionEnabledChanged(); 197 void renderingUpdateThrottlingEnabledChanged();198 197 void resourceUsageOverlayVisibleChanged(); 199 198 void iceCandidateFilteringEnabledChanged(); -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h
r255131 r255150 28 28 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 29 29 30 #include "AnimationFrameRate.h"31 30 #include "PlatformScreen.h" 32 31 #include <wtf/HashSet.h> … … 46 45 47 46 virtual void displayLinkFired() { } 48 49 virtual void setPreferredFramesPerSecond(FramesPerSecond) { }50 47 51 48 // Return true if callback request was scheduled, false if it couldn't be -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp
r255131 r255150 43 43 } 44 44 45 DisplayRefreshMonitor* DisplayRefreshMonitorManager:: monitorForClient(DisplayRefreshMonitorClient& client)45 DisplayRefreshMonitor* DisplayRefreshMonitorManager::createMonitorForClient(DisplayRefreshMonitorClient& client) 46 46 { 47 if (!client.hasDisplayID())48 return nullptr;49 50 47 PlatformDisplayID clientDisplayID = client.displayID(); 51 48 if (auto* existingMonitor = monitorForDisplayID(clientDisplayID)) { … … 58 55 return nullptr; 59 56 60 LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager:: monitorForClient() - created monitor %p", monitor.get());57 LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::createMonitorForClient() - created monitor %p", monitor.get()); 61 58 monitor->addClient(client); 62 59 DisplayRefreshMonitor* result = monitor.get(); 63 60 m_monitors.append({ WTFMove(monitor) }); 64 61 return result; 62 } 63 64 void DisplayRefreshMonitorManager::registerClient(DisplayRefreshMonitorClient& client) 65 { 66 if (!client.hasDisplayID()) 67 return; 68 69 createMonitorForClient(client); 65 70 } 66 71 … … 81 86 } 82 87 83 void DisplayRefreshMonitorManager::setPreferredFramesPerSecond(DisplayRefreshMonitorClient& client, FramesPerSecond preferredFramesPerSecond)84 {85 if (auto* monitor = monitorForClient(client))86 monitor->setPreferredFramesPerSecond(preferredFramesPerSecond);87 }88 89 88 bool DisplayRefreshMonitorManager::scheduleAnimation(DisplayRefreshMonitorClient& client) 90 89 { 91 if (auto* monitor = monitorForClient(client)) { 92 client.setIsScheduled(true); 93 return monitor->requestRefreshCallback(); 94 } 95 return false; 90 if (!client.hasDisplayID()) 91 return false; 92 93 DisplayRefreshMonitor* monitor = createMonitorForClient(client); 94 if (!monitor) 95 return false; 96 97 client.setIsScheduled(true); 98 return monitor->requestRefreshCallback(); 96 99 } 97 100 … … 114 117 unregisterClient(client); 115 118 client.setDisplayID(displayID); 119 registerClient(client); 116 120 if (client.isScheduled()) 117 121 scheduleAnimation(client); -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h
r255131 r255150 28 28 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 29 29 30 #include "AnimationFrameRate.h"31 30 #include "DisplayRefreshMonitor.h" 32 31 #include "PlatformScreen.h" … … 39 38 class DisplayRefreshMonitorManager { 40 39 friend class NeverDestroyed<DisplayRefreshMonitorManager>; 41 friend class DisplayRefreshMonitor;42 40 public: 43 41 WEBCORE_EXPORT static DisplayRefreshMonitorManager& sharedManager(); 44 42 43 void registerClient(DisplayRefreshMonitorClient&); 45 44 void unregisterClient(DisplayRefreshMonitorClient&); 46 45 47 void setPreferredFramesPerSecond(DisplayRefreshMonitorClient&, FramesPerSecond);48 46 bool scheduleAnimation(DisplayRefreshMonitorClient&); 49 47 void windowScreenDidChange(PlatformDisplayID, DisplayRefreshMonitorClient&); 50 48 51 49 WEBCORE_EXPORT void displayWasUpdated(PlatformDisplayID); 52 50 53 51 private: 54 DisplayRefreshMonitorManager() = default; 52 friend class DisplayRefreshMonitor; 53 void displayDidRefresh(DisplayRefreshMonitor&); 54 55 DisplayRefreshMonitorManager() { } 55 56 virtual ~DisplayRefreshMonitorManager(); 56 57 void displayDidRefresh(DisplayRefreshMonitor&);58 57 59 58 size_t findMonitorForDisplayID(PlatformDisplayID) const; 60 59 DisplayRefreshMonitor* monitorForDisplayID(PlatformDisplayID) const; 61 DisplayRefreshMonitor* monitorForClient(DisplayRefreshMonitorClient&); 60 61 DisplayRefreshMonitor* createMonitorForClient(DisplayRefreshMonitorClient&); 62 62 63 63 struct DisplayRefreshMonitorWrapper { -
trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp
r255131 r255150 36 36 : m_client(client) 37 37 { 38 DisplayRefreshMonitorManager::sharedManager().registerClient(*this); 38 39 DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, *this); 39 40 DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this); -
trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm
r255131 r255150 41 41 42 42 - (id)initWithMonitor:(DisplayRefreshMonitorIOS*)monitor; 43 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond;44 43 - (void)handleDisplayLink:(CADisplayLink *)sender; 45 44 - (void)invalidate; … … 65 64 ASSERT(!m_displayLink); // -invalidate should have been called already. 66 65 [super dealloc]; 67 }68 69 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond70 {71 m_displayLink.preferredFramesPerSecond = preferredFramesPerSecond;72 66 } 73 67 -
trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm
r255131 r255150 49 49 50 50 _notifier = ¬ifier; 51 _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled; 51 52 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didReceiveLowPowerModeChange) name:NSProcessInfoPowerStateDidChangeNotification object:nil]; 52 // Set the initial state of the low power mode.53 [self _didReceiveLowPowerModeChange];54 53 return self; 55 54 } -
trunk/Source/WebKit/ChangeLog
r255147 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-27 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r255131 r255150 488 488 type: bool 489 489 defaultValue: DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED 490 491 RenderingUpdateThrottlingEnabled:492 type: bool493 defaultValue: true494 490 495 491 LowPowerVideoAudioBufferSizeEnabled: -
trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
r255131 r255150 1310 1310 } 1311 1311 1312 void WKPreferencesSetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled)1313 {1314 toImpl(preferencesRef)->setRenderingUpdateThrottlingEnabled(enabled);1315 }1316 1317 bool WKPreferencesGetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferencesRef)1318 {1319 return toImpl(preferencesRef)->renderingUpdateThrottlingEnabled();1320 }1321 1322 1312 void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout) 1323 1313 { -
trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
r255131 r255150 303 303 WK_EXPORT bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences); 304 304 305 // Defaults to true.306 WK_EXPORT void WKPreferencesSetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferences, bool enabled);307 WK_EXPORT bool WKPreferencesGetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferences);308 309 305 // Defaults to false 310 306 WK_EXPORT void WKPreferencesSetSnapshotAllPlugIns(WKPreferencesRef preferencesRef, bool enabled); -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
r255131 r255150 29 29 #include "RemoteLayerTreeHost.h" 30 30 #include "TransactionID.h" 31 #include <WebCore/AnimationFrameRate.h>32 31 #include <WebCore/FloatPoint.h> 33 32 #include <WebCore/IntPoint.h> … … 99 98 100 99 // Message handlers 101 void setPreferredFramesPerSecond(WebCore::FramesPerSecond);102 100 void willCommitLayerTree(TransactionID); 103 101 void commitLayerTree(const RemoteLayerTreeTransaction&, const RemoteScrollingCoordinatorTransaction&); -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in
r255131 r255150 22 22 23 23 messages -> RemoteLayerTreeDrawingAreaProxy : DrawingAreaProxy NotRefCounted { 24 void SetPreferredFramesPerSecond(unsigned preferredFramesPerSecond)25 24 void WillCommitLayerTree(WebKit::TransactionID transactionID) 26 25 void CommitLayerTree(WebKit::RemoteLayerTreeTransaction layerTreeTransaction, WebKit::RemoteScrollingCoordinatorTransaction scrollingTreeTransaction) -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
r255131 r255150 50 50 51 51 - (id)initWithDrawingAreaProxy:(WebKit::RemoteLayerTreeDrawingAreaProxy*)drawingAreaProxy; 52 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond;53 52 - (void)displayLinkFired:(CADisplayLink *)sender; 54 53 - (void)invalidate; … … 78 77 } 79 78 80 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond81 {82 _displayLink.preferredFramesPerSecond = preferredFramesPerSecond;83 }84 85 79 - (void)displayLinkFired:(CADisplayLink *)sender 86 80 { … … 188 182 send(Messages::DrawingArea::UpdateGeometry(m_size, false /* flushSynchronously */, MachSendRight())); 189 183 m_isWaitingForDidUpdateGeometry = true; 190 }191 192 void RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)193 {194 #if PLATFORM(IOS_FAMILY)195 [displayLinkHandler() setPreferredFramesPerSecond:preferredFramesPerSecond];196 #else197 UNUSED_PARAM(preferredFramesPerSecond);198 #endif199 184 } 200 185 -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h
r255131 r255150 29 29 30 30 #include "RemoteLayerTreeDrawingArea.h" 31 #include <WebCore/AnimationFrameRate.h>32 31 #include <WebCore/DisplayRefreshMonitor.h> 33 32 … … 43 42 virtual ~RemoteLayerTreeDisplayRefreshMonitor(); 44 43 45 void setPreferredFramesPerSecond(WebCore::FramesPerSecond) override;46 44 bool requestRefreshCallback() override; 47 45 -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm
r255131 r255150 44 44 } 45 45 46 void RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)47 {48 if (m_drawingArea)49 m_drawingArea->setPreferredFramesPerSecond(preferredFramesPerSecond);50 }51 52 46 bool RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback() 53 47 { -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
r255131 r255150 30 30 #include "GraphicsLayerCARemote.h" 31 31 #include "RemoteLayerTreeTransaction.h" 32 #include <WebCore/AnimationFrameRate.h>33 32 #include <WebCore/GraphicsLayerClient.h> 34 33 #include <WebCore/Timer.h> … … 75 74 RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override; 76 75 void willDestroyDisplayRefreshMonitor(WebCore::DisplayRefreshMonitor*); 77 void setPreferredFramesPerSecond(WebCore::FramesPerSecond);78 76 79 77 bool shouldUseTiledBackingForFrameView(const WebCore::FrameView&) const override; -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
r255131 r255150 124 124 } 125 125 126 void RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)127 {128 send(Messages::RemoteLayerTreeDrawingAreaProxy::SetPreferredFramesPerSecond(preferredFramesPerSecond));129 }130 131 126 void RemoteLayerTreeDrawingArea::updateRootLayers() 132 127 { -
trunk/Source/WebKitLegacy/mac/ChangeLog
r255142 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-27 Cathie Chen <cathiechen@igalia.com> 2 15 -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
r255142 r255150 165 165 #define WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey @"WebKitHiddenPageDOMTimerThrottlingEnabled" 166 166 #define WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey @"WebKitHiddenPageCSSAnimationSuspensionEnabled" 167 #define WebKitRenderingUpdateThrottlingEnabledPreferenceKey @"WebKitRenderingUpdateThrottlingEnabled"168 167 #define WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey @"WebKitLowPowerVideoAudioBufferSizeEnabled" 169 168 #define WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey @"WebKitUseLegacyTextAlignPositionedElementBehavior" -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
r255131 r255150 594 594 @NO, WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey, 595 595 @NO, WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey, 596 @YES, WebKitRenderingUpdateThrottlingEnabledPreferenceKey,597 596 @NO, WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey, 598 597 … … 2787 2786 } 2788 2787 2789 - (BOOL)renderingUpdateThrottlingEnabled2790 {2791 return [self _boolValueForKey:WebKitRenderingUpdateThrottlingEnabledPreferenceKey];2792 }2793 2794 - (void)setRenderingUpdateThrottlingEnabled:(BOOL)enabled2795 {2796 [self _setBoolValue:enabled forKey:WebKitRenderingUpdateThrottlingEnabledPreferenceKey];2797 }2798 2799 2788 - (BOOL)lowPowerVideoAudioBufferSizeEnabled 2800 2789 { -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
r255131 r255150 489 489 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled; 490 490 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag; 491 492 - (BOOL)renderingUpdateThrottlingEnabled;493 - (void)setRenderingUpdateThrottlingEnabled:(BOOL)flag;494 491 495 492 - (BOOL)lowPowerVideoAudioBufferSizeEnabled; -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r255131 r255150 3134 3134 3135 3135 settings.setHiddenPageDOMTimerThrottlingEnabled([preferences hiddenPageDOMTimerThrottlingEnabled]); 3136 3136 3137 settings.setHiddenPageCSSAnimationSuspensionEnabled([preferences hiddenPageCSSAnimationSuspensionEnabled]); 3137 settings.setRenderingUpdateThrottlingEnabled([preferences renderingUpdateThrottlingEnabled]);3138 3138 3139 3139 WebCore::DeprecatedGlobalSettings::setResourceLoadStatisticsEnabled([preferences resourceLoadStatisticsEnabled]); -
trunk/Source/WebKitLegacy/win/ChangeLog
r255131 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-26 Said Abou-Hallawa <said@apple.com> 2 15 -
trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
r255131 r255150 257 257 HRESULT setWebSQLEnabled([in] BOOL enabled); 258 258 HRESULT webSQLEnabled([out, retval] BOOL* enabled); 259 HRESULT setRenderingUpdateThrottlingEnabled([in] BOOL enabled); 260 HRESULT renderingUpdateThrottlingEnabled([out, retval] BOOL* enabled); 261 } 259 } -
trunk/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
r255131 r255150 225 225 226 226 #define WebKitWebSQLEnabledPreferenceKey "WebKitWebSQLEnabled" 227 228 #define WebKitRenderingUpdateThrottlingEnabledPreferenceKey "WebKitRenderingUpdateThrottlingEnabled" -
trunk/Source/WebKitLegacy/win/WebPreferences.cpp
r255131 r255150 352 352 CFDictionaryAddValue(defaults, CFSTR(WebKitWebSQLEnabledPreferenceKey), kCFBooleanFalse); 353 353 354 CFDictionaryAddValue(defaults, CFSTR(WebKitRenderingUpdateThrottlingEnabledPreferenceKey), kCFBooleanTrue);355 356 354 defaultSettings = defaults; 357 355 #endif … … 2453 2451 return S_OK; 2454 2452 } 2455 2456 HRESULT WebPreferences::renderingUpdateThrottlingEnabled(_Out_ BOOL* enabled)2457 {2458 if (!enabled)2459 return E_POINTER;2460 *enabled = boolValueForKey(WebKitRenderingUpdateThrottlingEnabledPreferenceKey);2461 return S_OK;2462 }2463 2464 HRESULT WebPreferences::setRenderingUpdateThrottlingEnabled(BOOL enabled)2465 {2466 setBoolValue(WebKitRenderingUpdateThrottlingEnabledPreferenceKey, enabled);2467 return S_OK;2468 }2469 -
trunk/Source/WebKitLegacy/win/WebPreferences.h
r255131 r255150 302 302 virtual HRESULT STDMETHODCALLTYPE webSQLEnabled(_Out_ BOOL*); 303 303 virtual HRESULT STDMETHODCALLTYPE setWebSQLEnabled(BOOL); 304 virtual HRESULT STDMETHODCALLTYPE renderingUpdateThrottlingEnabled(_Out_ BOOL*);305 virtual HRESULT STDMETHODCALLTYPE setRenderingUpdateThrottlingEnabled(BOOL);306 304 307 305 // WebPreferences -
trunk/Source/WebKitLegacy/win/WebView.cpp
r255131 r255150 5605 5605 settings.setRequestAnimationFrameEnabled(enabled); 5606 5606 5607 hr = prefsPrivate->renderingUpdateThrottlingEnabled(&enabled);5608 if (FAILED(hr))5609 return hr;5610 settings.setRenderingUpdateThrottlingEnabled(enabled);5611 5612 5607 hr = prefsPrivate->mockScrollbarsEnabled(&enabled); 5613 5608 if (FAILED(hr)) -
trunk/Tools/ChangeLog
r255148 r255150 1 2020-01-27 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r255131. 4 5 Caused assertion failures on iOS debug bots. 6 7 Reverted changeset: 8 9 "Throttling requestAnimationFrame should be controlled by 10 RenderingUpdateScheduler" 11 https://bugs.webkit.org/show_bug.cgi?id=204713 12 https://trac.webkit.org/changeset/255131 13 1 14 2020-01-27 Jonathan Bedard <jbedard@apple.com> 2 15 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r255131 r255150 995 995 [preferences setHiddenPageDOMTimerThrottlingEnabled:NO]; 996 996 [preferences setHiddenPageCSSAnimationSuspensionEnabled:NO]; 997 [preferences setRenderingUpdateThrottlingEnabled:NO];998 997 [preferences setRemotePlaybackEnabled:YES]; 999 998 -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r255131 r255150 801 801 prefsPrivate->setServerTimingEnabled(TRUE); 802 802 prefsPrivate->setAspectRatioOfImgFromWidthAndHeightEnabled(TRUE); 803 prefsPrivate->setRenderingUpdateThrottlingEnabled(FALSE);804 803 // FIXME: WebGL2 805 804 // FIXME: WebRTC -
trunk/Tools/WebKitTestRunner/TestController.cpp
r255131 r255150 908 908 WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(preferences, false); 909 909 WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(preferences, false); 910 WKPreferencesSetRenderingUpdateThrottlingEnabled(preferences, false);911 910 912 911 WKPreferencesSetAcceleratedDrawingEnabled(preferences, m_shouldUseAcceleratedDrawing || options.useAcceleratedDrawing);
Note: See TracChangeset
for help on using the changeset viewer.