[BlackBerry] Switch WebPageCompositor to use AnimationFrameRateController instead...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 18:39:59 +0000 (18:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 18:39:59 +0000 (18:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82350

Switch timer in WebPageCompositor to use AnimationFrameRateController.

Patch by Andrew Lo <anlo@rim.com> on 2012-03-27
Reviewed by Rob Buis.

* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::WebPageCompositorPrivate):
(BlackBerry::WebKit::WebPageCompositorPrivate::~WebPageCompositorPrivate):
(BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers):
(BlackBerry::WebKit::WebPageCompositorPrivate::animationFrameChanged):
* Api/WebPageCompositor_p.h:
(WebPageCompositorPrivate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112287 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/WebPageCompositor.cpp
Source/WebKit/blackberry/Api/WebPageCompositor_p.h
Source/WebKit/blackberry/ChangeLog

index 461deb8..da5bf76 100644 (file)
@@ -43,17 +43,14 @@ namespace WebKit {
 WebPageCompositorPrivate::WebPageCompositorPrivate(WebPagePrivate* page, WebPageCompositorClient* client)
     : m_client(client)
     , m_webPage(page)
-    , m_animationTimer(this, &WebPageCompositorPrivate::animationTimerFired)
-    , m_timerClient(new Platform::GenericTimerClient(Platform::userInterfaceThreadTimerClient()))
     , m_pendingAnimationFrame(0.0)
 {
-    m_animationTimer.setClient(m_timerClient);
+    setOneShot(true); // one-shot animation client
 }
 
 WebPageCompositorPrivate::~WebPageCompositorPrivate()
 {
-    m_animationTimer.stop();
-    delete m_timerClient;
+    Platform::AnimationFrameRateController::instance()->removeClient(this);
 }
 
 void WebPageCompositorPrivate::setContext(Platform::Graphics::GLES2Context* context)
@@ -130,7 +127,7 @@ bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRec
         if (m_client)
             m_pendingAnimationFrame = m_client->requestAnimationFrame();
         else {
-            m_animationTimer.start(1.0 / 60.0);
+            Platform::AnimationFrameRateController::instance()->addClient(this);
             m_webPage->updateDelegatedOverlays();
         }
     }
@@ -143,7 +140,7 @@ void WebPageCompositorPrivate::releaseLayerResources()
     m_layerRenderer->releaseLayerResources();
 }
 
-void WebPageCompositorPrivate::animationTimerFired()
+void WebPageCompositorPrivate::animationFrameChanged()
 {
     BackingStore* backingStore = m_webPage->m_backingStore;
     if (!backingStore) {
index 2cac924..eb4b024 100644 (file)
@@ -24,8 +24,8 @@
 #include "LayerCompositingThread.h"
 #include "LayerRenderer.h"
 
+#include <BlackBerryPlatformAnimation.h>
 #include <BlackBerryPlatformGLES2Context.h>
-#include <BlackBerryPlatformTimer.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -41,7 +41,7 @@ class WebPageCompositorClient;
 class WebPagePrivate;
 
 // This class may only be used on the compositing thread. So it does not need to be threadsaferefcounted.
-class WebPageCompositorPrivate : public RefCounted<WebPageCompositorPrivate> {
+class WebPageCompositorPrivate : public RefCounted<WebPageCompositorPrivate>, public Platform::AnimationFrameRateClient {
 public:
     static PassRefPtr<WebPageCompositorPrivate> create(WebPagePrivate* page, WebPageCompositorClient* client)
     {
@@ -86,7 +86,7 @@ protected:
     WebPageCompositorPrivate(WebPagePrivate*, WebPageCompositorClient*);
 
 private:
-    void animationTimerFired();
+    void animationFrameChanged();
 
     WebPageCompositorClient* m_client;
     WebPagePrivate* m_webPage;
@@ -96,8 +96,6 @@ private:
     WebCore::IntRect m_layoutRectForCompositing;
     WebCore::IntSize m_contentsSizeForCompositing;
     WebCore::LayerRenderingResults m_lastCompositingResults;
-    BlackBerry::Platform::Timer<WebPageCompositorPrivate> m_animationTimer;
-    BlackBerry::Platform::TimerClient* m_timerClient;
     double m_pendingAnimationFrame;
 };
 
index 90738c4..df521de 100644 (file)
@@ -1,3 +1,20 @@
+2012-03-27  Andrew Lo  <anlo@rim.com>
+
+        [BlackBerry] Switch WebPageCompositor to use AnimationFrameRateController instead of timer
+        https://bugs.webkit.org/show_bug.cgi?id=82350
+
+        Switch timer in WebPageCompositor to use AnimationFrameRateController.
+
+        Reviewed by Rob Buis.
+
+        * Api/WebPageCompositor.cpp:
+        (BlackBerry::WebKit::WebPageCompositorPrivate::WebPageCompositorPrivate):
+        (BlackBerry::WebKit::WebPageCompositorPrivate::~WebPageCompositorPrivate):
+        (BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers):
+        (BlackBerry::WebKit::WebPageCompositorPrivate::animationFrameChanged):
+        * Api/WebPageCompositor_p.h:
+        (WebPageCompositorPrivate):
+
 2012-03-27  Chris Guan  <chris.guan@torchmobile.com.cn>
 
         A page containing multiparts with "multipart/x-mixed-replace" should not be cached.