Title: [110709] trunk/Source
Revision
110709
Author
[email protected]
Date
2012-03-14 09:23:02 -0700 (Wed, 14 Mar 2012)

Log Message

[BlackBerry] Implement REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR using AnimationFrameRateController
https://bugs.webkit.org/show_bug.cgi?id=81000

Source/_javascript_Core:

Enable WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for BlackBerry.

Patch by Andrew Lo <[email protected]> on 2012-03-14
Reviewed by Antonio Gomes.

* wtf/Platform.h:

Source/WebCore:

Add BlackBerry port for DisplayRefreshMonitor using AnimationFrameRateController.
Moved refreshDisplayOnMainThread to platform independant part of header.

Patch by Andrew Lo <[email protected]> on 2012-03-14
Reviewed by Antonio Gomes.

requestAnimationFrame already covered by tests in LayoutTests/fast/animation.

* PlatformBlackBerry.cmake:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
* platform/graphics/DisplayRefreshMonitor.h:
(WebCore):
(DisplayAnimationClient):
(WebCore::DisplayAnimationClient::~DisplayAnimationClient):
(DisplayRefreshMonitor):
* platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp: Added.
(WebCore):
(WebCore::DisplayAnimationClient::DisplayAnimationClient):
(WebCore::DisplayAnimationClient::animationFrameChanged):
(WebCore::DisplayRefreshMonitor::~DisplayRefreshMonitor):
(WebCore::DisplayRefreshMonitor::startAnimationClient):
(WebCore::DisplayRefreshMonitor::stopAnimationClient):
(WebCore::DisplayRefreshMonitor::requestRefreshCallback):
(WebCore::DisplayRefreshMonitor::displayLinkFired):

Source/WebKit/blackberry:

Set the platform display ID, needed for DisplayRefreshMonitor.

Patch by Andrew Lo <[email protected]> on 2012-03-14
Reviewed by Antonio Gomes.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::init):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (110708 => 110709)


--- trunk/Source/_javascript_Core/ChangeLog	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-03-14 16:23:02 UTC (rev 110709)
@@ -1,3 +1,14 @@
+2012-03-14  Andrew Lo  <[email protected]>
+
+        [BlackBerry] Implement REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR using AnimationFrameRateController
+        https://bugs.webkit.org/show_bug.cgi?id=81000
+
+        Enable WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for BlackBerry.
+
+        Reviewed by Antonio Gomes.
+
+        * wtf/Platform.h:
+
 2012-03-13  Filip Pizlo  <[email protected]>
 
         ValueToInt32 speculation will cause OSR exits even when it does not have to

Modified: trunk/Source/_javascript_Core/wtf/Platform.h (110708 => 110709)


--- trunk/Source/_javascript_Core/wtf/Platform.h	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/_javascript_Core/wtf/Platform.h	2012-03-14 16:23:02 UTC (rev 110709)
@@ -1170,7 +1170,7 @@
 #define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
 #endif
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(BLACKBERRY)
 #define WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1
 #endif
 

Modified: trunk/Source/WebCore/ChangeLog (110708 => 110709)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 16:23:02 UTC (rev 110709)
@@ -1,3 +1,33 @@
+2012-03-14  Andrew Lo  <[email protected]>
+
+        [BlackBerry] Implement REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR using AnimationFrameRateController
+        https://bugs.webkit.org/show_bug.cgi?id=81000
+
+        Add BlackBerry port for DisplayRefreshMonitor using AnimationFrameRateController.
+        Moved refreshDisplayOnMainThread to platform independant part of header.
+
+        Reviewed by Antonio Gomes.
+
+        requestAnimationFrame already covered by tests in LayoutTests/fast/animation.
+
+        * PlatformBlackBerry.cmake:
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
+        * platform/graphics/DisplayRefreshMonitor.h:
+        (WebCore):
+        (DisplayAnimationClient):
+        (WebCore::DisplayAnimationClient::~DisplayAnimationClient):
+        (DisplayRefreshMonitor):
+        * platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp: Added.
+        (WebCore):
+        (WebCore::DisplayAnimationClient::DisplayAnimationClient):
+        (WebCore::DisplayAnimationClient::animationFrameChanged):
+        (WebCore::DisplayRefreshMonitor::~DisplayRefreshMonitor):
+        (WebCore::DisplayRefreshMonitor::startAnimationClient):
+        (WebCore::DisplayRefreshMonitor::stopAnimationClient):
+        (WebCore::DisplayRefreshMonitor::requestRefreshCallback):
+        (WebCore::DisplayRefreshMonitor::displayLinkFired):
+
 2012-03-14  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: use class name indexes instead of class names when evaluating aggregates

Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (110708 => 110709)


--- trunk/Source/WebCore/PlatformBlackBerry.cmake	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake	2012-03-14 16:23:02 UTC (rev 110709)
@@ -195,6 +195,13 @@
     bindings/cpp/WebDOMString.h
 )
 
