<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169299] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169299">169299</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-05-23 19:17:59 -0700 (Fri, 23 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>REGRESSION (iOS WebKit2): requestAnimationFrame fires more than once between layer tree commits
https://bugs.webkit.org/show_bug.cgi?id=132794
<rdar://problem/16877909>
Reviewed by Simon Fraser.
Virtualize DisplayRefreshMonitor so that WebKit2 can implement its own DisplayRefreshMonitor for UI-side compositing views.
This allows the synchronization of requestAnimationFrame callbacks with UI-side compositing painting.
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/ChromeClient.h:
(WebCore::ChromeClient::graphicsLayerFactory):
(WebCore::ChromeClient::createDisplayRefreshMonitor):
* platform/graphics/DisplayRefreshMonitorFactory.h: Added.
* platform/graphics/GraphicsLayerUpdater.cpp:
(WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor):
* platform/graphics/GraphicsLayerUpdater.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
* rendering/RenderLayerCompositor.h:
Give the ChromeClient a chance to provide us with a custom DisplayRefreshMonitor.
If it does not, we'll fall back to making a DisplayRefreshMonitorMac or
DisplayRefreshMonitorIOS depending on the platform.
* dom/ScriptedAnimationController.cpp:
* dom/ScriptedAnimationController.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/DisplayRefreshMonitorClient.cpp: Added.
* platform/graphics/DisplayRefreshMonitorClient.h: Added.
* platform/graphics/DisplayRefreshMonitorManager.cpp: Added.
* platform/graphics/DisplayRefreshMonitorManager.h: Added.
Split DisplayRefreshMonitor.cpp into one file per class.
Use references in a few places.
Remove some useless comments.
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
Use takeAny() and remove a FIXME about it not existing.
* platform/graphics/DisplayRefreshMonitorClient.cpp: Added.
(WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded):
Use an early return instead of having the whole function body in an if().
* platform/graphics/ios/DisplayRefreshMonitorIOS.h: Added.
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
* platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
* platform/graphics/mac/DisplayRefreshMonitorMac.h: Added.
Virtualize DisplayRefreshMonitorIOS and DisplayRefreshMonitorMac,
and move things specific to each of them out of DisplayRefreshMonitor itself.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createDisplayRefreshMonitor):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::graphicsLayerFactory):
(WebKit::DrawingArea::createDisplayRefreshMonitor):
Plumb the DisplayRefreshMonitor request through to the DrawingArea.
RemoteLayerTreeDrawingArea will implement and return a RemoteLayerTreeDisplayRefreshMonitor.
* WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h: Added.
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::create):
* WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm: Added.
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::~RemoteLayerTreeDisplayRefreshMonitor):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback):
When requesting a display refresh callback, schedule a layer commit.
It may end up being empty, but will still call us back with a didUpdate,
upon which we'll fire the callback.
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::createDisplayRefreshMonitor):
(WebKit::RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor):
Keep track of the set of DisplayRefreshMonitors.
(WebKit::RemoteLayerTreeDrawingArea::didUpdate):
Fire requestAnimationFrame callbacks once the UI process commits the new layer tree.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomScriptedAnimationControllercpp">trunk/Source/WebCore/dom/ScriptedAnimationController.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptedAnimationControllerh">trunk/Source/WebCore/dom/ScriptedAnimationController.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorcpp">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorh">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdatercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdaterh">trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosDisplayRefreshMonitorIOSmm">trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacDisplayRefreshMonitorMaccpp">trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorh">trunk/Source/WebCore/rendering/RenderLayerCompositor.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreacpp">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClientcpp">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClienth">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorManagercpp">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorManagerh">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosDisplayRefreshMonitorIOSh">trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacDisplayRefreshMonitorMach">trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h</a></li>
<li>trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/</li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitorh">trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitormm">trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/ChangeLog        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2014-05-23 Tim Horton <timothy_horton@apple.com>
+
+ REGRESSION (iOS WebKit2): requestAnimationFrame fires more than once between layer tree commits
+ https://bugs.webkit.org/show_bug.cgi?id=132794
+ <rdar://problem/16877909>
+
+ Reviewed by Simon Fraser.
+
+ Virtualize DisplayRefreshMonitor so that WebKit2 can implement its own DisplayRefreshMonitor for UI-side compositing views.
+ This allows the synchronization of requestAnimationFrame callbacks with UI-side compositing painting.
+
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::graphicsLayerFactory):
+ (WebCore::ChromeClient::createDisplayRefreshMonitor):
+ * platform/graphics/DisplayRefreshMonitorFactory.h: Added.
+ * platform/graphics/GraphicsLayerUpdater.cpp:
+ (WebCore::GraphicsLayerUpdater::createDisplayRefreshMonitor):
+ * platform/graphics/GraphicsLayerUpdater.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
+ * rendering/RenderLayerCompositor.h:
+ Give the ChromeClient a chance to provide us with a custom DisplayRefreshMonitor.
+ If it does not, we'll fall back to making a DisplayRefreshMonitorMac or
+ DisplayRefreshMonitorIOS depending on the platform.
+
+ * dom/ScriptedAnimationController.cpp:
+ * dom/ScriptedAnimationController.h:
+ * platform/graphics/DisplayRefreshMonitor.cpp:
+ * platform/graphics/DisplayRefreshMonitor.h:
+ * platform/graphics/DisplayRefreshMonitorClient.cpp: Added.
+ * platform/graphics/DisplayRefreshMonitorClient.h: Added.
+ * platform/graphics/DisplayRefreshMonitorManager.cpp: Added.
+ * platform/graphics/DisplayRefreshMonitorManager.h: Added.
+ Split DisplayRefreshMonitor.cpp into one file per class.
+ Use references in a few places.
+ Remove some useless comments.
+
+ * platform/graphics/DisplayRefreshMonitor.cpp:
+ (WebCore::DisplayRefreshMonitor::displayDidRefresh):
+ Use takeAny() and remove a FIXME about it not existing.
+
+ * platform/graphics/DisplayRefreshMonitorClient.cpp: Added.
+ (WebCore::DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded):
+ Use an early return instead of having the whole function body in an if().
+
+ * platform/graphics/ios/DisplayRefreshMonitorIOS.h: Added.
+ * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
+ * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
+ * platform/graphics/mac/DisplayRefreshMonitorMac.h: Added.
+ Virtualize DisplayRefreshMonitorIOS and DisplayRefreshMonitorMac,
+ and move things specific to each of them out of DisplayRefreshMonitor itself.
+
</ins><span class="cx"> 2014-05-23 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> CSS JIT: Apply backtracking optimization to adjacent backtracking
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -875,6 +875,9 @@
</span><span class="cx"> __ZN7WebCore21BlobDataFileReferenceD2Ev
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0EN3WTF6StringEE4copyERKS2_
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_19IDBDatabaseMetadataEE4copyERKS1_
</span><ins>+__ZN7WebCore21DisplayRefreshMonitor46handleDisplayRefreshedNotificationOnMainThreadEPv
+__ZN7WebCore21DisplayRefreshMonitorC2Ej
+__ZN7WebCore21DisplayRefreshMonitorD2Ev
</ins><span class="cx"> __ZN7WebCore21MemoryPressureHandler12ReliefLogger16s_loggingEnabledE
</span><span class="cx"> __ZN7WebCore21MemoryPressureHandler13releaseMemoryEb
</span><span class="cx"> __ZN7WebCore21MemoryPressureHandler7installEv
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1068,6 +1068,11 @@
</span><span class="cx">                 2D0B4AAC18DA1CCD00434DE1 /* IOSurface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */; };
</span><span class="cx">                 2D25396218CE7F6200270222 /* ImageControlsButtonElementMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */; };
</span><span class="cx">                 2D25396318CE7F6200270222 /* ImageControlsButtonElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */; };
</span><ins>+                2D29ECC5192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D29ECC1192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp */; };
+                2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                2D29ECC7192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D29ECC3192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp */; };
+                2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC4192ECC8300984B78 /* DisplayRefreshMonitorManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                2D29ECCA192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC9192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h */; };
</ins><span class="cx">                 2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4441917915C00034184 /* WebActionDisablingCALayerDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D3EF4491917915C00034184 /* WebActionDisablingCALayerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4451917915C00034184 /* WebActionDisablingCALayerDelegate.mm */; };
</span><span class="lines">@@ -1098,6 +1103,7 @@
</span><span class="cx">                 2D9A247515B9C2E300D34527 /* DOMDOMSecurityPolicyInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */; };
</span><span class="cx">                 2D9A247615B9C2F400D34527 /* DOMDOMSecurityPolicy.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2D9A247015B9C29500D34527 /* DOMDOMSecurityPolicy.h */; };
</span><span class="cx">                 2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
</span><ins>+                2DE70023192FE82A00B0975C /* DisplayRefreshMonitorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */; };
</ins><span class="cx">                 2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; };
</span><span class="cx">                 2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; };
</span><span class="cx">                 2E0888E6114884E200AF4265 /* JSDOMFormDataCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */; };
</span><span class="lines">@@ -8016,6 +8022,11 @@
</span><span class="cx">                 2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSurface.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsButtonElementMac.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsButtonElementMac.h; sourceTree = "<group>"; };
</span><ins>+                2D29ECC1192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorClient.cpp; sourceTree = "<group>"; };
+                2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorClient.h; sourceTree = "<group>"; };
+                2D29ECC3192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorManager.cpp; sourceTree = "<group>"; };
+                2D29ECC4192ECC8300984B78 /* DisplayRefreshMonitorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorManager.h; sourceTree = "<group>"; };
+                2D29ECC9192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorIOS.h; sourceTree = "<group>"; };
</ins><span class="cx">                 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossfadeGeneratedImage.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossfadeGeneratedImage.h; sourceTree = "<group>"; };
</span><span class="cx">                 2D2FC0561460CD6F00263633 /* GradientImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientImage.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -8045,6 +8056,7 @@
</span><span class="cx">                 2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMSecurityPolicyInternal.h; sourceTree = "<group>"; };
</span><span class="cx">                 2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMDOMSecurityPolicy.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */ = {isa = PBXFileReference; lastKnownFileType = file; path = linearSRGB.icc; sourceTree = "<group>"; };
</span><ins>+                2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorMac.h; sourceTree = "<group>"; };
</ins><span class="cx">                 2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = "<group>"; };
</span><span class="cx">                 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2E0888D31148848A00AF4265 /* JSDOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFormData.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -15558,6 +15570,7 @@
</span><span class="cx">                 441AF0A70EBA7BBF0044ED4B /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                2D29ECC9192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h */,
</ins><span class="cx">                                 0F97A657155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm */,
</span><span class="cx">                                 3727DFD4142AAE4500D449CB /* FontCacheIOS.mm */,
</span><span class="cx">                                 C58361A71744523F00173511 /* FontServicesIOS.h */,
</span><span class="lines">@@ -20131,6 +20144,7 @@
</span><span class="cx">                                 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */,
</span><span class="cx">                                 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */,
</span><span class="cx">                                 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */,
</span><ins>+                                2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */,
</ins><span class="cx">                                 49AF2D6B14435D210016A784 /* DisplayRefreshMonitorMac.cpp */,
</span><span class="cx">                                 B275354B0B053814002CE64F /* FloatPointMac.mm */,
</span><span class="cx">                                 B275354C0B053814002CE64F /* FloatRectMac.mm */,
</span><span class="lines">@@ -20191,6 +20205,10 @@
</span><span class="cx">                                 A8CB41020E85B8A50032C4F0 /* DashArray.h */,
</span><span class="cx">                                 49FC7A4F1444AF5F00A5D864 /* DisplayRefreshMonitor.cpp */,
</span><span class="cx">                                 49AF2D6814435D050016A784 /* DisplayRefreshMonitor.h */,
</span><ins>+                                2D29ECC1192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp */,
+                                2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */,
+                                2D29ECC3192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp */,
+                                2D29ECC4192ECC8300984B78 /* DisplayRefreshMonitorManager.h */,
</ins><span class="cx">                                 6E67D2A81280E8BD008758F7 /* Extensions3D.h */,
</span><span class="cx">                                 B275353A0B053814002CE64F /* FloatPoint.cpp */,
</span><span class="cx">                                 B275353B0B053814002CE64F /* FloatPoint.h */,
</span><span class="lines">@@ -23171,6 +23189,7 @@
</span><span class="cx">                                 BE88E0D91715D2A200658D98 /* AudioTrack.h in Headers */,
</span><span class="cx">                                 BE88E0DC1715D2A200658D98 /* AudioTrackList.h in Headers */,
</span><span class="cx">                                 CD8B5A4C180E17C0008B8E65 /* AudioTrackMediaSource.h in Headers */,
</span><ins>+                                2DE70023192FE82A00B0975C /* DisplayRefreshMonitorMac.h in Headers */,
</ins><span class="cx">                                 BEF29EEB1715DD0900C4B4C9 /* AudioTrackPrivate.h in Headers */,
</span><span class="cx">                                 CDE3A85417F5FCE600C5BE20 /* AudioTrackPrivateAVF.h in Headers */,
</span><span class="cx">                                 CDE3A85817F6020400C5BE20 /* AudioTrackPrivateAVFObjC.h in Headers */,
</span><span class="lines">@@ -23318,6 +23337,7 @@
</span><span class="cx">                                 A584FE351864D5AF00843B10 /* CommandLineAPIHost.h in Headers */,
</span><span class="cx">                                 A584FE2C1863870F00843B10 /* CommandLineAPIModule.h in Headers */,
</span><span class="cx">                                 A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
</span><ins>+                                2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */,
</ins><span class="cx">                                 6550B6A2099DF0270090D781 /* Comment.h in Headers */,
</span><span class="cx">                                 E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
</span><span class="cx">                                 37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */,
</span><span class="lines">@@ -23670,6 +23690,7 @@
</span><span class="cx">                                 85E7119D0AC5D5350053270F /* DOMHTMLBaseElementInternal.h in Headers */,
</span><span class="cx">                                 85ECBEED0AA7626900544F0B /* DOMHTMLBaseFontElement.h in Headers */,
</span><span class="cx">                                 85E7119E0AC5D5350053270F /* DOMHTMLBaseFontElementInternal.h in Headers */,
</span><ins>+                                2D29ECCA192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h in Headers */,
</ins><span class="cx">                                 859A9C490AA5E3BD00B694B2 /* DOMHTMLBodyElement.h in Headers */,
</span><span class="cx">                                 85E7119F0AC5D5350053270F /* DOMHTMLBodyElementInternal.h in Headers */,
</span><span class="cx">                                 85183B420AA6926100F19FA3 /* DOMHTMLBRElement.h in Headers */,
</span><span class="lines">@@ -24864,6 +24885,7 @@
</span><span class="cx">                                 B2FA3DAD0AB75A6F000E5AC4 /* JSSVGMatrix.h in Headers */,
</span><span class="cx">                                 B2FA3DAF0AB75A6F000E5AC4 /* JSSVGMetadataElement.h in Headers */,
</span><span class="cx">                                 B27B282A0CEF0C0700D39D54 /* JSSVGMissingGlyphElement.h in Headers */,
</span><ins>+                                2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */,
</ins><span class="cx">                                 4496E3A0139813A5003EE32A /* JSSVGMPathElement.h in Headers */,
</span><span class="cx">                                 8542A7970AE5C94300DF58DF /* JSSVGNumber.h in Headers */,
</span><span class="cx">                                 B2FA3DB10AB75A6F000E5AC4 /* JSSVGNumberList.h in Headers */,
</span><span class="lines">@@ -28470,6 +28492,7 @@
</span><span class="cx">                                 BE8EF04C171C9014009B48C3 /* JSVideoTrackList.cpp in Sources */,
</span><span class="cx">                                 BE6DF70D171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp in Sources */,
</span><span class="cx">                                 9703E1BF15DC4E37001F24C8 /* JSVoidCallback.cpp in Sources */,
</span><ins>+                                2D29ECC5192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp in Sources */,
</ins><span class="cx">                                 BE20508118A460BC0080647E /* JSVTTCue.cpp in Sources */,
</span><span class="cx">                                 FD82D7F713D4C8BD004E4372 /* JSWaveShaperNode.cpp in Sources */,
</span><span class="cx">                                 A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */,
</span><span class="lines">@@ -29144,6 +29167,7 @@
</span><span class="cx">                                 93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */,
</span><span class="cx">                                 93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */,
</span><span class="cx">                                 A1E1154813015C5D0054AC8C /* SpotLightSource.cpp in Sources */,
</span><ins>+                                2D29ECC7192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp in Sources */,
</ins><span class="cx">                                 97BC6A3E1505F081001B74AC /* SQLException.cpp in Sources */,
</span><span class="cx">                                 1A2E6E7A0CC556D5004A2062 /* SQLiteAuthorizer.cpp in Sources */,
</span><span class="cx">                                 1A2246490CC98DDB00C05240 /* SQLiteDatabase.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptedAnimationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(REQUEST_ANIMATION_FRAME)
</span><span class="cx">
</span><ins>+#include "DisplayRefreshMonitor.h"
+#include "DisplayRefreshMonitorManager.h"
</ins><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "DocumentLoader.h"
</span><span class="cx"> #include "FrameView.h"
</span><span class="lines">@@ -171,7 +173,7 @@
</span><span class="cx"> if (m_document->settings() && !m_document->settings()->requestAnimationFrameEnabled())
</span><span class="cx"> return;
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>- DisplayRefreshMonitorManager::sharedManager()->windowScreenDidChange(displayID, this);
</del><ins>+ DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, this);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(displayID);
</span><span class="cx"> #endif
</span><span class="lines">@@ -185,7 +187,7 @@
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_TIMER)
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx"> if (!m_isUsingTimer && !m_isThrottled) {
</span><del>- if (DisplayRefreshMonitorManager::sharedManager()->scheduleAnimation(this))
</del><ins>+ if (DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(this))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_isUsingTimer = true;
</span><span class="lines">@@ -223,7 +225,14 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+PassRefPtr<DisplayRefreshMonitor> ScriptedAnimationController::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
+{
+ return m_document->page()->chrome().client().createDisplayRefreshMonitor(displayID);
+}
+#endif
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptedAnimationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptedAnimationController.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -30,7 +30,9 @@
</span><span class="cx"> #include "DOMTimeStamp.h"
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_TIMER)
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-#include "DisplayRefreshMonitor.h"
</del><ins>+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "DisplayRefreshMonitorClient.h"
</ins><span class="cx"> #endif
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -89,6 +91,7 @@
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx"> // Override for DisplayRefreshMonitorClient
</span><span class="cx"> virtual void displayRefreshFired(double timestamp) override;
</span><ins>+ virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
</ins><span class="cx">
</span><span class="cx"> bool m_isUsingTimer;
</span><span class="cx"> bool m_isThrottled;
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">
</span><span class="cx"> #include "AXObjectCache.h"
</span><span class="cx"> #include "Cursor.h"
</span><ins>+#include "DisplayRefreshMonitor.h"
</ins><span class="cx"> #include "FocusDirection.h"
</span><span class="cx"> #include "FrameLoader.h"
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="lines">@@ -279,8 +280,12 @@
</span><span class="cx"> virtual bool shouldPaintEntireContents() const { return false; }
</span><span class="cx">
</span><span class="cx"> // Allows ports to customize the type of graphics layers created by this page.
</span><del>- virtual GraphicsLayerFactory* graphicsLayerFactory() const { return 0; }
</del><ins>+ virtual GraphicsLayerFactory* graphicsLayerFactory() const { return nullptr; }
</ins><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const { return nullptr; }
+#endif
+
</ins><span class="cx"> // Pass 0 as the GraphicsLayer to detatch the root layer.
</span><span class="cx"> virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*) = 0;
</span><span class="cx"> // Sets a flag to specify that the next time content is drawn to the window,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -24,32 +24,30 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><ins>+#include "DisplayRefreshMonitor.h"
</ins><span class="cx">
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">
</span><del>-#include "DisplayRefreshMonitor.h"
-#include <wtf/CurrentTime.h>
-#include <wtf/Ref.h>
</del><ins>+#include "DisplayRefreshMonitorClient.h"
+#include "DisplayRefreshMonitorIOS.h"
+#include "DisplayRefreshMonitorMac.h"
+#include "DisplayRefreshMonitorManager.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-DisplayRefreshMonitorClient::DisplayRefreshMonitorClient()
- : m_scheduled(false)
- , m_displayIDIsSet(false)
</del><ins>+PassRefPtr<DisplayRefreshMonitor> DisplayRefreshMonitor::create(DisplayRefreshMonitorClient* client)
</ins><span class="cx"> {
</span><del>-}
</del><ins>+ PlatformDisplayID displayID = client->displayID();
</ins><span class="cx">
</span><del>-DisplayRefreshMonitorClient::~DisplayRefreshMonitorClient()
-{
- DisplayRefreshMonitorManager::sharedManager()->unregisterClient(this);
-}
</del><ins>+ if (RefPtr<DisplayRefreshMonitor> monitor = client->createDisplayRefreshMonitor(displayID))
+ return monitor.release();
</ins><span class="cx">
</span><del>-void DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(double timestamp)
-{
- if (m_scheduled) {
- m_scheduled = false;
- displayRefreshFired(timestamp);
- }
</del><ins>+#if PLATFORM(MAC)
+ return DisplayRefreshMonitorMac::create(displayID);
+#endif
+#if PLATFORM(IOS)
+ return DisplayRefreshMonitorIOS::create(displayID);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DisplayRefreshMonitor::DisplayRefreshMonitor(PlatformDisplayID displayID)
</span><span class="lines">@@ -60,12 +58,13 @@
</span><span class="cx"> , m_unscheduledFireCount(0)
</span><span class="cx"> , m_displayID(displayID)
</span><span class="cx"> , m_clientsToBeNotified(nullptr)
</span><del>-#if PLATFORM(COCOA)
- , m_displayLink(0)
-#endif
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+DisplayRefreshMonitor::~DisplayRefreshMonitor()
+{
+}
+
</ins><span class="cx"> void DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread(void* data)
</span><span class="cx"> {
</span><span class="cx"> DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data);
</span><span class="lines">@@ -87,6 +86,7 @@
</span><span class="cx"> void DisplayRefreshMonitor::displayDidRefresh()
</span><span class="cx"> {
</span><span class="cx"> double monotonicAnimationStartTime;
</span><ins>+
</ins><span class="cx"> {
</span><span class="cx"> MutexLocker lock(m_mutex);
</span><span class="cx"> if (!m_scheduled)
</span><span class="lines">@@ -107,12 +107,7 @@
</span><span class="cx"> HashSet<DisplayRefreshMonitorClient*> clientsToBeNotified = m_clients;
</span><span class="cx"> m_clientsToBeNotified = &clientsToBeNotified;
</span><span class="cx"> while (!clientsToBeNotified.isEmpty()) {
</span><del>- // Take a random client out of the set. Ordering doesn't matter.
- // FIXME: Would read more cleanly if HashSet had a take function.
- auto it = clientsToBeNotified.begin();
- DisplayRefreshMonitorClient* client = *it;
- clientsToBeNotified.remove(it);
-
</del><ins>+ DisplayRefreshMonitorClient* client = clientsToBeNotified.takeAny();
</ins><span class="cx"> client->fireDisplayRefreshIfNeeded(monotonicAnimationStartTime);
</span><span class="cx">
</span><span class="cx"> // This checks if this function was reentered. In that case, stop iterating
</span><span class="lines">@@ -120,6 +115,7 @@
</span><span class="cx"> if (m_clientsToBeNotified != &clientsToBeNotified)
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> if (m_clientsToBeNotified == &clientsToBeNotified)
</span><span class="cx"> m_clientsToBeNotified = nullptr;
</span><span class="cx">
</span><span class="lines">@@ -128,84 +124,9 @@
</span><span class="cx"> m_previousFrameDone = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- DisplayRefreshMonitorManager::sharedManager()->displayDidRefresh(this);
</del><ins>+ DisplayRefreshMonitorManager::sharedManager().displayDidRefresh(this);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-DisplayRefreshMonitorManager* DisplayRefreshMonitorManager::sharedManager()
-{
- DEPRECATED_DEFINE_STATIC_LOCAL(DisplayRefreshMonitorManager, manager, ());
- return &manager;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-DisplayRefreshMonitor* DisplayRefreshMonitorManager::ensureMonitorForClient(DisplayRefreshMonitorClient* client)
-{
- DisplayRefreshMonitorMap::iterator it = m_monitors.find(client->m_displayID);
- if (it == m_monitors.end()) {
- RefPtr<DisplayRefreshMonitor> monitor = DisplayRefreshMonitor::create(client->m_displayID);
- monitor->addClient(client);
- DisplayRefreshMonitor* result = monitor.get();
- m_monitors.add(client->m_displayID, monitor.release());
- return result;
- }
- it->value->addClient(client);
- return it->value.get();
-}
-
-void DisplayRefreshMonitorManager::registerClient(DisplayRefreshMonitorClient* client)
-{
- if (!client->m_displayIDIsSet)
- return;
-
- ensureMonitorForClient(client);
-}
-
-void DisplayRefreshMonitorManager::unregisterClient(DisplayRefreshMonitorClient* client)
-{
- if (!client->m_displayIDIsSet)
- return;
-
- DisplayRefreshMonitorMap::iterator it = m_monitors.find(client->m_displayID);
- if (it == m_monitors.end())
- return;
-
- DisplayRefreshMonitor* monitor = it->value.get();
- if (monitor->removeClient(client)) {
- if (!monitor->hasClients())
- m_monitors.remove(it);
- }
-}
-
-bool DisplayRefreshMonitorManager::scheduleAnimation(DisplayRefreshMonitorClient* client)
-{
- if (!client->m_displayIDIsSet)
- return false;
-
- DisplayRefreshMonitor* monitor = ensureMonitorForClient(client);
-
- client->m_scheduled = true;
- return monitor->requestRefreshCallback();
-}
-
-void DisplayRefreshMonitorManager::displayDidRefresh(DisplayRefreshMonitor* monitor)
-{
- if (monitor->shouldBeTerminated()) {
- ASSERT(m_monitors.contains(monitor->displayID()));
- m_monitors.remove(monitor->displayID());
- }
-}
-
-void DisplayRefreshMonitorManager::windowScreenDidChange(PlatformDisplayID displayID, DisplayRefreshMonitorClient* client)
-{
- if (client->m_displayIDIsSet && client->m_displayID == displayID)
- return;
-
- unregisterClient(client);
- client->setDisplayID(displayID);
- registerClient(client);
- if (client->m_scheduled)
- scheduleAnimation(client);
-}
-
-}
-
</del><span class="cx"> #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,65 +29,24 @@
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">
</span><span class="cx"> #include "PlatformScreen.h"
</span><del>-#include <wtf/HashMap.h>
</del><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx"> #include <wtf/Threading.h>
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
-typedef struct __CVDisplayLink *CVDisplayLinkRef;
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class DisplayAnimationClient;
</span><del>-class DisplayRefreshMonitor;
-class DisplayRefreshMonitorManager;
</del><ins>+class DisplayRefreshMonitorClient;
</ins><span class="cx">
</span><del>-//
-// Abstract virtual client which receives refresh fired messages on the main thread
-//
-class DisplayRefreshMonitorClient {
- friend class DisplayRefreshMonitor;
- friend class DisplayRefreshMonitorManager;
-
-public:
- DisplayRefreshMonitorClient();
- virtual ~DisplayRefreshMonitorClient();
-
- virtual void displayRefreshFired(double timestamp) = 0;
-
-private:
- void fireDisplayRefreshIfNeeded(double timestamp);
-
- void setDisplayID(PlatformDisplayID displayID)
- {
- m_displayID = displayID;
- m_displayIDIsSet = true;
- }
-
- bool m_scheduled;
- bool m_displayIDIsSet;
- PlatformDisplayID m_displayID;
-};
-
-//
-// Monitor for display refresh messages for a given screen
-//
-
</del><span class="cx"> class DisplayRefreshMonitor : public RefCounted<DisplayRefreshMonitor> {
</span><span class="cx"> public:
</span><del>- static PassRefPtr<DisplayRefreshMonitor> create(PlatformDisplayID displayID)
- {
- return adoptRef(new DisplayRefreshMonitor(displayID));
- }
</del><ins>+ static PassRefPtr<DisplayRefreshMonitor> create(DisplayRefreshMonitorClient*);
+ virtual ~DisplayRefreshMonitor();
</ins><span class="cx">
</span><del>- ~DisplayRefreshMonitor();
-
</del><span class="cx"> // Return true if callback request was scheduled, false if it couldn't be
</span><span class="cx"> // (e.g., hardware refresh is not available)
</span><del>- bool requestRefreshCallback();
</del><ins>+ virtual bool requestRefreshCallback() = 0;
</ins><span class="cx"> void windowScreenDidChange(PlatformDisplayID);
</span><span class="cx">
</span><span class="cx"> bool hasClients() const { return m_clients.size(); }
</span><span class="lines">@@ -101,12 +60,26 @@
</span><span class="cx"> const int maxInactiveFireCount = 10;
</span><span class="cx"> return !m_scheduled && m_unscheduledFireCount > maxInactiveFireCount;
</span><span class="cx"> }
</span><del>-
-private:
</del><ins>+
+ bool isActive() const { return m_active; }
+ void setIsActive(bool active) { m_active = active; }
+
+ bool isScheduled() const { return m_scheduled; }
+ void setIsScheduled(bool scheduled) { m_scheduled = scheduled; }
+
+ bool isPreviousFrameDone() const { return m_previousFrameDone; }
+ void setIsPreviousFrameDone(bool done) { m_previousFrameDone = done; }
+
+ void setMonotonicAnimationStartTime(double startTime) { m_monotonicAnimationStartTime = startTime; }
+
+ Mutex& mutex() { return m_mutex; }
+
+protected:
</ins><span class="cx"> explicit DisplayRefreshMonitor(PlatformDisplayID);
</span><ins>+ static void handleDisplayRefreshedNotificationOnMainThread(void* data);
</ins><span class="cx">
</span><ins>+private:
</ins><span class="cx"> void displayDidRefresh();
</span><del>- static void handleDisplayRefreshedNotificationOnMainThread(void* data);
</del><span class="cx">
</span><span class="cx"> double m_monotonicAnimationStartTime;
</span><span class="cx"> bool m_active;
</span><span class="lines">@@ -118,52 +91,8 @@
</span><span class="cx">
</span><span class="cx"> HashSet<DisplayRefreshMonitorClient*> m_clients;
</span><span class="cx"> HashSet<DisplayRefreshMonitorClient*>* m_clientsToBeNotified;
</span><del>-
-#if PLATFORM(MAC)
-public:
- void displayLinkFired(double nowSeconds, double outputTimeSeconds);
-private:
- CVDisplayLinkRef m_displayLink;
-#endif
-
-#if PLATFORM(IOS)
-public:
- void displayLinkFired(double nowSeconds);
-private:
- void* m_displayLink;
-#endif
</del><span class="cx"> };
</span><span class="cx">
</span><del>-//
-// Singleton manager for all the DisplayRefreshMonitors. This is the interface to the
-// outside world. It distributes requests to the appropriate monitor. When the display
-// refresh event fires, the passed DisplayRefreshMonitorClient is called directly on
-// the main thread.
-//
-class DisplayRefreshMonitorManager {
-public:
- static DisplayRefreshMonitorManager* sharedManager();
-
- void registerClient(DisplayRefreshMonitorClient*);
- void unregisterClient(DisplayRefreshMonitorClient*);
-
- bool scheduleAnimation(DisplayRefreshMonitorClient*);
- void windowScreenDidChange(PlatformDisplayID, DisplayRefreshMonitorClient*);
-
-private:
- friend class DisplayRefreshMonitor;
- void displayDidRefresh(DisplayRefreshMonitor*);
-
- DisplayRefreshMonitorManager() { }
- DisplayRefreshMonitor* ensureMonitorForClient(DisplayRefreshMonitorClient*);
-
- // We know nothing about the values of PlatformDisplayIDs, so use UnsignedWithZeroKeyHashTraits.
- // FIXME: Since we know nothing about these values, this is not sufficient.
- // Even with UnsignedWithZeroKeyHashTraits, there are still two special values used for empty and deleted hash table slots.
- typedef HashMap<uint64_t, RefPtr<DisplayRefreshMonitor>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> DisplayRefreshMonitorMap;
- DisplayRefreshMonitorMap m_monitors;
-};
-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClientcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplayRefreshMonitorClient.h"
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+#include "DisplayRefreshMonitorManager.h"
+
+namespace WebCore {
+
+DisplayRefreshMonitorClient::DisplayRefreshMonitorClient()
+ : m_scheduled(false)
+ , m_displayIDIsSet(false)
+{
+}
+
+DisplayRefreshMonitorClient::~DisplayRefreshMonitorClient()
+{
+ DisplayRefreshMonitorManager::sharedManager().unregisterClient(this);
+}
+
+void DisplayRefreshMonitorClient::fireDisplayRefreshIfNeeded(double timestamp)
+{
+ if (!m_scheduled)
+ return;
+
+ m_scheduled = false;
+ displayRefreshFired(timestamp);
+}
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClienth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DisplayRefreshMonitorClient_h
+#define DisplayRefreshMonitorClient_h
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "PlatformScreen.h"
+
+namespace WebCore {
+
+class DisplayRefreshMonitor;
+class DisplayRefreshMonitorManager;
+
+class DisplayRefreshMonitorClient {
+public:
+ DisplayRefreshMonitorClient();
+ virtual ~DisplayRefreshMonitorClient();
+
+ // Always called on the main thread.
+ virtual void displayRefreshFired(double timestamp) = 0;
+
+ virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const = 0;
+
+ PlatformDisplayID displayID() const { return m_displayID; }
+ bool hasDisplayID() const { return m_displayIDIsSet; }
+ void setDisplayID(PlatformDisplayID displayID)
+ {
+ m_displayID = displayID;
+ m_displayIDIsSet = true;
+ }
+
+ void setIsScheduled(bool isScheduled) { m_scheduled = isScheduled; }
+ bool isScheduled() const { return m_scheduled; }
+
+ void fireDisplayRefreshIfNeeded(double timestamp);
+
+private:
+ bool m_scheduled;
+ bool m_displayIDIsSet;
+ PlatformDisplayID m_displayID;
+};
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,118 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplayRefreshMonitorManager.h"
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+#include "DisplayRefreshMonitorClient.h"
+#include <wtf/CurrentTime.h>
+
+namespace WebCore {
+
+DisplayRefreshMonitorManager::~DisplayRefreshMonitorManager()
+{
+}
+
+DisplayRefreshMonitorManager& DisplayRefreshMonitorManager::sharedManager()
+{
+ static NeverDestroyed<DisplayRefreshMonitorManager> manager;
+ return manager.get();
+}
+
+DisplayRefreshMonitor* DisplayRefreshMonitorManager::ensureMonitorForClient(DisplayRefreshMonitorClient* client)
+{
+ DisplayRefreshMonitorMap::iterator it = m_monitors.find(client->displayID());
+ if (it == m_monitors.end()) {
+ RefPtr<DisplayRefreshMonitor> monitor = DisplayRefreshMonitor::create(client);
+ monitor->addClient(client);
+ DisplayRefreshMonitor* result = monitor.get();
+ m_monitors.add(client->displayID(), monitor.release());
+ return result;
+ }
+ it->value->addClient(client);
+ return it->value.get();
+}
+
+void DisplayRefreshMonitorManager::registerClient(DisplayRefreshMonitorClient* client)
+{
+ if (!client->hasDisplayID())
+ return;
+
+ ensureMonitorForClient(client);
+}
+
+void DisplayRefreshMonitorManager::unregisterClient(DisplayRefreshMonitorClient* client)
+{
+ if (!client->hasDisplayID())
+ return;
+
+ DisplayRefreshMonitorMap::iterator it = m_monitors.find(client->displayID());
+ if (it == m_monitors.end())
+ return;
+
+ DisplayRefreshMonitor* monitor = it->value.get();
+ if (monitor->removeClient(client)) {
+ if (!monitor->hasClients())
+ m_monitors.remove(it);
+ }
+}
+
+bool DisplayRefreshMonitorManager::scheduleAnimation(DisplayRefreshMonitorClient* client)
+{
+ if (!client->hasDisplayID())
+ return false;
+
+ DisplayRefreshMonitor* monitor = ensureMonitorForClient(client);
+
+ client->setIsScheduled(true);
+ return monitor->requestRefreshCallback();
+}
+
+void DisplayRefreshMonitorManager::displayDidRefresh(DisplayRefreshMonitor* monitor)
+{
+ if (monitor->shouldBeTerminated()) {
+ ASSERT(m_monitors.contains(monitor->displayID()));
+ m_monitors.remove(monitor->displayID());
+ }
+}
+
+void DisplayRefreshMonitorManager::windowScreenDidChange(PlatformDisplayID displayID, DisplayRefreshMonitorClient* client)
+{
+ if (client->hasDisplayID() && client->displayID() == displayID)
+ return;
+
+ unregisterClient(client);
+ client->setDisplayID(displayID);
+ registerClient(client);
+ if (client->isScheduled())
+ scheduleAnimation(client);
+}
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DisplayRefreshMonitorManager_h
+#define DisplayRefreshMonitorManager_h
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+#include "PlatformScreen.h"
+#include <wtf/HashMap.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class DisplayRefreshMonitorManager {
+ friend class NeverDestroyed<DisplayRefreshMonitorManager>;
+public:
+ static DisplayRefreshMonitorManager& sharedManager();
+
+ void registerClient(DisplayRefreshMonitorClient*);
+ void unregisterClient(DisplayRefreshMonitorClient*);
+
+ bool scheduleAnimation(DisplayRefreshMonitorClient*);
+ void windowScreenDidChange(PlatformDisplayID, DisplayRefreshMonitorClient*);
+
+private:
+ friend class DisplayRefreshMonitor;
+ void displayDidRefresh(DisplayRefreshMonitor*);
+
+ DisplayRefreshMonitorManager() { }
+ virtual ~DisplayRefreshMonitorManager();
+
+ DisplayRefreshMonitor* ensureMonitorForClient(DisplayRefreshMonitorClient*);
+
+ // We know nothing about the values of PlatformDisplayIDs, so use UnsignedWithZeroKeyHashTraits.
+ // FIXME: Since we know nothing about these values, this is not sufficient.
+ // Even with UnsignedWithZeroKeyHashTraits, there are still two special values used for empty and deleted hash table slots.
+ typedef HashMap<uint64_t, RefPtr<DisplayRefreshMonitor>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> DisplayRefreshMonitorMap;
+ DisplayRefreshMonitorMap m_monitors;
+};
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdatercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -24,9 +24,9 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><del>-
</del><span class="cx"> #include "GraphicsLayerUpdater.h"
</span><span class="cx">
</span><ins>+#include "DisplayRefreshMonitorManager.h"
</ins><span class="cx"> #include "GraphicsLayer.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -36,9 +36,9 @@
</span><span class="cx"> , m_scheduled(false)
</span><span class="cx"> {
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>- DisplayRefreshMonitorManager::sharedManager()->registerClient(this);
- DisplayRefreshMonitorManager::sharedManager()->windowScreenDidChange(displayID, this);
- DisplayRefreshMonitorManager::sharedManager()->scheduleAnimation(this);
</del><ins>+ DisplayRefreshMonitorManager::sharedManager().registerClient(this);
+ DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, this);
+ DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(this);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(displayID);
</span><span class="cx"> #endif
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>- DisplayRefreshMonitorManager::sharedManager()->scheduleAnimation(this);
</del><ins>+ DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(this);
</ins><span class="cx"> #endif
</span><span class="cx"> m_scheduled = true;
</span><span class="cx"> }
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> void GraphicsLayerUpdater::screenDidChange(PlatformDisplayID displayID)
</span><span class="cx"> {
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>- DisplayRefreshMonitorManager::sharedManager()->windowScreenDidChange(displayID, this);
</del><ins>+ DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, this);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(displayID);
</span><span class="cx"> #endif
</span><span class="lines">@@ -78,4 +78,11 @@
</span><span class="cx"> m_client->flushLayersSoon(this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+PassRefPtr<DisplayRefreshMonitor> GraphicsLayerUpdater::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
+{
+ return m_client ? m_client->createDisplayRefreshMonitor(displayID) : nullptr;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdaterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #ifndef GraphicsLayerUpdater_h
</span><span class="cx"> #define GraphicsLayerUpdater_h
</span><span class="cx">
</span><del>-#include "DisplayRefreshMonitor.h"
</del><ins>+#include "DisplayRefreshMonitorClient.h"
</ins><span class="cx"> #include "PlatformScreen.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -37,6 +37,9 @@
</span><span class="cx"> public:
</span><span class="cx"> virtual ~GraphicsLayerUpdaterClient() { }
</span><span class="cx"> virtual void flushLayersSoon(GraphicsLayerUpdater*) = 0;
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const = 0;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class GraphicsLayerUpdater
</span><span class="lines">@@ -51,6 +54,10 @@
</span><span class="cx"> void scheduleUpdate();
</span><span class="cx"> void screenDidChange(PlatformDisplayID);
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ virtual PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> virtual void displayRefreshFired(double timestamp);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosDisplayRefreshMonitorIOSh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.h (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.h         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DisplayRefreshMonitorIOS_h
+#define DisplayRefreshMonitorIOS_h
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS WebDisplayLinkHandler;
+
+namespace WebCore {
+
+class DisplayRefreshMonitorIOS : public DisplayRefreshMonitor {
+public:
+ static PassRefPtr<DisplayRefreshMonitorIOS> create(PlatformDisplayID displayID)
+ {
+ return adoptRef(new DisplayRefreshMonitorIOS(displayID));
+ }
+
+ virtual ~DisplayRefreshMonitorIOS();
+
+ void displayLinkFired(double nowSeconds);
+ virtual bool requestRefreshCallback() override;
+
+private:
+ explicit DisplayRefreshMonitorIOS(PlatformDisplayID);
+ RetainPtr<WebDisplayLinkHandler> m_handler;
+};
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosDisplayRefreshMonitorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,38 +23,33 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#include "config.h"
</del><ins>+#import "config.h"
+#import "DisplayRefreshMonitorIOS.h"
</ins><span class="cx">
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">
</span><del>-#include "DisplayRefreshMonitor.h"
</del><ins>+#import "WebCoreThread.h"
+#import <QuartzCore/QuartzCore.h>
+#import <wtf/CurrentTime.h>
+#import <wtf/MainThread.h>
</ins><span class="cx">
</span><del>-#include <QuartzCore/QuartzCore.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/MainThread.h>
</del><ins>+using namespace WebCore;
</ins><span class="cx">
</span><del>-#import "WebCoreThread.h"
-
</del><span class="cx"> @interface WebDisplayLinkHandler : NSObject
</span><span class="cx"> {
</span><del>- WebCore::DisplayRefreshMonitor* m_monitor;
- CADisplayLink* m_displayLink;
</del><ins>+ DisplayRefreshMonitorIOS* m_monitor;
+ CADisplayLink *m_displayLink;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (id)initWithMonitor:(WebCore::DisplayRefreshMonitor*)monitor;
</del><ins>+- (id)initWithMonitor:(DisplayRefreshMonitorIOS*)monitor;
</ins><span class="cx"> - (void)handleDisplayLink:(CADisplayLink *)sender;
</span><span class="cx"> - (void)invalidate;
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-static double mediaTimeToCurrentTime(CFTimeInterval t)
-{
- return monotonicallyIncreasingTime() + t - CACurrentMediaTime();
-}
-
</del><span class="cx"> @implementation WebDisplayLinkHandler
</span><span class="cx">
</span><del>-- (id)initWithMonitor:(WebCore::DisplayRefreshMonitor*)monitor
</del><ins>+- (id)initWithMonitor:(DisplayRefreshMonitorIOS*)monitor
</ins><span class="cx"> {
</span><span class="cx"> if (self = [super init]) {
</span><span class="cx"> m_monitor = monitor;
</span><span class="lines">@@ -86,34 +81,44 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><del>-
-DisplayRefreshMonitor::~DisplayRefreshMonitor()
</del><ins>+
+DisplayRefreshMonitorIOS::DisplayRefreshMonitorIOS(PlatformDisplayID displayID)
+ : DisplayRefreshMonitor(displayID)
</ins><span class="cx"> {
</span><del>- [(WebDisplayLinkHandler*) m_displayLink invalidate];
- [(WebDisplayLinkHandler*) m_displayLink release];
</del><span class="cx"> }
</span><span class="cx">
</span><del>-bool DisplayRefreshMonitor::requestRefreshCallback()
</del><ins>+DisplayRefreshMonitorIOS::~DisplayRefreshMonitorIOS()
</ins><span class="cx"> {
</span><del>- if (!m_active)
</del><ins>+ [m_handler invalidate];
+}
+
+bool DisplayRefreshMonitorIOS::requestRefreshCallback()
+{
+ if (!isActive())
</ins><span class="cx"> return false;
</span><del>-
- if (!m_displayLink) {
- m_displayLink = [[WebDisplayLinkHandler alloc] initWithMonitor:this];
- m_active = true;
</del><ins>+
+ if (!m_handler) {
+ m_handler = adoptNS([[WebDisplayLinkHandler alloc] initWithMonitor:this]);
+ setIsActive(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- m_scheduled = true;
</del><ins>+ setIsScheduled(true);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DisplayRefreshMonitor::displayLinkFired(double nowSeconds)
</del><ins>+static double mediaTimeToCurrentTime(CFTimeInterval t)
</ins><span class="cx"> {
</span><del>- if (!m_previousFrameDone)
</del><ins>+ // FIXME: This may be a no-op if CACurrentMediaTime is *guaranteed* to be mach_absolute_time.
+ return monotonicallyIncreasingTime() + t - CACurrentMediaTime();
+}
+
+void DisplayRefreshMonitorIOS::displayLinkFired(double nowSeconds)
+{
+ if (!isPreviousFrameDone())
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_previousFrameDone = false;
- m_monotonicAnimationStartTime = mediaTimeToCurrentTime(nowSeconds);
</del><ins>+ setIsPreviousFrameDone(false);
+ setMonotonicAnimationStartTime(mediaTimeToCurrentTime(nowSeconds));
</ins><span class="cx">
</span><span class="cx"> handleDisplayRefreshedNotificationOnMainThread(this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacDisplayRefreshMonitorMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -24,47 +24,52 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><ins>+#include "DisplayRefreshMonitorMac.h"
</ins><span class="cx">
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">
</span><del>-#include "DisplayRefreshMonitor.h"
-
</del><span class="cx"> #include <QuartzCore/QuartzCore.h>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags, CVOptionFlags*, void* data)
</del><ins>+DisplayRefreshMonitorMac::DisplayRefreshMonitorMac(PlatformDisplayID displayID)
+ : DisplayRefreshMonitor(displayID)
+ , m_displayLink(nullptr)
</ins><span class="cx"> {
</span><del>- DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data);
-
- double nowSeconds = static_cast<double>(now->videoTime) / static_cast<double>(now->videoTimeScale);
- double outputTimeSeconds = static_cast<double>(outputTime->videoTime) / static_cast<double>(outputTime->videoTimeScale);
- monitor->displayLinkFired(nowSeconds, outputTimeSeconds);
-
- return kCVReturnSuccess;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-DisplayRefreshMonitor::~DisplayRefreshMonitor()
</del><ins>+DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac()
</ins><span class="cx"> {
</span><span class="cx"> if (m_displayLink) {
</span><span class="cx"> CVDisplayLinkStop(m_displayLink);
</span><span class="cx"> CVDisplayLinkRelease(m_displayLink);
</span><del>- m_displayLink = 0;
</del><ins>+ m_displayLink = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> cancelCallOnMainThread(DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread, this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool DisplayRefreshMonitor::requestRefreshCallback()
</del><ins>+static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags, CVOptionFlags*, void* data)
</ins><span class="cx"> {
</span><del>- if (!m_active)
</del><ins>+ DisplayRefreshMonitorMac* monitor = static_cast<DisplayRefreshMonitorMac*>(data);
+
+ double nowSeconds = static_cast<double>(now->videoTime) / static_cast<double>(now->videoTimeScale);
+ double outputTimeSeconds = static_cast<double>(outputTime->videoTime) / static_cast<double>(outputTime->videoTimeScale);
+ monitor->displayLinkFired(nowSeconds, outputTimeSeconds);
+
+ return kCVReturnSuccess;
+}
+
+bool DisplayRefreshMonitorMac::requestRefreshCallback()
+{
+ if (!isActive())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!m_displayLink) {
</span><del>- m_active = false;
- CVReturn error = CVDisplayLinkCreateWithCGDisplay(m_displayID, &m_displayLink);
</del><ins>+ setIsActive(false);
+ CVReturn error = CVDisplayLinkCreateWithCGDisplay(displayID(), &m_displayLink);
</ins><span class="cx"> if (error)
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -76,26 +81,26 @@
</span><span class="cx"> if (error)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- m_active = true;
</del><ins>+ setIsActive(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- MutexLocker lock(m_mutex);
- m_scheduled = true;
</del><ins>+ MutexLocker lock(mutex());
+ setIsScheduled(true);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DisplayRefreshMonitor::displayLinkFired(double nowSeconds, double outputTimeSeconds)
</del><ins>+void DisplayRefreshMonitorMac::displayLinkFired(double nowSeconds, double outputTimeSeconds)
</ins><span class="cx"> {
</span><del>- MutexLocker lock(m_mutex);
- if (!m_previousFrameDone)
</del><ins>+ MutexLocker lock(mutex());
+ if (!isPreviousFrameDone())
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_previousFrameDone = false;
</del><ins>+ setIsPreviousFrameDone(false);
</ins><span class="cx">
</span><span class="cx"> double webKitMonotonicNow = monotonicallyIncreasingTime();
</span><span class="cx"> double timeUntilOutput = outputTimeSeconds - nowSeconds;
</span><span class="cx"> // FIXME: Should this be using webKitMonotonicNow?
</span><del>- m_monotonicAnimationStartTime = webKitMonotonicNow + timeUntilOutput;
</del><ins>+ setMonotonicAnimationStartTime(webKitMonotonicNow + timeUntilOutput);
</ins><span class="cx">
</span><span class="cx"> callOnMainThread(handleDisplayRefreshedNotificationOnMainThread, this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacDisplayRefreshMonitorMach"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DisplayRefreshMonitorMac_h
+#define DisplayRefreshMonitorMac_h
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "DisplayRefreshMonitor.h"
+
+typedef struct __CVDisplayLink *CVDisplayLinkRef;
+
+namespace WebCore {
+
+class DisplayRefreshMonitorMac : public DisplayRefreshMonitor {
+public:
+ static PassRefPtr<DisplayRefreshMonitorMac> create(PlatformDisplayID displayID)
+ {
+ return adoptRef(new DisplayRefreshMonitorMac(displayID));
+ }
+
+ virtual ~DisplayRefreshMonitorMac();
+
+ void displayLinkFired(double nowSeconds, double outputTimeSeconds);
+ virtual bool requestRefreshCallback() override;
+
+private:
+ explicit DisplayRefreshMonitorMac(PlatformDisplayID);
+ CVDisplayLinkRef m_displayLink;
+};
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -3925,4 +3925,16 @@
</span><span class="cx"> m_renderView.frameView().firePaintRelatedMilestonesIfNeeded();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+PassRefPtr<DisplayRefreshMonitor> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
+{
+ Frame& frame = m_renderView.frameView().frame();
+ Page* page = frame.page();
+ if (!page)
+ return nullptr;
+
+ return page->chrome().client().createDisplayRefreshMonitor(displayID);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -391,6 +391,10 @@
</span><span class="cx"> GraphicsLayerFactory* graphicsLayerFactory() const;
</span><span class="cx"> ScrollingCoordinator* scrollingCoordinator() const;
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const;
+#endif
+
</ins><span class="cx"> // Whether a running transition or animation enforces the need for a compositing layer.
</span><span class="cx"> bool requiresCompositingForAnimation(RenderLayerModelObject&) const;
</span><span class="cx"> bool requiresCompositingForTransform(RenderLayerModelObject&) const;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-05-23 Tim Horton <timothy_horton@apple.com>
+
+ REGRESSION (iOS WebKit2): requestAnimationFrame fires more than once between layer tree commits
+ https://bugs.webkit.org/show_bug.cgi?id=132794
+ <rdar://problem/16877909>
+
+ Reviewed by Simon Fraser.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::createDisplayRefreshMonitor):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/DrawingArea.h:
+ (WebKit::DrawingArea::graphicsLayerFactory):
+ (WebKit::DrawingArea::createDisplayRefreshMonitor):
+ Plumb the DisplayRefreshMonitor request through to the DrawingArea.
+ RemoteLayerTreeDrawingArea will implement and return a RemoteLayerTreeDisplayRefreshMonitor.
+
+ * WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h: Added.
+ (WebKit::RemoteLayerTreeDisplayRefreshMonitor::create):
+ * WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm: Added.
+ (WebKit::RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor):
+ (WebKit::RemoteLayerTreeDisplayRefreshMonitor::~RemoteLayerTreeDisplayRefreshMonitor):
+ (WebKit::RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback):
+ When requesting a display refresh callback, schedule a layer commit.
+ It may end up being empty, but will still call us back with a didUpdate,
+ upon which we'll fire the callback.
+
+ (WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
+
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::createDisplayRefreshMonitor):
+ (WebKit::RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor):
+ Keep track of the set of DisplayRefreshMonitors.
+
+ (WebKit::RemoteLayerTreeDrawingArea::didUpdate):
+ Fire requestAnimationFrame callbacks once the UI process commits the new layer tree.
+
</ins><span class="cx"> 2014-05-23 Jeremy Jones <jeremyj@apple.com>
</span><span class="cx">
</span><span class="cx"> Hide fullscreen immediately when switching tabs.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -530,6 +530,8 @@
</span><span class="cx">                 2D28F3E51885CCC1004B9EAE /* WebDatabaseManagerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D28F3E11885CCC1004B9EAE /* WebDatabaseManagerIOS.mm */; };
</span><span class="cx">                 2D28F3E61885CCC1004B9EAE /* WebEditorClientIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D28F3E21885CCC1004B9EAE /* WebEditorClientIOS.mm */; };
</span><span class="cx">                 2D28F3E71885CCC1004B9EAE /* WebFrameLoaderClientIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D28F3E31885CCC1004B9EAE /* WebFrameLoaderClientIOS.mm */; };
</span><ins>+                2D29ECD0192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECCE192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h */; };
+                2D29ECD1192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D29ECCF192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm */; };
</ins><span class="cx">                 2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */; };
</span><span class="cx">                 2D2ADF0B16362DDB00197E47 /* PDFPluginAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */; };
</span><span class="cx">                 2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; };
</span><span class="lines">@@ -2465,6 +2467,8 @@
</span><span class="cx">                 2D28F3E11885CCC1004B9EAE /* WebDatabaseManagerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebDatabaseManagerIOS.mm; path = ios/WebDatabaseManagerIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D28F3E21885CCC1004B9EAE /* WebEditorClientIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebEditorClientIOS.mm; path = ios/WebEditorClientIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D28F3E31885CCC1004B9EAE /* WebFrameLoaderClientIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebFrameLoaderClientIOS.mm; path = ios/WebFrameLoaderClientIOS.mm; sourceTree = "<group>"; };
</span><ins>+                2D29ECCE192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDisplayRefreshMonitor.h; sourceTree = "<group>"; };
+                2D29ECCF192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeDisplayRefreshMonitor.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 2D2ADF021636243500197E47 /* PDFPluginAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginAnnotation.h; path = PDF/PDFPluginAnnotation.h; sourceTree = "<group>"; };
</span><span class="cx">                 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginAnnotation.mm; path = PDF/PDFPluginAnnotation.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D2ADF0516362DC700197E47 /* PDFPluginTextAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginTextAnnotation.h; path = PDF/PDFPluginTextAnnotation.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4649,6 +4653,15 @@
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                2D29ECCD192F2C2E00984B78 /* Cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                2D29ECCE192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h */,
+                                2D29ECCF192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm */,
+                        );
+                        path = Cocoa;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 2DA944771884E3AB00ED86DB /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5546,6 +5559,7 @@
</span><span class="cx">                 BC032D5E10F4372B0058C15A /* WebPage */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                2D29ECCD192F2C2E00984B78 /* Cocoa */,
</ins><span class="cx">                                 2DA944B41884EA2A00ED86DB /* ios */,
</span><span class="cx">                                 BC963D6C113DD19500574BE2 /* mac */,
</span><span class="cx">                                 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */,
</span><span class="lines">@@ -7423,6 +7437,7 @@
</span><span class="cx">                                 2684054418B85A630022C38B /* VisibleContentRectUpdateInfo.h in Headers */,
</span><span class="cx">                                 37948404150C350600E52CE9 /* WebRenderLayer.h in Headers */,
</span><span class="cx">                                 51E351F6180F5C7500E53BE9 /* WebIDBFactoryBackend.h in Headers */,
</span><ins>+                                2D29ECD0192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h in Headers */,
</ins><span class="cx">                                 3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
</span><span class="cx">                                 51217465164C21370037A5C1 /* WebResourceBuffer.h in Headers */,
</span><span class="cx">                                 33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
</span><span class="lines">@@ -8806,6 +8821,7 @@
</span><span class="cx">                                 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */,
</span><span class="cx">                                 BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */,
</span><span class="cx">                                 1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */,
</span><ins>+                                2D29ECD1192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm in Sources */,
</ins><span class="cx">                                 1AAB0379185A7C6A00EDF501 /* MessageSender.cpp in Sources */,
</span><span class="cx">                                 1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
</span><span class="cx">                                 1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -780,6 +780,13 @@
</span><span class="cx"> return m_page->drawingArea()->graphicsLayerFactory();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+PassRefPtr<WebCore::DisplayRefreshMonitor> WebChromeClient::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
+{
+ return m_page->drawingArea()->createDisplayRefreshMonitor(displayID);
+}
+#endif
+
</ins><span class="cx"> void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer)
</span><span class="cx"> {
</span><span class="cx"> if (layer)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -204,6 +204,10 @@
</span><span class="cx"> virtual void scheduleCompositingLayerFlush() override;
</span><span class="cx"> virtual WebCore::GraphicsLayer* documentOverlayLayerForFrame(WebCore::Frame&) override;
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
+#endif
+
</ins><span class="cx"> virtual CompositingTriggerFlags allowedCompositingTriggers() const
</span><span class="cx"> {
</span><span class="cx"> return static_cast<CompositingTriggerFlags>(
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoteLayerTreeDisplayRefreshMonitor_h
+#define RemoteLayerTreeDisplayRefreshMonitor_h
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#include "RemoteLayerTreeDrawingArea.h"
+#include <WebCore/DisplayRefreshMonitor.h>
+
+namespace WebKit {
+
+class RemoteLayerTreeDisplayRefreshMonitor : public WebCore::DisplayRefreshMonitor {
+public:
+ static PassRefPtr<RemoteLayerTreeDisplayRefreshMonitor> create(PlatformDisplayID displayID, RemoteLayerTreeDrawingArea& drawingArea)
+ {
+ return adoptRef(new RemoteLayerTreeDisplayRefreshMonitor(displayID, drawingArea));
+ }
+
+ virtual ~RemoteLayerTreeDisplayRefreshMonitor();
+
+ virtual bool requestRefreshCallback() override;
+
+ void didUpdateLayers();
+
+private:
+ explicit RemoteLayerTreeDisplayRefreshMonitor(PlatformDisplayID, RemoteLayerTreeDrawingArea&);
+
+ RemoteLayerTreeDrawingArea& m_drawingArea;
+};
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#endif // RemoteLayerTreeDisplayRefreshMonitor_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitormm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm (0 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "RemoteLayerTreeDisplayRefreshMonitor.h"
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+#import <wtf/CurrentTime.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor(PlatformDisplayID displayID, RemoteLayerTreeDrawingArea& drawingArea)
+ : DisplayRefreshMonitor(displayID)
+ , m_drawingArea(drawingArea)
+{
+}
+
+RemoteLayerTreeDisplayRefreshMonitor::~RemoteLayerTreeDisplayRefreshMonitor()
+{
+ m_drawingArea.willDestroyDisplayRefreshMonitor(this);
+}
+
+bool RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback()
+{
+ if (!isActive())
+ return false;
+
+ if (!isScheduled())
+ static_cast<DrawingArea&>(m_drawingArea).scheduleCompositingLayerFlush();
+
+ setIsActive(true);
+ setIsScheduled(true);
+ return true;
+}
+
+void RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers()
+{
+ setIsScheduled(false);
+
+ if (!isPreviousFrameDone())
+ return;
+
+ setIsPreviousFrameDone(false);
+ setMonotonicAnimationStartTime(monotonicallyIncreasingTime());
+
+ handleDisplayRefreshedNotificationOnMainThread(this);
+}
+
+}
+
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "DrawingArea.h"
</span><ins>+#include <WebCore/DisplayRefreshMonitor.h>
</ins><span class="cx"> #include <WebCore/TransformationMatrix.h>
</span><span class="cx"> #include <wtf/Functional.h>
</span><span class="cx">
</span><span class="lines">@@ -91,4 +92,11 @@
</span><span class="cx"> return TransformationMatrix();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+PassRefPtr<WebCore::DisplayRefreshMonitor> DrawingArea::createDisplayRefreshMonitor(PlatformDisplayID)
+{
+ return nullptr;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "LayerTreeContext.h"
</span><span class="cx"> #include <WebCore/FloatRect.h>
</span><span class="cx"> #include <WebCore/IntRect.h>
</span><ins>+#include <WebCore/PlatformScreen.h>
</ins><span class="cx"> #include <WebCore/ViewState.h>
</span><span class="cx"> #include <functional>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><ins>+class DisplayRefreshMonitor;
</ins><span class="cx"> class FrameView;
</span><span class="cx"> class GraphicsLayer;
</span><span class="cx"> class GraphicsLayerFactory;
</span><span class="lines">@@ -95,10 +97,14 @@
</span><span class="cx">
</span><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) { return false; }
</span><span class="cx">
</span><del>- virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
</del><ins>+ virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return nullptr; }
</ins><span class="cx"> virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
</span><span class="cx"> virtual void scheduleCompositingLayerFlush() = 0;
</span><span class="cx">
</span><ins>+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID);
+#endif
+
</ins><span class="cx"> virtual WebCore::TransformationMatrix rootLayerTransform() const;
</span><span class="cx"> virtual void setRootLayerTransform(const WebCore::TransformationMatrix&) { }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -45,8 +45,10 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> class RemoteLayerTreeContext;
</span><ins>+class RemoteLayerTreeDisplayRefreshMonitor;
</ins><span class="cx">
</span><span class="cx"> class RemoteLayerTreeDrawingArea : public DrawingArea, public WebCore::GraphicsLayerClient {
</span><ins>+ friend class RemoteLayerTreeDisplayRefreshMonitor;
</ins><span class="cx"> public:
</span><span class="cx"> RemoteLayerTreeDrawingArea(WebPage*, const WebPageCreationParameters&);
</span><span class="cx"> virtual ~RemoteLayerTreeDrawingArea();
</span><span class="lines">@@ -62,6 +64,9 @@
</span><span class="cx"> virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
</span><span class="cx"> virtual void scheduleCompositingLayerFlush() override;
</span><span class="cx">
</span><ins>+ virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) override;
+ void willDestroyDisplayRefreshMonitor(WebCore::DisplayRefreshMonitor*);
+
</ins><span class="cx"> virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) override;
</span><span class="cx">
</span><span class="cx"> virtual void updatePreferences(const WebPreferencesStore&) override;
</span><span class="lines">@@ -136,6 +141,8 @@
</span><span class="cx">
</span><span class="cx"> dispatch_queue_t m_commitQueue;
</span><span class="cx"> RefPtr<BackingStoreFlusher> m_pendingBackingStoreFlusher;
</span><ins>+
+ HashSet<RemoteLayerTreeDisplayRefreshMonitor*> m_displayRefreshMonitors;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> DRAWING_AREA_TYPE_CASTS(RemoteLayerTreeDrawingArea, type() == DrawingAreaTypeRemoteLayerTree);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (169298 => 169299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-05-24 02:11:17 UTC (rev 169298)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-05-24 02:17:59 UTC (rev 169299)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import "PlatformCALayerRemote.h"
</span><span class="cx"> #import "RemoteLayerBackingStoreCollection.h"
</span><span class="cx"> #import "RemoteLayerTreeContext.h"
</span><ins>+#import "RemoteLayerTreeDisplayRefreshMonitor.h"
</ins><span class="cx"> #import "RemoteLayerTreeDrawingAreaProxyMessages.h"
</span><span class="cx"> #import "RemoteScrollingCoordinator.h"
</span><span class="cx"> #import "RemoteScrollingCoordinatorTransaction.h"
</span><span class="lines">@@ -91,6 +92,18 @@
</span><span class="cx"> return m_remoteLayerTreeContext.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+PassRefPtr<DisplayRefreshMonitor> RemoteLayerTreeDrawingArea::createDisplayRefreshMonitor(PlatformDisplayID displayID)
+{
+ RefPtr<RemoteLayerTreeDisplayRefreshMonitor> monitor = RemoteLayerTreeDisplayRefreshMonitor::create(displayID, *this);
+ m_displayRefreshMonitors.add(monitor.get());
+ return monitor.release();
+}
+
+void RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor(DisplayRefreshMonitor* monitor)
+{
+ m_displayRefreshMonitors.remove(static_cast<RemoteLayerTreeDisplayRefreshMonitor*>(monitor));
+}
+
</ins><span class="cx"> void RemoteLayerTreeDrawingArea::setRootCompositingLayer(GraphicsLayer* rootLayer)
</span><span class="cx"> {
</span><span class="cx"> Vector<GraphicsLayer *> children;
</span><span class="lines">@@ -309,6 +322,9 @@
</span><span class="cx"> // This empty transaction serves to trigger CA's garbage collection of IOSurfaces. See <rdar://problem/16110687>
</span><span class="cx"> [CATransaction begin];
</span><span class="cx"> [CATransaction commit];
</span><ins>+
+ for (auto& monitor : m_displayRefreshMonitors)
+ monitor->didUpdateLayers();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged(const IntSize& contentsSize)
</span></span></pre>
</div>
</div>
</body>
</html>