Remove #include of <QuartzCore/QuartzCore.h> in a widely-used header.
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Oct 2011 01:22:42 +0000 (01:22 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Oct 2011 01:22:42 +0000 (01:22 +0000)
Reviewed by Sam Weinig.

* platform/PlatformScreen.h: Typedef PlatformDisplayID to a uint32_t.
* platform/graphics/DisplayRefreshMonitor.h: Typedef CVDisplayLinkRef as
an opaque type to avoid bringing in QuartzCore.h, and move displayLinkCallback
to the .cpp file since it uses Core Video types.
* platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
(WebCore::displayLinkCallback): Make this a local static function, that
calls a member fuction on the object.
(WebCore::DisplayRefreshMonitor::requestRefreshCallback):
(WebCore::DisplayRefreshMonitor::displayLinkFired):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformScreen.h
Source/WebCore/platform/graphics/DisplayRefreshMonitor.h
Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp

index 1c8bc54..db5340b 100644 (file)
@@ -1,3 +1,19 @@
+2011-10-13  Simon Fraser  <simon.fraser@apple.com>
+
+        Remove #include of <QuartzCore/QuartzCore.h> in a widely-used header.
+
+        Reviewed by Sam Weinig.
+
+        * platform/PlatformScreen.h: Typedef PlatformDisplayID to a uint32_t.
+        * platform/graphics/DisplayRefreshMonitor.h: Typedef CVDisplayLinkRef as
+        an opaque type to avoid bringing in QuartzCore.h, and move displayLinkCallback
+        to the .cpp file since it uses Core Video types.
+        * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
+        (WebCore::displayLinkCallback): Make this a local static function, that
+        calls a member fuction on the object.
+        (WebCore::DisplayRefreshMonitor::requestRefreshCallback):
+        (WebCore::DisplayRefreshMonitor::displayLinkFired):
+
 2011-10-13  Michael Saboff  <msaboff@apple.com>
 
         REGRESSION: High frequency memory warnings cause Safari to hog the CPU doing useless garbage collection
index 84f7cc6..9d3058c 100644 (file)
@@ -31,8 +31,6 @@
 #include <wtf/RefPtr.h>
 
 #if PLATFORM(MAC)
-#include <QuartzCore/QuartzCore.h>
-
 #ifdef __OBJC__
     @class NSScreen;
     @class NSWindow;
     class NSScreen;
     class NSWindow;
 #endif
-typedef CGDirectDisplayID PlatformDisplayID;
-#else
-typedef uint64_t PlatformDisplayID;
 #endif
 
+typedef uint32_t PlatformDisplayID;
+
 namespace WebCore {
 
     class FloatRect;
index d925077..5038071 100644 (file)
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(MAC)
+typedef struct __CVDisplayLink *CVDisplayLinkRef;
+#endif
+
 namespace WebCore {
 
 class DisplayRefreshMonitor;
@@ -101,8 +105,10 @@ private:
     Vector<DisplayRefreshMonitorClient*> m_clients;
     
 #if PLATFORM(MAC)
+public:
+    void displayLinkFired(double nowSeconds, double outputTimeSeconds);
+private:
     static void refreshDisplayOnMainThread(void* data);
-    static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags, CVOptionFlags*, void* data);
 
     CVDisplayLinkRef m_displayLink;
 #endif
index 776a2ef..a259051 100644 (file)
 
 namespace WebCore {
 
-CVReturn DisplayRefreshMonitor::displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags, CVOptionFlags*, void* data)
+static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags, CVOptionFlags*, void* data)
 {
     DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data);
-    
-    MutexLocker lock(monitor->m_mutex);
-    if (!monitor->m_scheduled)
-        return kCVReturnSuccess;
 
     double nowSeconds = static_cast<double>(now->videoTime) / static_cast<double>(now->videoTimeScale);
     double outputTimeSeconds = static_cast<double>(outputTime->videoTime) / static_cast<double>(outputTime->videoTimeScale);
-    double webKitNow = currentTime();
-    monitor->m_timestamp = webKitNow - nowSeconds + outputTimeSeconds;
-    
-    callOnMainThread(DisplayRefreshMonitor::refreshDisplayOnMainThread, monitor);
+    monitor->displayLinkFired(nowSeconds, outputTimeSeconds);
+
     return kCVReturnSuccess;
 }
  
@@ -74,7 +68,7 @@ bool DisplayRefreshMonitor::requestRefreshCallback()
         if (error)
             return false;
 
-        error = CVDisplayLinkSetOutputCallback(m_displayLink, DisplayRefreshMonitor::displayLinkCallback, this);
+        error = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this);
         if (error)
             return false;
 
@@ -90,6 +84,18 @@ bool DisplayRefreshMonitor::requestRefreshCallback()
     return true;
 }
 
+void DisplayRefreshMonitor::displayLinkFired(double nowSeconds, double outputTimeSeconds)
+{
+    MutexLocker lock(m_mutex);
+    if (!m_scheduled)
+        return;
+
+    double webKitNow = currentTime();
+    m_timestamp = webKitNow - nowSeconds + outputTimeSeconds;
+    
+    callOnMainThread(refreshDisplayOnMainThread, this);
+}
+
 }
 
 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)