Skip to content
  • cmarrin@apple.com's avatar
    requestAnimationFrame doesn't throttle on Mac · d9dca741
    cmarrin@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=67171
    
    Reviewed by Simon Fraser.
    
    Source/JavaScriptCore:
    
    Added WTF_USE_REQUEST_ANIMATION_FRAME_TIMER to allow any platform to run
    requestAnimationFrame callbacks on a Timer defined in ScriptedAnimationController.
    Currently only enabled for PLATFORM(MAC)
    
    * wtf/Platform.h:
    
    Source/WebCore:
    
    Changed requestAnimationFrame to use a Timer in ScriptedAnimationController
    on Mac, rather than runLoopObservers. The Timer is throttled to fire no
    faster than every 15ms. It is behind a WTF_USE_REQUEST_ANIMATION_FRAME_TIMER
    flag and can be used by any implementation, but currently it is only enabled
    by PLATFORM(MAC).
    
    * dom/ScriptedAnimationController.cpp:
    (WebCore::ScriptedAnimationController::ScriptedAnimationController):
    (WebCore::ScriptedAnimationController::resume):
    (WebCore::ScriptedAnimationController::registerCallback):
    (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
    (WebCore::ScriptedAnimationController::scheduleAnimation):
    (WebCore::ScriptedAnimationController::animationTimerFired):
    * dom/ScriptedAnimationController.h:
    * loader/EmptyClients.h:
    * page/Chrome.cpp:
    (WebCore::Chrome::scheduleAnimation):
    * page/ChromeClient.h:
    
    Source/WebKit/mac:
    
    Removed runLoopObserver for requestAnimationFrame. It's now
    done by a Timer in ScriptedAnimationController in WebCore.
    
    * WebCoreSupport/WebChromeClient.h:
    * WebCoreSupport/WebChromeClient.mm:
    * WebView/WebView.mm:
    (-[WebView _close]):
    * WebView/WebViewData.h:
    * WebView/WebViewInternal.h:
    
    Source/WebKit2:
    
    Removed runLoopObserver for requestAnimationFrame. It's now
    done by a Timer in ScriptedAnimationController in WebCore.
    
    * WebProcess/WebCoreSupport/WebChromeClient.cpp:
    * WebProcess/WebCoreSupport/WebChromeClient.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::~WebPage):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/mac/WebPageMac.mm:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d9dca741