Title: [94908] trunk/Source
Revision
94908
Author
[email protected]
Date
2011-09-10 07:21:01 -0700 (Sat, 10 Sep 2011)

Log Message

requestAnimationFrame doesn't throttle on Mac
https://bugs.webkit.org/show_bug.cgi?id=67171

Reviewed by Simon Fraser.

Source/_javascript_Core:

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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (94907 => 94908)


--- trunk/Source/_javascript_Core/ChangeLog	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-09-10 14:21:01 UTC (rev 94908)
@@ -1,3 +1,16 @@
+2011-09-09  Chris Marrin  <[email protected]>
+
+        requestAnimationFrame doesn't throttle on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=67171
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2011-09-09  Geoffrey Garen  <[email protected]>
 
         Reviewed by Dan Bernstein.

Modified: trunk/Source/_javascript_Core/wtf/Platform.h (94907 => 94908)


--- trunk/Source/_javascript_Core/wtf/Platform.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/_javascript_Core/wtf/Platform.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -1159,4 +1159,8 @@
 #define WTF_USE_AVFOUNDATION 1
 #endif
 
+#if PLATFORM(MAC)
+#define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
+#endif
+
 #endif /* WTF_Platform_h */

Modified: trunk/Source/WebCore/ChangeLog (94907 => 94908)


--- trunk/Source/WebCore/ChangeLog	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/ChangeLog	2011-09-10 14:21:01 UTC (rev 94908)
@@ -1,3 +1,29 @@
+2011-09-09  Chris Marrin  <[email protected]>
+
+        requestAnimationFrame doesn't throttle on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=67171
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2011-09-10  Jarred Nicholls  <[email protected]>
 
         [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (94907 => 94908)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2011-09-10 14:21:01 UTC (rev 94908)
@@ -33,12 +33,26 @@
 #include "FrameView.h"
 #include "RequestAnimationFrameCallback.h"
 
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+#include <algorithm>
+#include <wtf/CurrentTime.h>
+
+using namespace std;
+
+// Allow a little more than 60fps to make sure we can at least hit that frame rate.
+#define MinimumAnimationInterval 0.015
+#endif
+
 namespace WebCore {
 
 ScriptedAnimationController::ScriptedAnimationController(Document* document)
     : m_document(document)
     , m_nextCallbackId(0)
     , m_suspendCount(0)
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+    , m_animationTimer(this, &ScriptedAnimationController::animationTimerFired)
+    , m_lastAnimationFrameTime(0)
+#endif
 {
 }
 
@@ -51,8 +65,7 @@
 {
     --m_suspendCount;
     if (!m_suspendCount && m_callbacks.size())
-        if (FrameView* fv = m_document->view())
-            fv->scheduleAnimation();
+        scheduleAnimation();
 }
 
 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(PassRefPtr<RequestAnimationFrameCallback> callback, Element* animationElement)
@@ -63,8 +76,7 @@
     callback->m_element = animationElement;
     m_callbacks.append(callback);
     if (!m_suspendCount)
-        if (FrameView* view = m_document->view())
-            view->scheduleAnimation();
+        scheduleAnimation();
     return id;
 }
 
@@ -124,11 +136,29 @@
     }
 
     if (m_callbacks.size())
-        if (FrameView* view = m_document->view())
-            view->scheduleAnimation();
+        scheduleAnimation();
 }
+    
+void ScriptedAnimationController::scheduleAnimation()
+{
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+    double scheduleDelay = max<double>(MinimumAnimationInterval - (currentTime() - m_lastAnimationFrameTime), 0);
+    m_animationTimer.startOneShot(scheduleDelay);
+#else
+    if (FrameView* frameView = m_document->view())
+        frameView->scheduleAnimation();
+#endif
+}
 
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+void ScriptedAnimationController::animationTimerFired(Timer<ScriptedAnimationController>*)
+{
+    m_lastAnimationFrameTime = currentTime();
+    serviceScriptedAnimations(m_lastAnimationFrameTime);
 }
+#endif
 
+}
+
 #endif
 

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (94907 => 94908)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -28,6 +28,9 @@
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
 #include "DOMTimeStamp.h"
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+#include "Timer.h"
+#endif
 #include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefPtr.h>
@@ -58,12 +61,21 @@
 
 private:
     explicit ScriptedAnimationController(Document*);
+    
     typedef Vector<RefPtr<RequestAnimationFrameCallback> > CallbackList;
     CallbackList m_callbacks;
 
     Document* m_document;
     CallbackId m_nextCallbackId;
     int m_suspendCount;
+
+    void scheduleAnimation();
+
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+    void animationTimerFired(Timer<ScriptedAnimationController>*);
+    Timer<ScriptedAnimationController> m_animationTimer;
+    double m_lastAnimationFrameTime;
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/loader/EmptyClients.h (94907 => 94908)


--- trunk/Source/WebCore/loader/EmptyClients.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -164,7 +164,7 @@
 #if ENABLE(TILED_BACKING_STORE)
     virtual void delegatedScrollRequested(const IntPoint&) { }
 #endif