+if (ENABLE_REQUEST_ANIMATION_FRAME)
+    LIST(APPEND WebCore_SOURCES
+        platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp
+        platform/graphics/DisplayRefreshMonitor.cpp
+    )
+ENDIF ()
+
 if (ENABLE_WEBGL)
     LIST(APPEND WebCore_INCLUDE_DIRECTORIES
         "${WEBCORE_DIR}/platform/graphics/gpu"

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (110708 => 110709)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2012-03-14 16:23:02 UTC (rev 110709)
@@ -61,6 +61,9 @@
 #if PLATFORM(MAC)
     , m_displayLink(0)
 #endif
+#if PLATFORM(BLACKBERRY)
+    , m_animationClient(0)
+#endif
 {
 }
 

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (110708 => 110709)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2012-03-14 16:23:02 UTC (rev 110709)
@@ -31,6 +31,9 @@
 #include "PlatformScreen.h"
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
+#if PLATFORM(BLACKBERRY)
+#include <BlackBerryPlatformAnimation.h>
+#endif
 
 #if PLATFORM(MAC)
 typedef struct __CVDisplayLink *CVDisplayLinkRef;
@@ -68,6 +71,17 @@
     PlatformDisplayID m_displayID;
 };
 
+#if PLATFORM(BLACKBERRY)
+class DisplayAnimationClient : public BlackBerry::Platform::AnimationFrameRateClient {
+public:
+    DisplayAnimationClient(DisplayRefreshMonitor *);
+    ~DisplayAnimationClient() { }
+private:
+    virtual void animationFrameChanged();
+    DisplayRefreshMonitor *m_monitor;
+};
+#endif
+
 //
 // Monitor for display refresh messages for a given screen
 //
@@ -97,7 +111,8 @@
 
 private:
     void notifyClients();
-    
+    static void refreshDisplayOnMainThread(void* data);
+
     double m_timestamp;
     bool m_active;
     bool m_scheduled;
@@ -106,13 +121,18 @@
     DisplayRefreshMonitorManager* m_manager;
     Mutex m_mutex;
     Vector<DisplayRefreshMonitorClient*> m_clients;
-    
+#if PLATFORM(BLACKBERRY)
+public:
+    void displayLinkFired();
+private:
+    DisplayAnimationClient *m_animationClient;
+    void startAnimationClient();
+    void stopAnimationClient();
+#endif
 #if PLATFORM(MAC)
 public:
     void displayLinkFired(double nowSeconds, double outputTimeSeconds);
 private:
-    static void refreshDisplayOnMainThread(void* data);
-
     CVDisplayLinkRef m_displayLink;
 #endif
 };

Added: trunk/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp (0 => 110709)


--- trunk/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/blackberry/DisplayRefreshMonitorBlackBerry.cpp	2012-03-14 16:23:02 UTC (rev 110709)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+
+#include <wtf/CurrentTime.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+DisplayAnimationClient::DisplayAnimationClient(DisplayRefreshMonitor *monitor)
+    : m_monitor(monitor)
+{
+}
+
+void DisplayAnimationClient::animationFrameChanged()
+{
+    m_monitor->displayLinkFired();
+}
+
+DisplayRefreshMonitor::~DisplayRefreshMonitor()
+{
+    stopAnimationClient();
+    cancelCallOnMainThread(DisplayRefreshMonitor::refreshDisplayOnMainThread, this);
+}
+
+void DisplayRefreshMonitor::startAnimationClient()
+{
+    if (m_animationClient)
+        return;
+
+    m_animationClient = new DisplayAnimationClient(this);
+    BlackBerry::Platform::AnimationFrameRateController::instance()->addClient(m_animationClient);
+}
+
+void DisplayRefreshMonitor::stopAnimationClient()
+{
+    if (!m_animationClient)
+        return;
+
+    BlackBerry::Platform::AnimationFrameRateController::instance()->removeClient(m_animationClient);
+    delete m_animationClient;
+    m_animationClient = 0;
+}
+
+bool DisplayRefreshMonitor::requestRefreshCallback()
+{
+    MutexLocker lock(m_mutex);
+
+    startAnimationClient();
+
+    m_scheduled = true;
+    return true;
+}
+
+void DisplayRefreshMonitor::displayLinkFired()
+{
+    MutexLocker lock(m_mutex);
+
+    m_scheduled = false;
+    m_timestamp = currentTime();
+
+    callOnMainThread(refreshDisplayOnMainThread, this);
+}
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (110708 => 110709)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-03-14 16:23:02 UTC (rev 110709)
@@ -144,6 +144,10 @@
 #include "GrContext.h"
 #endif
 
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+#include "PlatformScreen.h"
+#endif
+
 #define DEBUG_BLOCK_ZOOM 0
 #define DEBUG_TOUCH_EVENTS 0
 #define DEBUG_WEBPAGE_LOAD 0
@@ -482,6 +486,10 @@
     blockClickRadius = int(roundf(0.35 * Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(0).width())); // The clicked rectangle area should be a fixed unit of measurement.
 
     m_page->settings()->setDelegateSelectionPaint(true);
+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+    m_page->windowScreenDidChange((PlatformDisplayID)0);
+#endif
 }
 
 void WebPagePrivate::load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const char* overrideContentType)

Modified: trunk/Source/WebKit/blackberry/ChangeLog (110708 => 110709)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-14 16:21:05 UTC (rev 110708)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-14 16:23:02 UTC (rev 110709)
@@ -1,3 +1,15 @@
+2012-03-14  Andrew Lo  <[email protected]>
+
+        [BlackBerry] Implement REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR using AnimationFrameRateController
+        https://bugs.webkit.org/show_bug.cgi?id=81000
+
+        Set the platform display ID, needed for DisplayRefreshMonitor.
+
+        Reviewed by Antonio Gomes.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::init):
+
 2012-03-14  Leo Yang  <[email protected]>
 
         [BlackBerry] Upstream the BlackBerry change to platform/Cursor.h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to