Title: [112287] trunk/Source/WebKit/blackberry
Revision
112287
Author
[email protected]
Date
2012-03-27 11:39:59 -0700 (Tue, 27 Mar 2012)

Log Message

[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.

Patch by Andrew Lo <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp (112286 => 112287)


--- trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp	2012-03-27 18:18:42 UTC (rev 112286)
+++ trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp	2012-03-27 18:39:59 UTC (rev 112287)
@@ -43,17 +43,14 @@
 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 @@
         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 @@
     m_layerRenderer->releaseLayerResources();
 }
 
-void WebPageCompositorPrivate::animationTimerFired()
+void WebPageCompositorPrivate::animationFrameChanged()
 {
     BackingStore* backingStore = m_webPage->m_backingStore;
     if (!backingStore) {

Modified: trunk/Source/WebKit/blackberry/Api/WebPageCompositor_p.h (112286 => 112287)


--- trunk/Source/WebKit/blackberry/Api/WebPageCompositor_p.h	2012-03-27 18:18:42 UTC (rev 112286)
+++ trunk/Source/WebKit/blackberry/Api/WebPageCompositor_p.h	2012-03-27 18:39:59 UTC (rev 112287)
@@ -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 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 @@
     WebPageCompositorPrivate(WebPagePrivate*, WebPageCompositorClient*);
 
 private:
-    void animationTimerFired();
+    void animationFrameChanged();
 
     WebPageCompositorClient* m_client;
     WebPagePrivate* m_webPage;
@@ -96,8 +96,6 @@
     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;
 };
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (112286 => 112287)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-27 18:18:42 UTC (rev 112286)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-27 18:39:59 UTC (rev 112287)
@@ -1,3 +1,20 @@
+2012-03-27  Andrew Lo  <[email protected]>
+
+        [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  <[email protected]>
 
         A page containing multiparts with "multipart/x-mixed-replace" should not be cached.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to