Title: [97434] trunk/Source/WebCore
- Revision
- 97434
- Author
- simon.fra...@apple.com
- Date
- 2011-10-13 18:22:42 -0700 (Thu, 13 Oct 2011)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97433 => 97434)
--- trunk/Source/WebCore/ChangeLog 2011-10-14 01:16:52 UTC (rev 97433)
+++ trunk/Source/WebCore/ChangeLog 2011-10-14 01:22:42 UTC (rev 97434)
@@ -1,3 +1,19 @@
+2011-10-13 Simon Fraser <simon.fra...@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 <msab...@apple.com>
REGRESSION: High frequency memory warnings cause Safari to hog the CPU doing useless garbage collection
Modified: trunk/Source/WebCore/platform/PlatformScreen.h (97433 => 97434)
--- trunk/Source/WebCore/platform/PlatformScreen.h 2011-10-14 01:16:52 UTC (rev 97433)
+++ trunk/Source/WebCore/platform/PlatformScreen.h 2011-10-14 01:22:42 UTC (rev 97434)
@@ -31,8 +31,6 @@
#include <wtf/RefPtr.h>
#if PLATFORM(MAC)
-#include <QuartzCore/QuartzCore.h>
-
#ifdef __OBJC__
@class NSScreen;
@class NSWindow;
@@ -40,11 +38,10 @@
class NSScreen;
class NSWindow;
#endif
-typedef CGDirectDisplayID PlatformDisplayID;
-#else
-typedef uint64_t PlatformDisplayID;
#endif
+typedef uint32_t PlatformDisplayID;
+
namespace WebCore {
class FloatRect;
Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (97433 => 97434)
--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h 2011-10-14 01:16:52 UTC (rev 97433)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h 2011-10-14 01:22:42 UTC (rev 97434)
@@ -32,6 +32,10 @@
#include <wtf/Threading.h>
#include <wtf/Vector.h>
+#if PLATFORM(MAC)
+typedef struct __CVDisplayLink *CVDisplayLinkRef;
+#endif
+
namespace WebCore {
class DisplayRefreshMonitor;
@@ -101,8 +105,10 @@
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
Modified: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp (97433 => 97434)
--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp 2011-10-14 01:16:52 UTC (rev 97433)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp 2011-10-14 01:22:42 UTC (rev 97434)
@@ -35,20 +35,14 @@
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 @@
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 @@
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)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes