Changeset 255150 in webkit


Ignore:
Timestamp:
Jan 27, 2020 9:26:07 AM (4 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r255131.

Caused assertion failures on iOS debug bots.

Reverted changeset:

"Throttling requestAnimationFrame should be controlled by
RenderingUpdateScheduler"
https://bugs.webkit.org/show_bug.cgi?id=204713
https://trac.webkit.org/changeset/255131

Location:
trunk
Files:
4 deleted
55 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r255140 r255150  
     12020-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
    1142020-01-27  Antti Koivisto  <antti@apple.com>
    215
  • trunk/LayoutTests/fast/animation/css-animation-throttling-lowPowerMode.html

    r255131 r255150  
    2626jsTestIsAsync = true;
    2727
    28 if (window.internals)
    29   internals.settings.setRenderingUpdateThrottlingEnabled(true);
    30 
    3128const element = document.getElementById("testElement");
    3229element.onanimationstart = function() {
  • trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe.html

    r255131 r255150  
    66description("Tests that requestAnimationFrame is throttled in subframes that are outside the viewport");
    77window.jsTestIsAsync = true;
    8 
    9 if (window.internals)
    10     internals.settings.setRenderingUpdateThrottlingEnabled(true);
    118
    129function checkSubframesThrottled()
  • trunk/LayoutTests/fast/animation/request-animation-frame-throttling-detached-iframe.html

    r255131 r255150  
    66description("Test that requestAnimationFrame gets the right throttling in an iframe when inserted into a document.");
    77jsTestIsAsync = true;
    8 
    9 if (window.internals)
    10     internals.settings.setRenderingUpdateThrottlingEnabled(true);
    118
    129let i = 0;
  • trunk/LayoutTests/fast/animation/request-animation-frame-throttling-lowPowerMode-expected.txt

    r255131 r255150  
    44
    55
    6 PASS farmesPerSecond < 35 is true
     6PASS internals.isRequestAnimationFrameThrottled() is false
     7PASS internals.requestAnimationFrameInterval is Infinity
     8rAFHandle = requestAnimationFrame(doWork);
     9PASS internals.isRequestAnimationFrameThrottled() is false
     10PASS internals.requestAnimationFrameInterval is 0.015
     11internals.setLowPowerModeEnabled(true);
     12PASS internals.isRequestAnimationFrameThrottled() is true
     13PASS internals.requestAnimationFrameInterval is 0.030
     14cancelAnimationFrame(rAFHandle);
     15PASS internals.isRequestAnimationFrameThrottled() is true
     16PASS internals.requestAnimationFrameInterval is 0.030
     17rAFHandle = requestAnimationFrame(doWork);
     18PASS internals.isRequestAnimationFrameThrottled() is true
     19PASS internals.requestAnimationFrameInterval is 0.030
     20internals.setLowPowerModeEnabled(false);
     21PASS internals.isRequestAnimationFrameThrottled() is false
     22PASS internals.requestAnimationFrameInterval is 0.015
    723PASS successfullyParsed is true
    824
  • trunk/LayoutTests/fast/animation/request-animation-frame-throttling-lowPowerMode.html

    r255131 r255150  
    22<html>
    33<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>
     6description("Test that requestAnimationFrame gets throttled in low power mode.");
    87
    9         if (window.internals) {
    10             internals.settings.setRenderingUpdateThrottlingEnabled(true);
    11             internals.setLowPowerModeEnabled(true);
    12         }
     8let rAFHandle;
     9let i = 0;
     10function doWork()
     11{
     12    i++;
     13    rAFHandle = requestAnimationFrame(doWork);
     14}
    1315
    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>
     16shouldBeFalse("internals.isRequestAnimationFrameThrottled()");
     17shouldBe("internals.requestAnimationFrameInterval", "Infinity");
     18evalAndLog("rAFHandle = requestAnimationFrame(doWork);");
     19shouldBeFalse("internals.isRequestAnimationFrameThrottled()");
     20shouldBe("internals.requestAnimationFrameInterval", "0.015");
     21evalAndLog("internals.setLowPowerModeEnabled(true);");
     22shouldBeTrue("internals.isRequestAnimationFrameThrottled()");
     23shouldBe("internals.requestAnimationFrameInterval", "0.030");
     24evalAndLog("cancelAnimationFrame(rAFHandle);");
     25shouldBeTrue("internals.isRequestAnimationFrameThrottled()");
     26shouldBe("internals.requestAnimationFrameInterval", "0.030");
     27evalAndLog("rAFHandle = requestAnimationFrame(doWork);");
     28shouldBeTrue("internals.isRequestAnimationFrameThrottled()");
     29shouldBe("internals.requestAnimationFrameInterval", "0.030");
     30evalAndLog("internals.setLowPowerModeEnabled(false);");
     31shouldBeFalse("internals.isRequestAnimationFrameThrottled()");
     32shouldBe("internals.requestAnimationFrameInterval", "0.015");
     33</script>
     34<script src="../../resources/js-test-post.js"></script>
    3235</body>
    3336</html>
  • trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html

    r255131 r255150  
    1414    description("Tests that requestAnimationFrame is throttled in subframes that are cross-origin, and not in same-origin frames");
    1515    window.jsTestIsAsync = true;
    16 
    17     if (window.internals)
    18         internals.settings.setRenderingUpdateThrottlingEnabled(true);
    19 
     16   
    2017    var crossOriginFrame;
    2118    var sameOriginFrame
  • trunk/Source/WebCore/ChangeLog

    r255149 r255150  
     12020-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
    1142020-01-27  Antoine Quint  <graouts@apple.com>
    215
  • trunk/Source/WebCore/Headers.cmake

    r255149 r255150  
    10361036    platform/graphics/AlphaPremultiplication.h
    10371037    platform/graphics/ANGLEWebKitBridge.h
    1038     platform/graphics/AnimationFrameRate.h
    10391038    platform/graphics/AudioTrackPrivate.h
    10401039    platform/graphics/BitmapImage.h
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r255149 r255150  
    21452145                72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */; settings = {ATTRIBUTES = (Private, ); }; };
    21462146                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, ); }; };
    21482147                724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; };
    21492148                724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54E1DC7F25B00A91FFB /* ActivityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    96419640                721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; };
    96429641                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>"; };
    96449642                724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; };
    96459643                724ED32A1A3A7E5400F5F13C /* EXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTBlendMinMax.h; sourceTree = "<group>"; };
     
    2505625054                                490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */,
    2505725055                                490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */,
    25058                                 722A815C238FD50500C00583 /* AnimationFrameRate.h */,
    2505925056                                BEF29EE91715DD0900C4B4C9 /* AudioTrackPrivate.h */,
    2506025057                                A89943270B42338700D7C802 /* BitmapImage.cpp */,
     
    2910329100                                71E2C42621C935280024F8C8 /* AnimationEffectPhase.h in Headers */,
    2910429101                                319848011A1D817B00A13318 /* AnimationEvent.h in Headers */,
    29105                                 722A815D238FDAF000C00583 /* AnimationFrameRate.h in Headers */,
    2910629102                                49E912AD0EFAC906009D0CAF /* AnimationList.h in Headers */,
    2910729103                                714C7C661FDAD2A100F2BEE1 /* AnimationPlaybackEvent.h in Headers */,
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r255141 r255150  
    4545#include <JavaScriptCore/VM.h>
    4646
     47static const Seconds defaultAnimationInterval { 15_ms };
     48static const Seconds throttledAnimationInterval { 30_ms };
     49
    4750namespace WebCore {
    4851
     
    196199}
    197200
     201void DocumentTimeline::updateThrottlingState()
     202{
     203    scheduleAnimationResolution();
     204}
     205
    198206Seconds DocumentTimeline::animationInterval() const
    199207{
    200208    if (!m_document || !m_document->page())
    201209        return Seconds::infinity();
    202     return m_document->page()->preferredRenderingUpdateInterval();
     210    return m_document->page()->isLowPowerModeEnabled() ? throttledAnimationInterval : defaultAnimationInterval;
    203211}
    204212
  • trunk/Source/WebCore/animation/DocumentTimeline.h

    r255141 r255150  
    7575    void updateAnimationsAndSendEvents(DOMHighResTimeStamp timestamp);
    7676
     77    void updateThrottlingState();
    7778    WEBCORE_EXPORT Seconds animationInterval() const;
    7879    WEBCORE_EXPORT void suspendAnimations();
  • trunk/Source/WebCore/dom/Document.cpp

    r255141 r255150  
    65056505            m_scriptedAnimationController->suspend();
    65066506
     6507        if (page() && page()->isLowPowerModeEnabled())
     6508            m_scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::LowPowerMode);
     6509
    65076510        if (!topOrigin().canAccess(securityOrigin()) && !hasHadUserInteraction())
    6508             m_scriptedAnimationController->addThrottlingReason(ThrottlingReason::NonInteractedCrossOriginFrame);
     6511            m_scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame);
    65096512    }
    65106513
     
    67456748    if (static_cast<bool>(time) && m_scriptedAnimationController) {
    67466749        // 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);
    67486751    }
    67496752
  • trunk/Source/WebCore/dom/ScriptedAnimationController.cpp

    r255131 r255150  
    11/*
    22 * Copyright (C) 2011 Google Inc. All Rights Reserved.
    3  * Copyright (C) 2019 Apple Inc.  All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    2827#include "ScriptedAnimationController.h"
    2928
     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"
    3037#include "InspectorInstrumentation.h"
     38#include "Logging.h"
    3139#include "Page.h"
    3240#include "RequestAnimationFrameCallback.h"
    3341#include "Settings.h"
     42#include <algorithm>
     43#include <wtf/Ref.h>
    3444#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.
     48static const Seconds fullSpeedAnimationInterval { 15_ms };
     49// Allow a little more than 30fps to make sure we can at least hit that frame rate.
     50static const Seconds halfSpeedThrottlingAnimationInterval { 30_ms };
     51static 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__)
    3554
    3655namespace WebCore {
     
    3857ScriptedAnimationController::ScriptedAnimationController(Document& document)
    3958    : m_document(makeWeakPtr(document))
     59    , m_animationTimer(*this, &ScriptedAnimationController::animationTimerFired)
    4060{
    4161}
     
    4666{
    4767    return m_document && m_document->settings().requestAnimationFrameEnabled();
    48 }
    49 
    50 Page* ScriptedAnimationController::page() const
    51 {
    52     return m_document ? m_document->page() : nullptr;
    53 }
    54 
    55 Seconds ScriptedAnimationController::preferredScriptedAnimationInterval() const
    56 {
    57     if (auto* page = this->page())
    58         return page->renderingUpdateThrottlingEnabled() ? preferredFrameInterval(m_throttlingReasons) : FullSpeedAnimationInterval;
    59     return FullSpeedAnimationInterval;
    60 }
    61 
    62 Seconds ScriptedAnimationController::interval() const
    63 {
    64     if (auto* page = this->page())
    65         return std::max(preferredScriptedAnimationInterval(), page->preferredRenderingUpdateInterval());
    66     return FullSpeedAnimationInterval;
    6768}
    6869
     
    8384}
    8485
     86#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !RELEASE_LOG_DISABLED
     87
     88static 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
     102static 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
     118void 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
     137void 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
    85156bool ScriptedAnimationController::isThrottled() const
    86157{
    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
    89161    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
    102163}
    103164
    104165ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(Ref<RequestAnimationFrameCallback>&& callback)
    105166{
    106     CallbackId callbackId = ++m_nextCallbackId;
     167    ScriptedAnimationController::CallbackId id = ++m_nextCallbackId;
    107168    callback->m_firedOrCancelled = false;
    108     callback->m_id = callbackId;
     169    callback->m_id = id;
    109170    m_callbacks.append(WTFMove(callback));
    110171
    111172    if (m_document)
    112         InspectorInstrumentation::didRequestAnimationFrame(*m_document, callbackId);
     173        InspectorInstrumentation::didRequestAnimationFrame(*m_document, id);
    113174
    114175    if (!m_suspendCount)
    115176        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
     180void 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    }
    130190}
    131191
     
    135195        return;
    136196
    137     if (shouldRescheduleRequestAnimationFrame(timestamp)) {
    138         scheduleAnimation();
    139         return;
    140     }
    141    
    142197    TraceScope tracingScope(RAFCallbackStart, RAFCallbackEnd);
    143198
     
    169224    });
    170225
    171     m_lastAnimationFrameTimestamp = timestamp;
    172 
    173226    if (m_callbacks.size())
    174227        scheduleAnimation();
    175228}
    176229
     230Seconds 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
     247Page* ScriptedAnimationController::page() const
     248{
     249    return m_document ? m_document->page() : nullptr;
     250}
     251
    177252void ScriptedAnimationController::scheduleAnimation()
    178253{
     
    180255        return;
    181256
    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
     288void 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  
    11/*
    22 * Copyright (C) 2011 Google Inc. All Rights Reserved.
    3  * Copyright (C) 2019 Apple Inc.  All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    2726#pragma once
    2827
    29 #include "AnimationFrameRate.h"
    3028#include "DOMHighResTimeStamp.h"
     29#include "Timer.h"
    3130#include <wtf/OptionSet.h>
    3231#include <wtf/RefCounted.h>
    3332#include <wtf/RefPtr.h>
    3433#include <wtf/Vector.h>
    35 #include <wtf/WeakPtr.h>
    3634
    3735namespace WebCore {
     
    5149    void clearDocumentPointer() { m_document = nullptr; }
    5250    bool requestAnimationFrameEnabled() const;
    53     WEBCORE_EXPORT Seconds interval() const;
    5451
    5552    typedef int CallbackId;
     
    6158    void suspend();
    6259    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
    6670    WEBCORE_EXPORT bool isThrottled() const;
     71    WEBCORE_EXPORT Seconds interval() const;
    6772
    6873private:
    6974    ScriptedAnimationController(Document&);
    7075
     76    void scheduleAnimation();
     77    void animationTimerFired();
     78
    7179    Page* page() const;
    72     Seconds preferredScriptedAnimationInterval() const;
    73     bool isThrottledRelativeToPage() const;
    74     bool shouldRescheduleRequestAnimationFrame(DOMHighResTimeStamp) const;
    75     void scheduleAnimation();
    7680
    77     using CallbackList = Vector<RefPtr<RequestAnimationFrameCallback>>;
     81    typedef Vector<RefPtr<RequestAnimationFrameCallback>> CallbackList;
    7882    CallbackList m_callbacks;
    79     DOMHighResTimeStamp m_lastAnimationFrameTimestamp { 0 };
    8083
    8184    WeakPtr<Document> m_document;
     
    8386    int m_suspendCount { 0 };
    8487
     88    Timer m_animationTimer;
     89    double m_lastAnimationFrameTimestamp { 0 };
     90
     91#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    8592    OptionSet<ThrottlingReason> m_throttlingReasons;
     93    bool m_isUsingTimer { false };
     94#endif
    8695};
    8796
  • trunk/Source/WebCore/page/FrameView.cpp

    r255131 r255150  
    25252525    if (auto* scriptedAnimationController = document->scriptedAnimationController()) {
    25262526        if (shouldThrottle)
    2527             scriptedAnimationController->addThrottlingReason(ThrottlingReason::OutsideViewport);
     2527            scriptedAnimationController->addThrottlingReason(ScriptedAnimationController::ThrottlingReason::OutsideViewport);
    25282528        else
    2529             scriptedAnimationController->removeThrottlingReason(ThrottlingReason::OutsideViewport);
     2529            scriptedAnimationController->removeThrottlingReason(ScriptedAnimationController::ThrottlingReason::OutsideViewport);
    25302530    }
    25312531
  • trunk/Source/WebCore/page/Page.cpp

    r255131 r255150  
    2323#include "ActivityStateChangeObserver.h"
    2424#include "AlternativeTextClient.h"
    25 #include "AnimationFrameRate.h"
    2625#include "ApplicationCacheStorage.h"
    2726#include "AuthenticatorCoordinator.h"
     
    13731372}
    13741373
    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;
     1374enum class ThrottlingReasonOperation { Add, Remove };
     1375static 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    });
    13931385}
    13941386
    13951387void Page::setIsVisuallyIdleInternal(bool isVisuallyIdle)
    13961388{
    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);
    14041390}
    14051391
    14061392void Page::handleLowModePowerChange(bool isLowPowerModeEnabled)
    14071393{
    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
    14171401        mainFrame().animation().updateThrottlingState();
    1418 
    14191402    updateDOMTimerAlignmentInterval();
    14201403}
  • trunk/Source/WebCore/page/Page.h

    r255131 r255150  
    2222
    2323#include "ActivityState.h"
    24 #include "AnimationFrameRate.h"
    2524#include "DisabledAdaptations.h"
    2625#include "Document.h"
     
    699698    WEBCORE_EXPORT void setLowPowerModeEnabledOverrideForTesting(Optional<bool>);
    700699
    701     bool renderingUpdateThrottlingEnabled() const;
    702     void renderingUpdateThrottlingEnabledChanged();
    703     bool isRenderingUpdateThrottled() const;
    704     Seconds preferredRenderingUpdateInterval() const;
    705 
    706700    WEBCORE_EXPORT void applicationWillResignActive();
    707701    WEBCORE_EXPORT void applicationDidEnterBackground();
     
    999993    bool m_hasResourceLoadClient { false };
    1000994    Vector<UserContentURLPattern> m_corsDisablingPatterns;
    1001     OptionSet<ThrottlingReason> m_throttlingReasons;
    1002995};
    1003996
  • trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp

    r255131 r255150  
    4343}
    4444
    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 #endif
    54 
    55 void RenderingUpdateScheduler::adjustRenderingUpdateFrequency()
    56 {
    57 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && PLATFORM(IOS_FAMILY)
    58     adjustFramesPerSecond();
    59 #endif
    60     if (isScheduled()) {
    61         clearScheduled();
    62         scheduleTimedRenderingUpdate();
    63     }
    64 }
    65 
    6645void RenderingUpdateScheduler::scheduleTimedRenderingUpdate()
    6746{
     
    7756    tracePoint(ScheduleRenderingUpdate);
    7857
    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));
    8062
    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;
    9864}
    9965
     
    10975    m_refreshTimer = makeUnique<Timer>(*this, &RenderingUpdateScheduler::displayRefreshFired);
    11076    m_refreshTimer->startOneShot(delay);
    111     m_scheduled = true;
    11277}
    11378
  • trunk/Source/WebCore/page/RenderingUpdateScheduler.h

    r255131 r255150  
    4747
    4848    RenderingUpdateScheduler(Page&);
    49    
    50     void adjustRenderingUpdateFrequency();
    5149    void scheduleTimedRenderingUpdate();
    5250    void scheduleImmediateRenderingUpdate();
     
    5957private:
    6058#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    61 #if PLATFORM(IOS_FAMILY)
    62     void adjustFramesPerSecond();
    63 #endif
    6459    RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const final;
    6560    void displayRefreshFired() final;
     
    7368
    7469    Page& m_page;
    75 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && PLATFORM(IOS_FAMILY)
    76     bool m_isMonitorCreated;
    77 #endif
    7870    bool m_scheduled { false };
    7971    std::unique_ptr<Timer> m_refreshTimer;
  • trunk/Source/WebCore/page/Settings.yaml

    r255131 r255150  
    766766  onChange: hiddenPageCSSAnimationSuspensionEnabledChanged
    767767
    768 renderingUpdateThrottlingEnabled:
    769   initial: true
    770   onChange: renderingUpdateThrottlingEnabledChanged
    771 
    772768storageBlockingPolicy:
    773769  type: SecurityOrigin::StorageBlockingPolicy
  • trunk/Source/WebCore/page/SettingsBase.cpp

    r255131 r255150  
    408408}
    409409
    410 void SettingsBase::renderingUpdateThrottlingEnabledChanged()
    411 {
    412     if (m_page)
    413         m_page->renderingUpdateThrottlingEnabledChanged();
    414 }
    415 
    416410void SettingsBase::resourceUsageOverlayVisibleChanged()
    417411{
  • trunk/Source/WebCore/page/SettingsBase.h

    r255131 r255150  
    195195    void hiddenPageDOMTimerThrottlingStateChanged();
    196196    void hiddenPageCSSAnimationSuspensionEnabledChanged();
    197     void renderingUpdateThrottlingEnabledChanged();
    198197    void resourceUsageOverlayVisibleChanged();
    199198    void iceCandidateFilteringEnabledChanged();
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h

    r255131 r255150  
    2828#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    2929
    30 #include "AnimationFrameRate.h"
    3130#include "PlatformScreen.h"
    3231#include <wtf/HashSet.h>
     
    4645
    4746    virtual void displayLinkFired() { }
    48 
    49     virtual void setPreferredFramesPerSecond(FramesPerSecond) { }
    5047
    5148    // Return true if callback request was scheduled, false if it couldn't be
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp

    r255131 r255150  
    4343}
    4444
    45 DisplayRefreshMonitor* DisplayRefreshMonitorManager::monitorForClient(DisplayRefreshMonitorClient& client)
     45DisplayRefreshMonitor* DisplayRefreshMonitorManager::createMonitorForClient(DisplayRefreshMonitorClient& client)
    4646{
    47     if (!client.hasDisplayID())
    48         return nullptr;
    49 
    5047    PlatformDisplayID clientDisplayID = client.displayID();
    5148    if (auto* existingMonitor = monitorForDisplayID(clientDisplayID)) {
     
    5855        return nullptr;
    5956
    60     LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::monitorForClient() - created monitor %p", monitor.get());
     57    LOG(RequestAnimationFrame, "DisplayRefreshMonitorManager::createMonitorForClient() - created monitor %p", monitor.get());
    6158    monitor->addClient(client);
    6259    DisplayRefreshMonitor* result = monitor.get();
    6360    m_monitors.append({ WTFMove(monitor) });
    6461    return result;
     62}
     63
     64void DisplayRefreshMonitorManager::registerClient(DisplayRefreshMonitorClient& client)
     65{
     66    if (!client.hasDisplayID())
     67        return;
     68
     69    createMonitorForClient(client);
    6570}
    6671
     
    8186}
    8287
    83 void DisplayRefreshMonitorManager::setPreferredFramesPerSecond(DisplayRefreshMonitorClient& client, FramesPerSecond preferredFramesPerSecond)
    84 {
    85     if (auto* monitor = monitorForClient(client))
    86         monitor->setPreferredFramesPerSecond(preferredFramesPerSecond);
    87 }
    88 
    8988bool DisplayRefreshMonitorManager::scheduleAnimation(DisplayRefreshMonitorClient& client)
    9089{
    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();
    9699}
    97100
     
    114117    unregisterClient(client);
    115118    client.setDisplayID(displayID);
     119    registerClient(client);
    116120    if (client.isScheduled())
    117121        scheduleAnimation(client);
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h

    r255131 r255150  
    2828#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    2929
    30 #include "AnimationFrameRate.h"
    3130#include "DisplayRefreshMonitor.h"
    3231#include "PlatformScreen.h"
     
    3938class DisplayRefreshMonitorManager {
    4039    friend class NeverDestroyed<DisplayRefreshMonitorManager>;
    41     friend class DisplayRefreshMonitor;
    4240public:
    4341    WEBCORE_EXPORT static DisplayRefreshMonitorManager& sharedManager();
    44 
     42   
     43    void registerClient(DisplayRefreshMonitorClient&);
    4544    void unregisterClient(DisplayRefreshMonitorClient&);
    4645
    47     void setPreferredFramesPerSecond(DisplayRefreshMonitorClient&, FramesPerSecond);
    4846    bool scheduleAnimation(DisplayRefreshMonitorClient&);
    4947    void windowScreenDidChange(PlatformDisplayID, DisplayRefreshMonitorClient&);
    5048
    5149    WEBCORE_EXPORT void displayWasUpdated(PlatformDisplayID);
    52 
     50   
    5351private:
    54     DisplayRefreshMonitorManager() = default;
     52    friend class DisplayRefreshMonitor;
     53    void displayDidRefresh(DisplayRefreshMonitor&);
     54   
     55    DisplayRefreshMonitorManager() { }
    5556    virtual ~DisplayRefreshMonitorManager();
    56 
    57     void displayDidRefresh(DisplayRefreshMonitor&);
    5857
    5958    size_t findMonitorForDisplayID(PlatformDisplayID) const;
    6059    DisplayRefreshMonitor* monitorForDisplayID(PlatformDisplayID) const;
    61     DisplayRefreshMonitor* monitorForClient(DisplayRefreshMonitorClient&);
     60
     61    DisplayRefreshMonitor* createMonitorForClient(DisplayRefreshMonitorClient&);
    6262
    6363    struct DisplayRefreshMonitorWrapper {
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp

    r255131 r255150  
    3636    : m_client(client)
    3737{
     38    DisplayRefreshMonitorManager::sharedManager().registerClient(*this);
    3839    DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, *this);
    3940    DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this);
  • trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm

    r255131 r255150  
    4141
    4242- (id)initWithMonitor:(DisplayRefreshMonitorIOS*)monitor;
    43 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond;
    4443- (void)handleDisplayLink:(CADisplayLink *)sender;
    4544- (void)invalidate;
     
    6564    ASSERT(!m_displayLink); // -invalidate should have been called already.
    6665    [super dealloc];
    67 }
    68 
    69 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond
    70 {
    71     m_displayLink.preferredFramesPerSecond = preferredFramesPerSecond;
    7266}
    7367
  • trunk/Source/WebCore/platform/ios/LowPowerModeNotifierIOS.mm

    r255131 r255150  
    4949
    5050    _notifier = &notifier;
     51    _isLowPowerModeEnabled = [NSProcessInfo processInfo].lowPowerModeEnabled;
    5152    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didReceiveLowPowerModeChange) name:NSProcessInfoPowerStateDidChangeNotification object:nil];
    52     // Set the initial state of the low power mode.
    53     [self _didReceiveLowPowerModeChange];
    5453    return self;
    5554}
  • trunk/Source/WebKit/ChangeLog

    r255147 r255150  
     12020-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
    1142020-01-27  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r255131 r255150  
    488488  type: bool
    489489  defaultValue: DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED
    490 
    491 RenderingUpdateThrottlingEnabled:
    492   type: bool
    493   defaultValue: true
    494490
    495491LowPowerVideoAudioBufferSizeEnabled:
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp

    r255131 r255150  
    13101310}
    13111311
    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 
    13221312void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout)
    13231313{
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h

    r255131 r255150  
    303303WK_EXPORT bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences);
    304304
    305 // Defaults to true.
    306 WK_EXPORT void WKPreferencesSetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferences, bool enabled);
    307 WK_EXPORT bool WKPreferencesGetRenderingUpdateThrottlingEnabled(WKPreferencesRef preferences);
    308 
    309305// Defaults to false
    310306WK_EXPORT void WKPreferencesSetSnapshotAllPlugIns(WKPreferencesRef preferencesRef, bool enabled);
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h

    r255131 r255150  
    2929#include "RemoteLayerTreeHost.h"
    3030#include "TransactionID.h"
    31 #include <WebCore/AnimationFrameRate.h>
    3231#include <WebCore/FloatPoint.h>
    3332#include <WebCore/IntPoint.h>
     
    9998
    10099    // Message handlers
    101     void setPreferredFramesPerSecond(WebCore::FramesPerSecond);
    102100    void willCommitLayerTree(TransactionID);
    103101    void commitLayerTree(const RemoteLayerTreeTransaction&, const RemoteScrollingCoordinatorTransaction&);
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in

    r255131 r255150  
    2222
    2323messages -> RemoteLayerTreeDrawingAreaProxy : DrawingAreaProxy NotRefCounted {
    24     void SetPreferredFramesPerSecond(unsigned preferredFramesPerSecond)
    2524    void WillCommitLayerTree(WebKit::TransactionID transactionID)
    2625    void CommitLayerTree(WebKit::RemoteLayerTreeTransaction layerTreeTransaction, WebKit::RemoteScrollingCoordinatorTransaction scrollingTreeTransaction)
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm

    r255131 r255150  
    5050
    5151- (id)initWithDrawingAreaProxy:(WebKit::RemoteLayerTreeDrawingAreaProxy*)drawingAreaProxy;
    52 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond;
    5352- (void)displayLinkFired:(CADisplayLink *)sender;
    5453- (void)invalidate;
     
    7877}
    7978
    80 - (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond
    81 {
    82     _displayLink.preferredFramesPerSecond = preferredFramesPerSecond;
    83 }
    84 
    8579- (void)displayLinkFired:(CADisplayLink *)sender
    8680{
     
    188182    send(Messages::DrawingArea::UpdateGeometry(m_size, false /* flushSynchronously */, MachSendRight()));
    189183    m_isWaitingForDidUpdateGeometry = true;
    190 }
    191 
    192 void RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)
    193 {
    194 #if PLATFORM(IOS_FAMILY)
    195     [displayLinkHandler() setPreferredFramesPerSecond:preferredFramesPerSecond];
    196 #else
    197     UNUSED_PARAM(preferredFramesPerSecond);
    198 #endif
    199184}
    200185
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h

    r255131 r255150  
    2929
    3030#include "RemoteLayerTreeDrawingArea.h"
    31 #include <WebCore/AnimationFrameRate.h>
    3231#include <WebCore/DisplayRefreshMonitor.h>
    3332
     
    4342    virtual ~RemoteLayerTreeDisplayRefreshMonitor();
    4443
    45     void setPreferredFramesPerSecond(WebCore::FramesPerSecond) override;
    4644    bool requestRefreshCallback() override;
    4745
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm

    r255131 r255150  
    4444}
    4545
    46 void RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)
    47 {
    48     if (m_drawingArea)
    49         m_drawingArea->setPreferredFramesPerSecond(preferredFramesPerSecond);
    50 }
    51 
    5246bool RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback()
    5347{
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h

    r255131 r255150  
    3030#include "GraphicsLayerCARemote.h"
    3131#include "RemoteLayerTreeTransaction.h"
    32 #include <WebCore/AnimationFrameRate.h>
    3332#include <WebCore/GraphicsLayerClient.h>
    3433#include <WebCore/Timer.h>
     
    7574    RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override;
    7675    void willDestroyDisplayRefreshMonitor(WebCore::DisplayRefreshMonitor*);
    77     void setPreferredFramesPerSecond(WebCore::FramesPerSecond);
    7876
    7977    bool shouldUseTiledBackingForFrameView(const WebCore::FrameView&) const override;
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

    r255131 r255150  
    124124}
    125125
    126 void RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond(FramesPerSecond preferredFramesPerSecond)
    127 {
    128     send(Messages::RemoteLayerTreeDrawingAreaProxy::SetPreferredFramesPerSecond(preferredFramesPerSecond));
    129 }
    130 
    131126void RemoteLayerTreeDrawingArea::updateRootLayers()
    132127{
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r255142 r255150  
     12020-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
    1142020-01-27  Cathie Chen  <cathiechen@igalia.com>
    215
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h

    r255142 r255150  
    165165#define WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey @"WebKitHiddenPageDOMTimerThrottlingEnabled"
    166166#define WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey @"WebKitHiddenPageCSSAnimationSuspensionEnabled"
    167 #define WebKitRenderingUpdateThrottlingEnabledPreferenceKey @"WebKitRenderingUpdateThrottlingEnabled"
    168167#define WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey @"WebKitLowPowerVideoAudioBufferSizeEnabled"
    169168#define WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey @"WebKitUseLegacyTextAlignPositionedElementBehavior"
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm

    r255131 r255150  
    594594        @NO, WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
    595595        @NO, WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
    596         @YES, WebKitRenderingUpdateThrottlingEnabledPreferenceKey,
    597596        @NO, WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
    598597       
     
    27872786}
    27882787
    2789 - (BOOL)renderingUpdateThrottlingEnabled
    2790 {
    2791     return [self _boolValueForKey:WebKitRenderingUpdateThrottlingEnabledPreferenceKey];
    2792 }
    2793 
    2794 - (void)setRenderingUpdateThrottlingEnabled:(BOOL)enabled
    2795 {
    2796     [self _setBoolValue:enabled forKey:WebKitRenderingUpdateThrottlingEnabledPreferenceKey];
    2797 }
    2798 
    27992788- (BOOL)lowPowerVideoAudioBufferSizeEnabled
    28002789{
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h

    r255131 r255150  
    489489- (BOOL)hiddenPageCSSAnimationSuspensionEnabled;
    490490- (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag;
    491 
    492 - (BOOL)renderingUpdateThrottlingEnabled;
    493 - (void)setRenderingUpdateThrottlingEnabled:(BOOL)flag;
    494491
    495492- (BOOL)lowPowerVideoAudioBufferSizeEnabled;
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r255131 r255150  
    31343134
    31353135    settings.setHiddenPageDOMTimerThrottlingEnabled([preferences hiddenPageDOMTimerThrottlingEnabled]);
     3136
    31363137    settings.setHiddenPageCSSAnimationSuspensionEnabled([preferences hiddenPageCSSAnimationSuspensionEnabled]);
    3137     settings.setRenderingUpdateThrottlingEnabled([preferences renderingUpdateThrottlingEnabled]);
    31383138
    31393139    WebCore::DeprecatedGlobalSettings::setResourceLoadStatisticsEnabled([preferences resourceLoadStatisticsEnabled]);
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r255131 r255150  
     12020-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
    1142020-01-26  Said Abou-Hallawa  <said@apple.com>
    215
  • trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl

    r255131 r255150  
    257257    HRESULT setWebSQLEnabled([in] BOOL enabled);
    258258    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  
    225225
    226226#define WebKitWebSQLEnabledPreferenceKey "WebKitWebSQLEnabled"
    227 
    228 #define WebKitRenderingUpdateThrottlingEnabledPreferenceKey "WebKitRenderingUpdateThrottlingEnabled"
  • trunk/Source/WebKitLegacy/win/WebPreferences.cpp

    r255131 r255150  
    352352    CFDictionaryAddValue(defaults, CFSTR(WebKitWebSQLEnabledPreferenceKey), kCFBooleanFalse);
    353353
    354     CFDictionaryAddValue(defaults, CFSTR(WebKitRenderingUpdateThrottlingEnabledPreferenceKey), kCFBooleanTrue);
    355 
    356354    defaultSettings = defaults;
    357355#endif
     
    24532451    return S_OK;
    24542452}
    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  
    302302    virtual HRESULT STDMETHODCALLTYPE webSQLEnabled(_Out_ BOOL*);
    303303    virtual HRESULT STDMETHODCALLTYPE setWebSQLEnabled(BOOL);
    304     virtual HRESULT STDMETHODCALLTYPE renderingUpdateThrottlingEnabled(_Out_ BOOL*);
    305     virtual HRESULT STDMETHODCALLTYPE setRenderingUpdateThrottlingEnabled(BOOL);
    306304
    307305    // WebPreferences
  • trunk/Source/WebKitLegacy/win/WebView.cpp

    r255131 r255150  
    56055605    settings.setRequestAnimationFrameEnabled(enabled);
    56065606
    5607     hr = prefsPrivate->renderingUpdateThrottlingEnabled(&enabled);
    5608     if (FAILED(hr))
    5609         return hr;
    5610     settings.setRenderingUpdateThrottlingEnabled(enabled);
    5611 
    56125607    hr = prefsPrivate->mockScrollbarsEnabled(&enabled);
    56135608    if (FAILED(hr))
  • trunk/Tools/ChangeLog

    r255148 r255150  
     12020-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
    1142020-01-27  Jonathan Bedard  <jbedard@apple.com>
    215
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r255131 r255150  
    995995    [preferences setHiddenPageDOMTimerThrottlingEnabled:NO];
    996996    [preferences setHiddenPageCSSAnimationSuspensionEnabled:NO];
    997     [preferences setRenderingUpdateThrottlingEnabled:NO];
    998997    [preferences setRemotePlaybackEnabled:YES];
    999998
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r255131 r255150  
    801801    prefsPrivate->setServerTimingEnabled(TRUE);
    802802    prefsPrivate->setAspectRatioOfImgFromWidthAndHeightEnabled(TRUE);
    803     prefsPrivate->setRenderingUpdateThrottlingEnabled(FALSE);
    804803    // FIXME: WebGL2
    805804    // FIXME: WebRTC
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r255131 r255150  
    908908    WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(preferences, false);
    909909    WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(preferences, false);
    910     WKPreferencesSetRenderingUpdateThrottlingEnabled(preferences, false);
    911910
    912911    WKPreferencesSetAcceleratedDrawingEnabled(preferences, m_shouldUseAcceleratedDrawing || options.useAcceleratedDrawing);
Note: See TracChangeset for help on using the changeset viewer.