<!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>[191789] trunk/Source/WebCore</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/191789">191789</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-10-30 06:25:26 -0700 (Fri, 30 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make every port implement MainThreadSharedTimer instead of using global functions
https://bugs.webkit.org/show_bug.cgi?id=150498
Reviewed by Darin Adler.
Move MainThreadSharedTimer to its own files and add the common
implementation there.
* CMakeLists.txt: Add MainThreadSharedTimer.cpp.
* PlatformEfl.cmake: Update filenames.
* PlatformGTK.cmake: Ditto.
* PlatformMac.cmake: Ditto.
* PlatformWin.cmake: Ditto.
* platform/MainThreadSharedTimer.cpp: Copied from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
(WebCore::MainThreadSharedTimer::singleton):
(WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
(WebCore::MainThreadSharedTimer::setFiredFunction):
(WebCore::MainThreadSharedTimer::fired):
* platform/MainThreadSharedTimer.h: Copied from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
* platform/SharedTimer.h: Remove MainThreadSharedTimer
implementation and reindent the code.
(WebCore::SharedTimer::SharedTimer):
(WebCore::SharedTimer::~SharedTimer):
(WebCore::SharedTimer::invalidate):
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::ThreadTimers): Use MainThreadSharedTimer::singleton().
(WebCore::ThreadTimers::setSharedTimer): Use a lambda function
instead of a pointer to a static method.
(WebCore::ThreadTimers::sharedTimerFired): Deleted.
* platform/ThreadTimers.h: Removed unsused static method sharedTimerFired.
* platform/cf/MainThreadSharedTimerCF.cpp: Renamed from Source/WebCore/platform/cf/SharedTimerCF.cpp.
(WebCore::applicationDidBecomeActive):
(WebCore::setupPowerObserver):
(WebCore::timerFired):
(WebCore::restartSharedTimer):
(WebCore::MainThreadSharedTimer::invalidate):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
* platform/efl/MainThreadSharedTimerEfl.cpp: Renamed from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
(WebCore::timerEvent):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::invalidate):
* platform/gtk/MainThreadSharedTimerGtk.cpp: Renamed from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::invalidate):
* platform/win/MainThreadSharedTimerWin.cpp: Renamed from Source/WebCore/platform/win/SharedTimerWin.cpp.
(WebCore::TimerWindowWndProc):
(WebCore::initializeOffScreenTimerWindow):
(WebCore::queueTimerProc):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::invalidate):
* workers/WorkerRunLoop.cpp: Update WorkerSharedTimer
implementation to use std::function instead of a pointer. Also
mark the class as final and the virtual implementations as override.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformEflcmake">trunk/Source/WebCore/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformWincmake">trunk/Source/WebCore/PlatformWin.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformSharedTimerh">trunk/Source/WebCore/platform/SharedTimer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformThreadTimerscpp">trunk/Source/WebCore/platform/ThreadTimers.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformThreadTimersh">trunk/Source/WebCore/platform/ThreadTimers.h</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerRunLoopcpp">trunk/Source/WebCore/workers/WorkerRunLoop.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformMainThreadSharedTimercpp">trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMainThreadSharedTimerh">trunk/Source/WebCore/platform/MainThreadSharedTimer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcfMainThreadSharedTimerCFcpp">trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformeflMainThreadSharedTimerEflcpp">trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkMainThreadSharedTimerGtkcpp">trunk/Source/WebCore/platform/gtk/MainThreadSharedTimerGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinMainThreadSharedTimerWincpp">trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcfSharedTimerCFcpp">trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformeflSharedTimerEflcpp">trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkSharedTimerGtkcpp">trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinSharedTimerWincpp">trunk/Source/WebCore/platform/win/SharedTimerWin.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -2110,6 +2110,7 @@
</span><span class="cx"> platform/LinkHash.cpp
</span><span class="cx"> platform/Logging.cpp
</span><span class="cx"> platform/MIMETypeRegistry.cpp
</span><ins>+ platform/MainThreadSharedTimer.cpp
</ins><span class="cx"> platform/MemoryPressureHandler.cpp
</span><span class="cx"> platform/NotImplemented.cpp
</span><span class="cx"> platform/PlatformEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/ChangeLog        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1,5 +1,65 @@
</span><span class="cx"> 2015-10-30 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ Make every port implement MainThreadSharedTimer instead of using global functions
+ https://bugs.webkit.org/show_bug.cgi?id=150498
+
+ Reviewed by Darin Adler.
+
+ Move MainThreadSharedTimer to its own files and add the common
+ implementation there.
+
+ * CMakeLists.txt: Add MainThreadSharedTimer.cpp.
+ * PlatformEfl.cmake: Update filenames.
+ * PlatformGTK.cmake: Ditto.
+ * PlatformMac.cmake: Ditto.
+ * PlatformWin.cmake: Ditto.
+ * platform/MainThreadSharedTimer.cpp: Copied from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
+ (WebCore::MainThreadSharedTimer::singleton):
+ (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
+ (WebCore::MainThreadSharedTimer::setFiredFunction):
+ (WebCore::MainThreadSharedTimer::fired):
+ * platform/MainThreadSharedTimer.h: Copied from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
+ * platform/SharedTimer.h: Remove MainThreadSharedTimer
+ implementation and reindent the code.
+ (WebCore::SharedTimer::SharedTimer):
+ (WebCore::SharedTimer::~SharedTimer):
+ (WebCore::SharedTimer::invalidate):
+ * platform/ThreadTimers.cpp:
+ (WebCore::ThreadTimers::ThreadTimers): Use MainThreadSharedTimer::singleton().
+ (WebCore::ThreadTimers::setSharedTimer): Use a lambda function
+ instead of a pointer to a static method.
+ (WebCore::ThreadTimers::sharedTimerFired): Deleted.
+ * platform/ThreadTimers.h: Removed unsused static method sharedTimerFired.
+ * platform/cf/MainThreadSharedTimerCF.cpp: Renamed from Source/WebCore/platform/cf/SharedTimerCF.cpp.
+ (WebCore::applicationDidBecomeActive):
+ (WebCore::setupPowerObserver):
+ (WebCore::timerFired):
+ (WebCore::restartSharedTimer):
+ (WebCore::MainThreadSharedTimer::invalidate):
+ (WebCore::MainThreadSharedTimer::setFireInterval):
+ (WebCore::MainThreadSharedTimer::stop):
+ * platform/efl/MainThreadSharedTimerEfl.cpp: Renamed from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
+ (WebCore::timerEvent):
+ (WebCore::MainThreadSharedTimer::stop):
+ (WebCore::MainThreadSharedTimer::setFireInterval):
+ (WebCore::MainThreadSharedTimer::invalidate):
+ * platform/gtk/MainThreadSharedTimerGtk.cpp: Renamed from Source/WebCore/platform/gtk/SharedTimerGtk.cpp.
+ (WebCore::MainThreadSharedTimer::setFireInterval):
+ (WebCore::MainThreadSharedTimer::stop):
+ (WebCore::MainThreadSharedTimer::invalidate):
+ * platform/win/MainThreadSharedTimerWin.cpp: Renamed from Source/WebCore/platform/win/SharedTimerWin.cpp.
+ (WebCore::TimerWindowWndProc):
+ (WebCore::initializeOffScreenTimerWindow):
+ (WebCore::queueTimerProc):
+ (WebCore::MainThreadSharedTimer::setFireInterval):
+ (WebCore::MainThreadSharedTimer::stop):
+ (WebCore::MainThreadSharedTimer::invalidate):
+ * workers/WorkerRunLoop.cpp: Update WorkerSharedTimer
+ implementation to use std::function instead of a pointer. Also
+ mark the class as final and the virtual implementations as override.
+
+2015-10-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GTK] Use RunLoop::Timer instead of GMainLoopSource
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=150592
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformEfl.cmake (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformEfl.cmake        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/PlatformEfl.cmake        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -114,13 +114,13 @@
</span><span class="cx"> platform/efl/LocalizedStringsEfl.cpp
</span><span class="cx"> platform/efl/LoggingEfl.cpp
</span><span class="cx"> platform/efl/MIMETypeRegistryEfl.cpp
</span><ins>+ platform/efl/MainThreadSharedTimerEfl.cpp
</ins><span class="cx"> platform/efl/PasteboardEfl.cpp
</span><span class="cx"> platform/efl/PlatformKeyboardEventEfl.cpp
</span><span class="cx"> platform/efl/PlatformMouseEventEfl.cpp
</span><span class="cx"> platform/efl/PlatformScreenEfl.cpp
</span><span class="cx"> platform/efl/PlatformWheelEventEfl.cpp
</span><span class="cx"> platform/efl/ScrollbarThemeEfl.cpp
</span><del>- platform/efl/SharedTimerEfl.cpp
</del><span class="cx"> platform/efl/SoundEfl.cpp
</span><span class="cx"> platform/efl/TemporaryLinkStubs.cpp
</span><span class="cx"> platform/efl/WidgetEfl.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -162,8 +162,8 @@
</span><span class="cx"> platform/gtk/LanguageGtk.cpp
</span><span class="cx"> platform/gtk/LoggingGtk.cpp
</span><span class="cx"> platform/gtk/MIMETypeRegistryGtk.cpp
</span><ins>+ platform/gtk/MainThreadSharedTimerGtk.cpp
</ins><span class="cx"> platform/gtk/SharedBufferGtk.cpp
</span><del>- platform/gtk/SharedTimerGtk.cpp
</del><span class="cx"> platform/gtk/TemporaryLinkStubs.cpp
</span><span class="cx"> platform/gtk/UserAgentGtk.cpp
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/PlatformMac.cmake        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -312,10 +312,10 @@
</span><span class="cx"> platform/cf/FileSystemCF.cpp
</span><span class="cx"> platform/cf/KeyedDecoderCF.cpp
</span><span class="cx"> platform/cf/KeyedEncoderCF.cpp
</span><ins>+ platform/cf/MainThreadSharedTimerCF.cpp
</ins><span class="cx"> platform/cf/MediaAccessibilitySoftLink.cpp
</span><span class="cx"> platform/cf/RunLoopObserver.cpp
</span><span class="cx"> platform/cf/SharedBufferCF.cpp
</span><del>- platform/cf/SharedTimerCF.cpp
</del><span class="cx"> platform/cf/URLCF.cpp
</span><span class="cx">
</span><span class="cx"> platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformWincmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformWin.cmake (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformWin.cmake        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/PlatformWin.cmake        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> platform/win/LoggingWin.cpp
</span><span class="cx"> platform/win/MemoryPressureHandlerWin.cpp
</span><span class="cx"> platform/win/MIMETypeRegistryWin.cpp
</span><ins>+ platform/win/MainThreadSharedTimerWin.cpp
</ins><span class="cx"> platform/win/PasteboardWin.cpp
</span><span class="cx"> platform/win/PathWalker.cpp
</span><span class="cx"> platform/win/PlatformMouseEventWin.cpp
</span><span class="lines">@@ -133,7 +134,6 @@
</span><span class="cx"> platform/win/ScrollbarThemeWin.cpp
</span><span class="cx"> platform/win/SearchPopupMenuWin.cpp
</span><span class="cx"> platform/win/SharedBufferWin.cpp
</span><del>- platform/win/SharedTimerWin.cpp
</del><span class="cx"> platform/win/SoundWin.cpp
</span><span class="cx"> platform/win/StructuredExceptionHandlerSuppressor.cpp
</span><span class="cx"> platform/win/SystemInfo.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1703,7 +1703,6 @@
</span><span class="cx">                 46233EEE1BA0F187000EBEBB /* AttributeDOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 46233EED1BA0F17A000EBEBB /* AttributeDOMTokenList.h */; };
</span><span class="cx">                 46233EEF1BA0F18B000EBEBB /* AttributeDOMTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46233EEC1BA0F17A000EBEBB /* AttributeDOMTokenList.cpp */; };
</span><span class="cx">                 4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
</span><del>-                4634592E1AC2273C00ECB71C /* SharedTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */; };
</del><span class="cx">                 463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; };
</span><span class="cx">                 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
</span><span class="cx">                 4669B2871B852A0B000F905F /* JSDOMNamedFlowCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */; };
</span><span class="lines">@@ -2643,6 +2642,9 @@
</span><span class="cx">                 7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7AE335F11ACB09E200E401EF /* WheelEventTestTrigger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */; };
</span><span class="cx">                 7AE335F21ACB09E200E401EF /* WheelEventTestTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                7AE6C9381BE0C5C800E19E03 /* MainThreadSharedTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AE6C9371BE0C5C800E19E03 /* MainThreadSharedTimerCF.cpp */; };
+                7AE6C93B1BE0C60100E19E03 /* MainThreadSharedTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AE6C9391BE0C60100E19E03 /* MainThreadSharedTimer.cpp */; };
+                7AE6C93C1BE0C60100E19E03 /* MainThreadSharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE6C93A1BE0C60100E19E03 /* MainThreadSharedTimer.h */; };
</ins><span class="cx">                 7AF9B20218CFB2DF00C64BEF /* VTTRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9B1FC18CFB2DF00C64BEF /* VTTRegion.cpp */; };
</span><span class="cx">                 7AF9B20318CFB2DF00C64BEF /* VTTRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B1FD18CFB2DF00C64BEF /* VTTRegion.h */; };
</span><span class="cx">                 7AF9B20518CFB2DF00C64BEF /* VTTRegionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9B1FF18CFB2DF00C64BEF /* VTTRegionList.cpp */; };
</span><span class="lines">@@ -9064,7 +9066,6 @@
</span><span class="cx">                 46233EEC1BA0F17A000EBEBB /* AttributeDOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeDOMTokenList.cpp; path = ../AttributeDOMTokenList.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 46233EED1BA0F17A000EBEBB /* AttributeDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttributeDOMTokenList.h; path = ../AttributeDOMTokenList.h; sourceTree = "<group>"; };
</span><span class="cx">                 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
</span><del>-                4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedTimerCF.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
</span><span class="cx">                 4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -10105,6 +10106,9 @@
</span><span class="cx">                 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; };
</span><span class="cx">                 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelEventTestTrigger.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventTestTrigger.h; sourceTree = "<group>"; };
</span><ins>+                7AE6C9371BE0C5C800E19E03 /* MainThreadSharedTimerCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadSharedTimerCF.cpp; sourceTree = "<group>"; };
+                7AE6C9391BE0C60100E19E03 /* MainThreadSharedTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadSharedTimer.cpp; sourceTree = "<group>"; };
+                7AE6C93A1BE0C60100E19E03 /* MainThreadSharedTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThreadSharedTimer.h; sourceTree = "<group>"; };
</ins><span class="cx">                 7AF9B1FC18CFB2DF00C64BEF /* VTTRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VTTRegion.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7AF9B1FD18CFB2DF00C64BEF /* VTTRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTTRegion.h; sourceTree = "<group>"; };
</span><span class="cx">                 7AF9B1FE18CFB2DF00C64BEF /* VTTRegion.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VTTRegion.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -15764,6 +15768,7 @@
</span><span class="cx">                 1AE42F670AA4B8CB00C8612D /* cf */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7AE6C9371BE0C5C800E19E03 /* MainThreadSharedTimerCF.cpp */,
</ins><span class="cx">                                 E1A8E56417552B2A007488E7 /* CFURLExtras.cpp */,
</span><span class="cx">                                 E1A8E56517552B2A007488E7 /* CFURLExtras.h */,
</span><span class="cx">                                 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */,
</span><span class="lines">@@ -15778,7 +15783,6 @@
</span><span class="cx">                                 2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */,
</span><span class="cx">                                 2D76BB801945632400CFD29A /* RunLoopObserver.h */,
</span><span class="cx">                                 512DD8E20D91E2B4000F89EE /* SharedBufferCF.cpp */,
</span><del>-                                4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */,
</del><span class="cx">                                 1A98956A0AA78F80005EF5EF /* URLCF.cpp */,
</span><span class="cx">                         );
</span><span class="cx">                         path = cf;
</span><span class="lines">@@ -22366,6 +22370,8 @@
</span><span class="cx">                 BCF1A5BA097832090061A123 /* platform */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7AE6C9391BE0C60100E19E03 /* MainThreadSharedTimer.cpp */,
+                                7AE6C93A1BE0C60100E19E03 /* MainThreadSharedTimer.h */,
</ins><span class="cx">                                 49E912A40EFAC8E6009D0CAF /* animation */,
</span><span class="cx">                                 FD31604012B026A300C1A359 /* audio */,
</span><span class="cx">                                 1AE42F670AA4B8CB00C8612D /* cf */,
</span><span class="lines">@@ -27852,6 +27858,7 @@
</span><span class="cx">                                 AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */,
</span><span class="cx">                                 AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */,
</span><span class="cx">                                 2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */,
</span><ins>+                                7AE6C93C1BE0C60100E19E03 /* MainThreadSharedTimer.h in Headers */,
</ins><span class="cx">                                 07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */,
</span><span class="cx">                                 A5A7AA43132F0ECC00D3A3C2 /* WebAutocapitalize.h in Headers */,
</span><span class="cx">                                 A56C5B9B189F34570082D13C /* WebConsoleAgent.h in Headers */,
</span><span class="lines">@@ -29252,6 +29259,7 @@
</span><span class="cx">                                 0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
</span><span class="cx">                                 A8EA79F80A1916DF00A8EF5F /* HTMLMenuElement.cpp in Sources */,
</span><span class="cx">                                 2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */,
</span><ins>+                                7AE6C9381BE0C5C800E19E03 /* MainThreadSharedTimerCF.cpp in Sources */,
</ins><span class="cx">                                 A871DC270A15205700B12A68 /* HTMLMetaElement.cpp in Sources */,
</span><span class="cx">                                 A454424A119B3661009BE912 /* HTMLMeterElement.cpp in Sources */,
</span><span class="cx">                                 A8CFF7A90A156978000A4234 /* HTMLModElement.cpp in Sources */,
</span><span class="lines">@@ -30796,7 +30804,6 @@
</span><span class="cx">                                 512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */,
</span><span class="cx">                                 97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */,
</span><span class="cx">                                 1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
</span><del>-                                4634592E1AC2273C00ECB71C /* SharedTimerCF.cpp in Sources */,
</del><span class="cx">                                 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
</span><span class="cx">                                 E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
</span><span class="cx">                                 585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,
</span><span class="lines">@@ -31363,6 +31370,7 @@
</span><span class="cx">                                 BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */,
</span><span class="cx">                                 7E99AF510B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp in Sources */,
</span><span class="cx">                                 A14832BD187F64B400DA63A6 /* WKContentObservation.cpp in Sources */,
</span><ins>+                                7AE6C93B1BE0C60100E19E03 /* MainThreadSharedTimer.cpp in Sources */,
</ins><span class="cx">                                 A14832C0187F656600DA63A6 /* WKGraphics.mm in Sources */,
</span><span class="cx">                                 A14832C2187F65C700DA63A6 /* WKUtilities.c in Sources */,
</span><span class="cx">                                 A14832C5187F668300DA63A6 /* WKView.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMainThreadSharedTimercppfromrev191788trunkSourceWebCoreplatformeflSharedTimerEflcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp (from rev 191788, trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "MainThreadSharedTimer.h"
+
+namespace WebCore {
+
+MainThreadSharedTimer& MainThreadSharedTimer::singleton()
+{
+ static NeverDestroyed<MainThreadSharedTimer> instance;
+ return instance;
+}
+
+MainThreadSharedTimer::MainThreadSharedTimer()
+{
+}
+
+void MainThreadSharedTimer::setFiredFunction(std::function<void()>&& firedFunction)
+{
+ RELEASE_ASSERT(!m_firedFunction || !firedFunction);
+ m_firedFunction = WTF::move(firedFunction);
+}
+
+void MainThreadSharedTimer::fired() const
+{
+ ASSERT(m_firedFunction);
+ m_firedFunction();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformMainThreadSharedTimerhfromrev191788trunkSourceWebCoreplatformgtkSharedTimerGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/MainThreadSharedTimer.h (from rev 191788, trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MainThreadSharedTimer.h         (rev 0)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.h        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L.
+ * Copyright (C) 2006 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 MainThreadSharedTimer_h
+#define MainThreadSharedTimer_h
+
+#include "SharedTimer.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class MainThreadSharedTimer final : public SharedTimer {
+ friend class WTF::NeverDestroyed<MainThreadSharedTimer>;
+public:
+ static MainThreadSharedTimer& singleton();
+
+ void setFiredFunction(std::function<void()>&&) override;
+ void setFireInterval(double) override;
+ void stop() override;
+ void invalidate() override;
+
+ // FIXME: This should be private, but CF and Windows implementations
+ // need to call this from non-member functions at the moment.
+ void fired() const;
+
+private:
+ MainThreadSharedTimer();
+
+ std::function<void()> m_firedFunction;
+};
+
+} // namespace WebCore
+
+#endif // MainThreadSharedTimer
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformSharedTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/SharedTimer.h (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/SharedTimer.h        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/SharedTimer.h        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -26,60 +26,29 @@
</span><span class="cx"> #ifndef SharedTimer_h
</span><span class="cx"> #define SharedTimer_h
</span><span class="cx">
</span><ins>+#include <functional>
</ins><span class="cx"> #include <wtf/FastMalloc.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>- // Each thread has its own single instance of shared timer, which implements this interface.
- // This instance is shared by all timers in the thread.
- // Not intended to be used directly; use the Timer class instead.
- class SharedTimer {
- WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED;
- public:
- SharedTimer() { }
- virtual ~SharedTimer() {}
- virtual void setFiredFunction(void (*)()) = 0;
</del><ins>+// Each thread has its own single instance of shared timer, which implements this interface.
+// This instance is shared by all timers in the thread.
+// Not intended to be used directly; use the Timer class instead.
+class SharedTimer {
+ WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED;
+public:
+ SharedTimer() = default;
+ virtual ~SharedTimer() { }
+ virtual void setFiredFunction(std::function<void()>&&) = 0;
</ins><span class="cx">
</span><del>- // The fire interval is in seconds relative to the current monotonic clock time.
- virtual void setFireInterval(double) = 0;
- virtual void stop() = 0;
</del><ins>+ // The fire interval is in seconds relative to the current monotonic clock time.
+ virtual void setFireInterval(double) = 0;
+ virtual void stop() = 0;
</ins><span class="cx">
</span><del>- virtual void invalidate() { }
- };
</del><ins>+ virtual void invalidate() { }
+};
</ins><span class="cx">
</span><del>-
- // Implemented by port (since it provides the run loop for the main thread).
- // FIXME: make ports implement MainThreadSharedTimer directly instead.
- void setSharedTimerFiredFunction(void (*)());
- void setSharedTimerFireInterval(double);
- void stopSharedTimer();
- void invalidateSharedTimer();
-
- // Implementation of SharedTimer for the main thread.
- class MainThreadSharedTimer final : public SharedTimer {
- public:
- void setFiredFunction(void (*function)()) override
- {
- setSharedTimerFiredFunction(function);
- }
-
- void setFireInterval(double interval) override
- {
- setSharedTimerFireInterval(interval);
- }
-
- void stop() override
- {
- stopSharedTimer();
- }
-
- void invalidate() override
- {
- invalidateSharedTimer();
- }
- };
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // SharedTimer_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThreadTimerscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThreadTimers.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThreadTimers.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/ThreadTimers.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ThreadTimers.h"
</span><span class="cx">
</span><ins>+#include "MainThreadSharedTimer.h"
</ins><span class="cx"> #include "SharedTimer.h"
</span><span class="cx"> #include "ThreadGlobalData.h"
</span><span class="cx"> #include "Timer.h"
</span><span class="lines">@@ -47,27 +48,21 @@
</span><span class="cx"> // Timers are created, started and fired on the same thread, and each thread has its own ThreadTimers
</span><span class="cx"> // copy to keep the heap and a set of currently firing timers.
</span><span class="cx">
</span><del>-static MainThreadSharedTimer* mainThreadSharedTimer()
-{
- static MainThreadSharedTimer* timer = new MainThreadSharedTimer;
- return timer;
-}
-
</del><span class="cx"> ThreadTimers::ThreadTimers()
</span><span class="cx"> : m_sharedTimer(0)
</span><span class="cx"> , m_firingTimers(false)
</span><span class="cx"> , m_pendingSharedTimerFireTime(0)
</span><span class="cx"> {
</span><span class="cx"> if (isUIThread())
</span><del>- setSharedTimer(mainThreadSharedTimer());
</del><ins>+ setSharedTimer(&MainThreadSharedTimer::singleton());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // A worker thread may initialize SharedTimer after some timers are created.
</span><del>-// Also, SharedTimer can be replaced with 0 before all timers are destroyed.
</del><ins>+// Also, SharedTimer can be replaced with nullptr before all timers are destroyed.
</ins><span class="cx"> void ThreadTimers::setSharedTimer(SharedTimer* sharedTimer)
</span><span class="cx"> {
</span><span class="cx"> if (m_sharedTimer) {
</span><del>- m_sharedTimer->setFiredFunction(0);
</del><ins>+ m_sharedTimer->setFiredFunction(nullptr);
</ins><span class="cx"> m_sharedTimer->stop();
</span><span class="cx"> m_pendingSharedTimerFireTime = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -75,7 +70,7 @@
</span><span class="cx"> m_sharedTimer = sharedTimer;
</span><span class="cx">
</span><span class="cx"> if (sharedTimer) {
</span><del>- m_sharedTimer->setFiredFunction(ThreadTimers::sharedTimerFired);
</del><ins>+ m_sharedTimer->setFiredFunction([] { threadGlobalData().threadTimers().sharedTimerFiredInternal(); });
</ins><span class="cx"> updateSharedTimer();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -101,12 +96,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ThreadTimers::sharedTimerFired()
-{
- // Redirect to non-static method.
- threadGlobalData().threadTimers().sharedTimerFiredInternal();
-}
-
</del><span class="cx"> void ThreadTimers::sharedTimerFiredInternal()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread() || (!isWebThread() && !isUIThread()));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThreadTimersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThreadTimers.h (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThreadTimers.h        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/ThreadTimers.h        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -51,8 +51,6 @@
</span><span class="cx"> void fireTimersInNestedEventLoop();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- static void sharedTimerFired();
-
</del><span class="cx"> void sharedTimerFiredInternal();
</span><span class="cx"> void fireTimersInNestedEventLoopInternal();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfMainThreadSharedTimerCFcppfromrev191788trunkSourceWebCoreplatformcfSharedTimerCFcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp (from rev 191788, trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+/*
+ * Copyright (C) 2006, 2010, 2015 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 "MainThreadSharedTimer.h"
+
+#include <wtf/AutodrainedPool.h>
+
+#if PLATFORM(MAC)
+#import "PowerObserverMac.h"
+#elif PLATFORM(IOS)
+#import "WebCoreThread.h"
+#import "WebCoreThreadRun.h"
+#endif
+
+namespace WebCore {
+
+static CFRunLoopTimerRef sharedTimer;
+static void timerFired(CFRunLoopTimerRef, void*);
+static void restartSharedTimer();
+
+static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<CFTimeInterval>::max();
+
+#if PLATFORM(IOS)
+static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
+{
+ WebThreadRun(^{
+ restartSharedTimer();
+ });
+}
+#endif
+
+static void setupPowerObserver()
+{
+#if PLATFORM(MAC)
+ static PowerObserver* powerObserver;
+ if (!powerObserver)
+ powerObserver = std::make_unique<PowerObserver>(restartSharedTimer).release();
+#elif PLATFORM(IOS)
+ static bool registeredForApplicationNotification = false;
+ if (!registeredForApplicationNotification) {
+ registeredForApplicationNotification = true;
+ CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
+ CFNotificationCenterAddObserver(notificationCenter, nullptr, applicationDidBecomeActive, CFSTR("UIApplicationDidBecomeActiveNotification"), nullptr, CFNotificationSuspensionBehaviorCoalesce);
+ }
+#endif
+}
+
+static void timerFired(CFRunLoopTimerRef, void*)
+{
+ AutodrainedPool pool;
+ MainThreadSharedTimer::singleton().fired();
+}
+
+static void restartSharedTimer()
+{
+ if (!sharedTimer)
+ return;
+
+ MainThreadSharedTimer::singleton().stop();
+ timerFired(0, 0);
+}
+
+void MainThreadSharedTimer::invalidate()
+{
+ if (!sharedTimer)
+ return;
+
+ CFRunLoopTimerInvalidate(sharedTimer);
+ CFRelease(sharedTimer);
+ sharedTimer = nullptr;
+}
+
+void MainThreadSharedTimer::setFireInterval(double interval)
+{
+ ASSERT(m_firedFunction);
+
+ CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
+ if (!sharedTimer) {
+ sharedTimer = CFRunLoopTimerCreate(nullptr, fireDate, kCFTimeIntervalDistantFuture, 0, 0, timerFired, nullptr);
+#if PLATFORM(IOS)
+ CFRunLoopAddTimer(WebThreadRunLoop(), sharedTimer, kCFRunLoopCommonModes);
+#else
+ CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
+#endif
+
+ setupPowerObserver();
+
+ return;
+ }
+
+ CFRunLoopTimerSetNextFireDate(sharedTimer, fireDate);
+}
+
+void MainThreadSharedTimer::stop()
+{
+ if (!sharedTimer)
+ return;
+
+ CFRunLoopTimerSetNextFireDate(sharedTimer, kCFTimeIntervalDistantFuture);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcfSharedTimerCFcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1,133 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2010, 2015 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 "SharedTimer.h"
-
-#include <wtf/AutodrainedPool.h>
-
-#if PLATFORM(MAC)
-#import "PowerObserverMac.h"
-#elif PLATFORM(IOS)
-#import "WebCoreThread.h"
-#import "WebCoreThreadRun.h"
-#endif
-
-namespace WebCore {
-
-static CFRunLoopTimerRef sharedTimer;
-static void (*sharedTimerFiredFunction)();
-static void timerFired(CFRunLoopTimerRef, void*);
-static void restartSharedTimer();
-
-static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<CFTimeInterval>::max();
-
-#if PLATFORM(IOS)
-static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
-{
- WebThreadRun(^{
- restartSharedTimer();
- });
-}
-#endif
-
-static void setupPowerObserver()
-{
-#if PLATFORM(MAC)
- static PowerObserver* powerObserver;
- if (!powerObserver)
- powerObserver = std::make_unique<PowerObserver>(restartSharedTimer).release();
-#elif PLATFORM(IOS)
- static bool registeredForApplicationNotification = false;
- if (!registeredForApplicationNotification) {
- registeredForApplicationNotification = true;
- CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
- CFNotificationCenterAddObserver(notificationCenter, nullptr, applicationDidBecomeActive, CFSTR("UIApplicationDidBecomeActiveNotification"), nullptr, CFNotificationSuspensionBehaviorCoalesce);
- }
-#endif
-}
-
-void setSharedTimerFiredFunction(void (*f)())
-{
- ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == f);
-
- sharedTimerFiredFunction = f;
-}
-
-static void timerFired(CFRunLoopTimerRef, void*)
-{
- AutodrainedPool pool;
- sharedTimerFiredFunction();
-}
-
-static void restartSharedTimer()
-{
- if (!sharedTimer)
- return;
-
- stopSharedTimer();
- timerFired(0, 0);
-}
-
-void invalidateSharedTimer()
-{
- if (!sharedTimer)
- return;
-
- CFRunLoopTimerInvalidate(sharedTimer);
- CFRelease(sharedTimer);
- sharedTimer = nullptr;
-}
-
-void setSharedTimerFireInterval(double interval)
-{
- ASSERT(sharedTimerFiredFunction);
-
- CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
- if (!sharedTimer) {
- sharedTimer = CFRunLoopTimerCreate(nullptr, fireDate, kCFTimeIntervalDistantFuture, 0, 0, timerFired, nullptr);
-#if PLATFORM(IOS)
- CFRunLoopAddTimer(WebThreadRunLoop(), sharedTimer, kCFRunLoopCommonModes);
-#else
- CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
-#endif
-
- setupPowerObserver();
-
- return;
- }
-
- CFRunLoopTimerSetNextFireDate(sharedTimer, fireDate);
-}
-
-void stopSharedTimer()
-{
- if (!sharedTimer)
- return;
-
- CFRunLoopTimerSetNextFireDate(sharedTimer, kCFTimeIntervalDistantFuture);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformeflMainThreadSharedTimerEflcppfromrev191788trunkSourceWebCoreplatformeflSharedTimerEflcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp (from rev 191788, trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2008 Kenneth Rohde Christiansen
+ * (C) 2008 Afonso Rabelo Costa Jr.
+ * (C) 2009-2010 ProFUSION embedded systems
+ * (C) 2009-2010 Samsung Electronics
+ *
+ * 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 "MainThreadSharedTimer.h"
+
+#include <Ecore.h>
+#include <wtf/Assertions.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+static Ecore_Timer* sharedTimer;
+
+static Eina_Bool timerEvent(void*)
+{
+ sharedTimer = nullptr;
+ MainThreadSharedTimer::singleton().fired();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void MainThreadSharedTimer::stop()
+{
+ if (sharedTimer) {
+ ecore_timer_del(sharedTimer);
+ sharedTimer = nullptr;
+ }
+}
+
+void MainThreadSharedTimer::setFireInterval(double interval)
+{
+ stop();
+ sharedTimer = ecore_timer_loop_add(interval, timerEvent, nullptr);
+}
+
+void MainThreadSharedTimer::invalidate()
+{
+}
+
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformeflSharedTimerEflcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1,82 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Kenneth Rohde Christiansen
- * (C) 2008 Afonso Rabelo Costa Jr.
- * (C) 2009-2010 ProFUSION embedded systems
- * (C) 2009-2010 Samsung Electronics
- *
- * 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 "SharedTimer.h"
-
-#include <Ecore.h>
-#include <wtf/Assertions.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-static Ecore_Timer *_sharedTimer = 0;
-
-static void (*_timerFunction)();
-
-void setSharedTimerFiredFunction(void (*func)())
-{
- _timerFunction = func;
-}
-
-static Eina_Bool timerEvent(void*)
-{
- _sharedTimer = 0;
- if (_timerFunction)
- _timerFunction();
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-void stopSharedTimer()
-{
- if (_sharedTimer) {
- ecore_timer_del(_sharedTimer);
- _sharedTimer = 0;
- }
-}
-
-void addNewTimer(double interval)
-{
- stopSharedTimer();
-
- _sharedTimer = ecore_timer_loop_add(interval, timerEvent, 0);
-}
-
-void setSharedTimerFireInterval(double interval)
-{
- addNewTimer(interval);
-}
-
-void invalidateSharedTimer()
-{
-}
-
-}
-
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkMainThreadSharedTimerGtkcppfromrev191788trunkSourceWebCoreplatformgtkSharedTimerGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/gtk/MainThreadSharedTimerGtk.cpp (from rev 191788, trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/MainThreadSharedTimerGtk.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/gtk/MainThreadSharedTimerGtk.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * 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 "MainThreadSharedTimer.h"
+
+#include <wtf/glib/GMainLoopSource.h>
+
+namespace WebCore {
+
+static GMainLoopSource gSharedTimer;
+
+void MainThreadSharedTimer::setFireInterval(double interval)
+{
+ ASSERT(m_firedFunction);
+
+ // This is GDK_PRIORITY_REDRAW, but we don't want to depend on GDK here just to use a constant.
+ static const int priority = G_PRIORITY_HIGH_IDLE + 20;
+ gSharedTimer.scheduleAfterDelay("[WebKit] sharedTimerTimeoutCallback", [this] { fired(); },
+ std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(interval)), priority);
+}
+
+void MainThreadSharedTimer::stop()
+{
+ gSharedTimer.cancel();
+}
+
+void MainThreadSharedTimer::invalidate()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkSharedTimerGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * 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 "SharedTimer.h"
-
-#include <wtf/glib/GMainLoopSource.h>
-
-namespace WebCore {
-
-static GMainLoopSource gSharedTimer;
-static void (*sharedTimerFiredFunction)();
-
-void setSharedTimerFiredFunction(void (*f)())
-{
- sharedTimerFiredFunction = f;
- if (!sharedTimerFiredFunction)
- gSharedTimer.cancel();
-}
-
-void setSharedTimerFireInterval(double interval)
-{
- ASSERT(sharedTimerFiredFunction);
-
- // This is GDK_PRIORITY_REDRAW, but we don't want to depend on GDK here just to use a constant.
- static const int priority = G_PRIORITY_HIGH_IDLE + 20;
- gSharedTimer.scheduleAfterDelay("[WebKit] sharedTimerTimeoutCallback", std::function<void()>(sharedTimerFiredFunction),
- std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(interval)), priority);
-}
-
-void stopSharedTimer()
-{
- gSharedTimer.cancel();
-}
-
-void invalidateSharedTimer()
-{
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformwinMainThreadSharedTimerWincppfromrev191788trunkSourceWebCoreplatformwinSharedTimerWincpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp (from rev 191788, trunk/Source/WebCore/platform/win/SharedTimerWin.cpp) (0 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -0,0 +1,198 @@
</span><ins>+/*
+ * Copyright (C) 2006 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 "MainThreadSharedTimer.h"
+
+#include "Page.h"
+#include "Settings.h"
+#include "WebCoreInstanceHandle.h"
+#include "Widget.h"
+#include <wtf/Assertions.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/WindowsExtras.h>
+
+#include <mmsystem.h>
+
+// These aren't in winuser.h with the MSVS 2003 Platform SDK,
+// so use default values in that case.
+#ifndef USER_TIMER_MINIMUM
+#define USER_TIMER_MINIMUM 0x0000000A
+#endif
+
+#ifndef USER_TIMER_MAXIMUM
+#define USER_TIMER_MAXIMUM 0x7FFFFFFF
+#endif
+
+#ifndef QS_RAWINPUT
+#define QS_RAWINPUT 0x0400
+#endif
+
+namespace WebCore {
+
+static UINT timerID;
+
+static HANDLE timer;
+static HWND timerWindowHandle = 0;
+const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
+
+static UINT timerFiredMessage = 0;
+static HANDLE timerQueue;
+static bool highResTimerActive;
+static bool processingCustomTimerMessage = false;
+static LONG pendingTimers;
+
+const int timerResolution = 1; // To improve timer resolution, we call timeBeginPeriod/timeEndPeriod with this value to increase timer resolution to 1ms.
+const int highResolutionThresholdMsec = 16; // Only activate high-res timer for sub-16ms timers (Windows can fire timers at 16ms intervals without changing the system resolution).
+const int stopHighResTimerInMsec = 300; // Stop high-res timer after 0.3 seconds to lessen power consumption (we don't use a smaller time since oscillating between high and low resolution breaks timer accuracy on XP).
+
+enum {
+ sharedTimerID = 1000,
+ endHighResTimerID = 1001,
+};
+
+LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (message == WM_TIMER) {
+ if (wParam == sharedTimerID) {
+ KillTimer(timerWindowHandle, sharedTimerID);
+ MainThreadSharedTimer::singleton().fired();
+ } else if (wParam == endHighResTimerID) {
+ KillTimer(timerWindowHandle, endHighResTimerID);
+ highResTimerActive = false;
+ timeEndPeriod(timerResolution);
+ }
+ } else if (message == timerFiredMessage) {
+ InterlockedExchange(&pendingTimers, 0);
+ processingCustomTimerMessage = true;
+ MainThreadSharedTimer::singleton().fired();
+ processingCustomTimerMessage = false;
+ } else
+ return DefWindowProc(hWnd, message, wParam, lParam);
+
+ return 0;
+}
+
+static void initializeOffScreenTimerWindow()
+{
+ if (timerWindowHandle)
+ return;
+
+ WNDCLASSEX wcex;
+ memset(&wcex, 0, sizeof(WNDCLASSEX));
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.lpfnWndProc = TimerWindowWndProc;
+ wcex.hInstance = WebCore::instanceHandle();
+ wcex.lpszClassName = kTimerWindowClassName;
+ RegisterClassEx(&wcex);
+
+ timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, WebCore::instanceHandle(), 0);
+
+ timerFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.TimerFired");
+}
+
+static void NTAPI queueTimerProc(PVOID, BOOLEAN)
+{
+ if (InterlockedIncrement(&pendingTimers) == 1)
+ PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
+}
+
+void MainThreadSharedTimer::setFireInterval(double interval)
+{
+ ASSERT(m_firedFunction);
+
+ unsigned intervalInMS;
+ interval *= 1000;
+ if (interval > USER_TIMER_MAXIMUM)
+ intervalInMS = USER_TIMER_MAXIMUM;
+ else
+ intervalInMS = static_cast<unsigned>(interval);
+
+ initializeOffScreenTimerWindow();
+ bool timerSet = false;
+
+ if (Settings::shouldUseHighResolutionTimers()) {
+ if (interval < highResolutionThresholdMsec) {
+ if (!highResTimerActive) {
+ highResTimerActive = true;
+ timeBeginPeriod(timerResolution);
+ }
+ SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0);
+ }
+
+ DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT));
+
+ // Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER.
+
+ // If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism.
+ if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) {
+ if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) {
+ // Call PostMessage immediately if the timer is already expired, unless a paint is pending.
+ // (we prioritize paints over timers)
+ if (InterlockedIncrement(&pendingTimers) == 1)
+ PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
+ timerSet = true;
+ } else {
+ // Otherwise, delay the PostMessage via a CreateTimerQueueTimer
+ if (!timerQueue)
+ timerQueue = CreateTimerQueue();
+ if (timer)
+ DeleteTimerQueueTimer(timerQueue, timer, 0);
+ timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
+ }
+ }
+ }
+
+ if (timerSet) {
+ if (timerID) {
+ KillTimer(timerWindowHandle, timerID);
+ timerID = 0;
+ }
+ } else {
+ timerID = SetTimer(timerWindowHandle, sharedTimerID, intervalInMS, 0);
+ timer = 0;
+ }
+}
+
+void MainThreadSharedTimer::stop()
+{
+ if (timerQueue && timer) {
+ DeleteTimerQueueTimer(timerQueue, timer, 0);
+ timer = 0;
+ }
+
+ if (timerID) {
+ KillTimer(timerWindowHandle, timerID);
+ timerID = 0;
+ }
+}
+
+void MainThreadSharedTimer::invalidate()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformwinSharedTimerWincpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/win/SharedTimerWin.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/SharedTimerWin.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/platform/win/SharedTimerWin.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -1,205 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 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 "SharedTimer.h"
-
-#include "Page.h"
-#include "Settings.h"
-#include "WebCoreInstanceHandle.h"
-#include "Widget.h"
-#include <wtf/Assertions.h>
-#include <wtf/CurrentTime.h>
-#include <wtf/WindowsExtras.h>
-
-#include <mmsystem.h>
-
-// These aren't in winuser.h with the MSVS 2003 Platform SDK,
-// so use default values in that case.
-#ifndef USER_TIMER_MINIMUM
-#define USER_TIMER_MINIMUM 0x0000000A
-#endif
-
-#ifndef USER_TIMER_MAXIMUM
-#define USER_TIMER_MAXIMUM 0x7FFFFFFF
-#endif
-
-#ifndef QS_RAWINPUT
-#define QS_RAWINPUT 0x0400
-#endif
-
-namespace WebCore {
-
-static UINT timerID;
-static void (*sharedTimerFiredFunction)();
-
-static HANDLE timer;
-static HWND timerWindowHandle = 0;
-const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
-
-static UINT timerFiredMessage = 0;
-static HANDLE timerQueue;
-static bool highResTimerActive;
-static bool processingCustomTimerMessage = false;
-static LONG pendingTimers;
-
-const int timerResolution = 1; // To improve timer resolution, we call timeBeginPeriod/timeEndPeriod with this value to increase timer resolution to 1ms.
-const int highResolutionThresholdMsec = 16; // Only activate high-res timer for sub-16ms timers (Windows can fire timers at 16ms intervals without changing the system resolution).
-const int stopHighResTimerInMsec = 300; // Stop high-res timer after 0.3 seconds to lessen power consumption (we don't use a smaller time since oscillating between high and low resolution breaks timer accuracy on XP).
-
-enum {
- sharedTimerID = 1000,
- endHighResTimerID = 1001,
-};
-
-LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- if (message == WM_TIMER) {
- if (wParam == sharedTimerID) {
- KillTimer(timerWindowHandle, sharedTimerID);
- sharedTimerFiredFunction();
- }
- else if (wParam == endHighResTimerID) {
- KillTimer(timerWindowHandle, endHighResTimerID);
- highResTimerActive = false;
- timeEndPeriod(timerResolution);
- }
- } else if (message == timerFiredMessage) {
- InterlockedExchange(&pendingTimers, 0);
- processingCustomTimerMessage = true;
- sharedTimerFiredFunction();
- processingCustomTimerMessage = false;
- } else
- return DefWindowProc(hWnd, message, wParam, lParam);
-
- return 0;
-}
-
-static void initializeOffScreenTimerWindow()
-{
- if (timerWindowHandle)
- return;
-
- WNDCLASSEX wcex;
- memset(&wcex, 0, sizeof(WNDCLASSEX));
- wcex.cbSize = sizeof(WNDCLASSEX);
-
- wcex.lpfnWndProc = TimerWindowWndProc;
- wcex.hInstance = WebCore::instanceHandle();
- wcex.lpszClassName = kTimerWindowClassName;
- RegisterClassEx(&wcex);
-
- timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0,
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, WebCore::instanceHandle(), 0);
-
- timerFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.TimerFired");
-}
-
-void setSharedTimerFiredFunction(void (*f)())
-{
- sharedTimerFiredFunction = f;
-}
-
-static void NTAPI queueTimerProc(PVOID, BOOLEAN)
-{
- if (InterlockedIncrement(&pendingTimers) == 1)
- PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
-}
-
-void setSharedTimerFireInterval(double interval)
-{
- ASSERT(sharedTimerFiredFunction);
-
- unsigned intervalInMS;
- interval *= 1000;
- if (interval > USER_TIMER_MAXIMUM)
- intervalInMS = USER_TIMER_MAXIMUM;
- else
- intervalInMS = static_cast<unsigned>(interval);
-
- initializeOffScreenTimerWindow();
- bool timerSet = false;
-
- if (Settings::shouldUseHighResolutionTimers()) {
- if (interval < highResolutionThresholdMsec) {
- if (!highResTimerActive) {
- highResTimerActive = true;
- timeBeginPeriod(timerResolution);
- }
- SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0);
- }
-
- DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT));
-
- // Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER.
-
- // If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism.
- if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) {
- if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) {
- // Call PostMessage immediately if the timer is already expired, unless a paint is pending.
- // (we prioritize paints over timers)
- if (InterlockedIncrement(&pendingTimers) == 1)
- PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
- timerSet = true;
- } else {
- // Otherwise, delay the PostMessage via a CreateTimerQueueTimer
- if (!timerQueue)
- timerQueue = CreateTimerQueue();
- if (timer)
- DeleteTimerQueueTimer(timerQueue, timer, 0);
- timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
- }
- }
- }
-
- if (timerSet) {
- if (timerID) {
- KillTimer(timerWindowHandle, timerID);
- timerID = 0;
- }
- } else {
- timerID = SetTimer(timerWindowHandle, sharedTimerID, intervalInMS, 0);
- timer = 0;
- }
-}
-
-void stopSharedTimer()
-{
- if (timerQueue && timer) {
- DeleteTimerQueueTimer(timerQueue, timer, 0);
- timer = 0;
- }
-
- if (timerID) {
- KillTimer(timerWindowHandle, timerID);
- timerID = 0;
- }
-}
-
-void invalidateSharedTimer()
-{
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerRunLoopcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerRunLoop.cpp (191788 => 191789)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerRunLoop.cpp        2015-10-30 12:46:55 UTC (rev 191788)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.cpp        2015-10-30 13:25:26 UTC (rev 191789)
</span><span class="lines">@@ -41,26 +41,20 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class WorkerSharedTimer : public SharedTimer {
</del><ins>+class WorkerSharedTimer final : public SharedTimer {
</ins><span class="cx"> public:
</span><del>- WorkerSharedTimer()
- : m_sharedTimerFunction(0)
- , m_nextFireTime(0)
- {
- }
-
</del><span class="cx"> // SharedTimer interface.
</span><del>- virtual void setFiredFunction(void (*function)()) { m_sharedTimerFunction = function; }
- virtual void setFireInterval(double interval) { m_nextFireTime = interval + currentTime(); }
- virtual void stop() { m_nextFireTime = 0; }
</del><ins>+ virtual void setFiredFunction(std::function<void()>&& function) override { m_sharedTimerFunction = WTF::move(function); }
+ virtual void setFireInterval(double interval) override { m_nextFireTime = interval + currentTime(); }
+ virtual void stop() override { m_nextFireTime = 0; }
</ins><span class="cx">
</span><span class="cx"> bool isActive() { return m_sharedTimerFunction && m_nextFireTime; }
</span><span class="cx"> double fireTime() { return m_nextFireTime; }
</span><span class="cx"> void fire() { m_sharedTimerFunction(); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- void (*m_sharedTimerFunction)();
- double m_nextFireTime;
</del><ins>+ std::function<void()> m_sharedTimerFunction;
+ double m_nextFireTime { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class ModePredicate {
</span></span></pre>
</div>
</div>
</body>
</html>