-#if ENABLE(REQUEST_ANIMATION_FRAME)
+#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
     virtual void scheduleAnimation() { }
 #endif
 

Modified: trunk/Source/WebCore/page/Chrome.cpp (94907 => 94908)


--- trunk/Source/WebCore/page/Chrome.cpp	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/page/Chrome.cpp	2011-09-10 14:21:01 UTC (rev 94908)
@@ -514,7 +514,9 @@
 #if ENABLE(REQUEST_ANIMATION_FRAME)
 void Chrome::scheduleAnimation()
 {
+#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
     m_client->scheduleAnimation();
+#endif
 }
 #endif
 

Modified: trunk/Source/WebCore/page/ChromeClient.h (94907 => 94908)


--- trunk/Source/WebCore/page/ChromeClient.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebCore/page/ChromeClient.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -159,7 +159,7 @@
         virtual void scrollbarsModeDidChange() const = 0;
         virtual void setCursor(const Cursor&) = 0;
         virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
-#if ENABLE(REQUEST_ANIMATION_FRAME)
+#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
         virtual void scheduleAnimation() = 0;
 #endif
         // End methods used by HostWindow.

Modified: trunk/Source/WebKit/mac/ChangeLog (94907 => 94908)


--- trunk/Source/WebKit/mac/ChangeLog	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-09-10 14:21:01 UTC (rev 94908)
@@ -1,3 +1,20 @@
+2011-09-09  Chris Marrin  <[email protected]>
+
+        requestAnimationFrame doesn't throttle on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=67171
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2011-09-09  Fady Samuel  <[email protected]>
 
         Move pageScaleFactor code from Frame.{h|cpp} to Page.{h|cpp}

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (94907 => 94908)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -128,10 +128,6 @@
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-        virtual void scheduleAnimation();
-#endif
-
     virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type,
         const WebCore::FloatRect& lineRect);
     virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString& type,

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (94907 => 94908)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2011-09-10 14:21:01 UTC (rev 94908)
@@ -942,15 +942,6 @@
 
 #endif
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-void WebChromeClient::scheduleAnimation()
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [m_webView _scheduleAnimation];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-#endif
-
 #if ENABLE(VIDEO)
 
 bool WebChromeClient::supportsFullscreenForNode(const Node* node)

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (94907 => 94908)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2011-09-10 14:21:01 UTC (rev 94908)
@@ -395,9 +395,6 @@
 #if USE(ACCELERATED_COMPOSITING)
 - (void)_clearLayerSyncLoopObserver;
 #endif
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-- (void)_unscheduleAnimation;
-#endif
 #if ENABLE(GLIB_SUPPORT)
 - (void)_clearGlibLoopObserver;
 #endif
@@ -1226,10 +1223,6 @@
     [self _clearLayerSyncLoopObserver];
 #endif
     
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    [self _unscheduleAnimation];
-#endif
-
 #if ENABLE(GLIB_SUPPORT)
     [self _clearGlibLoopObserver];
 #endif
@@ -5921,18 +5914,6 @@
 }
 #endif
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-- (void)_unscheduleAnimation
-{
-    if (!_private->requestAnimationFrameRunLoopObserver)
-        return;
-
-    CFRunLoopObserverInvalidate(_private->requestAnimationFrameRunLoopObserver);
-    CFRelease(_private->requestAnimationFrameRunLoopObserver);
-    _private->requestAnimationFrameRunLoopObserver = 0;
-}
-#endif
-
 #if ENABLE(GLIB_SUPPORT)
 - (void)_clearGlibLoopObserver
 {
@@ -6212,34 +6193,6 @@
 
 #endif
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-static void requestAnimationFrameRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* info)
-{
-    WebView *webView = reinterpret_cast<WebView*>(info);
-    [webView _unscheduleAnimation];
-    
-    if (Frame* frame = [webView _mainCoreFrame])
-        if (FrameView* frameView = frame->view())
-            frameView->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
-}
-
-- (void)_scheduleAnimation
-{
-    if (!_private->requestAnimationFrameRunLoopObserver) {
-        CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
-    
-        // Make sure we wake up the loop or the observer could be delayed until some other source fires.
-        CFRunLoopWakeUp(currentRunLoop);
-
-        // Run before the layerSyncRunLoopObserver, which has order NSDisplayWindowRunLoopOrdering + 2.
-        const CFIndex runLoopOrder = NSDisplayWindowRunLoopOrdering + 1;
-        CFRunLoopObserverContext context = { 0, self, 0, 0, 0 };
-        _private->requestAnimationFrameRunLoopObserver = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, NO, runLoopOrder, requestAnimationFrameRunLoopObserverCallback, &context);
-        CFRunLoopAddObserver(currentRunLoop, _private->requestAnimationFrameRunLoopObserver, kCFRunLoopCommonModes);
-    }
-}
-#endif
-
 #if ENABLE(VIDEO)
 
 - (void)_enterFullscreenForNode:(WebCore::Node*)node

Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (94907 => 94908)


--- trunk/Source/WebKit/mac/WebView/WebViewData.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -155,10 +155,6 @@
     CFRunLoopObserverRef layerSyncRunLoopObserver;
 #endif
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    CFRunLoopObserverRef requestAnimationFrameRunLoopObserver;
-#endif
-
     NSPasteboard *insertionPasteboard;
             
     NSSize lastLayoutSize;

Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (94907 => 94908)


--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -93,10 +93,6 @@
 - (void)_scheduleCompositingLayerSync;
 #endif
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-- (void)_scheduleAnimation;
-#endif
-
 #if ENABLE(GLIB_SUPPORT)
 - (void)_scheduleGlibContextIterations;
 #endif

Modified: trunk/Source/WebKit2/ChangeLog (94907 => 94908)


--- trunk/Source/WebKit2/ChangeLog	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-10 14:21:01 UTC (rev 94908)
@@ -1,3 +1,20 @@
+2011-09-09  Chris Marrin  <[email protected]>
+
+        requestAnimationFrame doesn't throttle on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=67171
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2011-09-09  Fady Samuel  <[email protected]>
 
         Move pageScaleFactor code from Frame.{h|cpp} to Page.{h|cpp}

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (94907 => 94908)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-09-10 14:21:01 UTC (rev 94908)
@@ -654,13 +654,6 @@
     m_page->send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves));
 }
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-void WebChromeClient::scheduleAnimation()
-{
-    m_page->scheduleAnimation();
-}
-#endif
-
 void WebChromeClient::formStateDidChange(const Node*)
 {
     notImplemented();

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (94907 => 94908)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -172,10 +172,6 @@
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    virtual void scheduleAnimation();
-#endif
-
     // Notification that the given form element has changed. This function
     // will be called frequently, so handling should be very fast.
     virtual void formStateDidChange(const WebCore::Node*);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (94907 => 94908)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-09-10 14:21:01 UTC (rev 94908)
@@ -262,14 +262,8 @@
 
 #if PLATFORM(MAC)
     ASSERT(m_pluginViews.isEmpty());
-
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    unscheduleAnimation();
-    ASSERT(!m_requestAnimationFrameRunLoopObserver);
 #endif
 
-#endif
-
 #ifndef NDEBUG
     webPageCounter.decrement();
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (94907 => 94908)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-09-10 14:21:01 UTC (rev 94908)
@@ -351,10 +351,6 @@
     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
     bool performNonEditingBehaviorForSelector(const String&);
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    void scheduleAnimation();
-    void unscheduleAnimation();
-#endif
 #elif PLATFORM(WIN)
     void confirmComposition(const String& compositionString);
     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
@@ -612,11 +608,6 @@
 
     WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-    static void requestAnimationFrameRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
-    RetainPtr<CFRunLoopObserverRef> m_requestAnimationFrameRunLoopObserver;
-#endif
-
 #elif PLATFORM(WIN)
     // Our view's window (in the UI process).
     HWND m_nativeWindow;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (94907 => 94908)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2011-09-10 14:06:06 UTC (rev 94907)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2011-09-10 14:21:01 UTC (rev 94908)
@@ -30,7 +30,6 @@
 #import "AttributedString.h"
 #import "DataReference.h"
 #import "EditorState.h"
-#import "LayerTreeHostCAMac.h"
 #import "PluginView.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebEvent.h"
@@ -584,45 +583,6 @@
     return true;
 }
 
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-void WebPage::requestAnimationFrameRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
-{
-    WebPage* webPage = static_cast<WebPage*>(context);
-    webPage->unscheduleAnimation();
-    
-    // This gets called outside of the normal event loop so wrap in an autorelease pool
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    if (webPage->corePage()->mainFrame() && webPage->corePage()->mainFrame()->view())
-        webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
-    [pool drain];
-}
-
-void WebPage::scheduleAnimation()
-{
-    if (!m_requestAnimationFrameRunLoopObserver) {
-        CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
-    
-        // Make sure we wake up the loop or the observer could be delayed until some other source fires.
-        CFRunLoopWakeUp(currentRunLoop);
-
-        // Run before the flushPendingLayerChangesRunLoopObserver, which has order CoreAnimationRunLoopOrder - 1.
-        const CFIndex runLoopOrder = CoreAnimationRunLoopOrder - 2;
-        CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
-        m_requestAnimationFrameRunLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, false, runLoopOrder, requestAnimationFrameRunLoopObserverCallback, &context));
-
-        CFRunLoopAddObserver(currentRunLoop, m_requestAnimationFrameRunLoopObserver.get(), kCFRunLoopCommonModes);
-    }
-}
-
-void WebPage::unscheduleAnimation()
-{
-    if (m_requestAnimationFrameRunLoopObserver) {
-        CFRunLoopObserverInvalidate(m_requestAnimationFrameRunLoopObserver.get());
-        m_requestAnimationFrameRunLoopObserver = nullptr;
-    }
-}
-#endif
-
 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&)
 {
     return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to