<!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>[181671] 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/181671">181671</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-03-17 16:42:46 -0700 (Tue, 17 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac][iOS] setSharedTimerFireInterval() / stopSharedTimer() are expensive
https://bugs.webkit.org/show_bug.cgi?id=142752
&lt;rdar://problem/20176731&gt;

Reviewed by Antti Koivisto.

setSharedTimerFireInterval() / stopSharedTimer() are expensive on Mac
and iOS on pages using a lot of timers.

For example, on bing.com / iOS, ~15.4% of the CPU time is spent in
setSharedTimerFireInterval() and ~14.7% of the CPU time is spent in
stopSharedTimer(). The expensive calls are CFRunLoopAddTimer (11.4%),
CFRunLoopTimerInvalidate (14.1%), CFRunLoopTimerCreate (3.3%).

The issue is that we keep creating, adding to run loop modes, and then
destroying the sharedTimer for each firing event. This is very
expensive. In such case, the CFRunLoopTimerRef documentation advises to
&quot;&quot;&quot;
... create a repeating timer with an initial firing time in the distant
future (or the initial firing time) and a very large repeat interval—on
the order of decades or more—and add it to all the necessary run loop
modes. Then, when you know when the timer should fire next, you reset
the firing time with CFRunLoopTimerSetNextFireDate, perhaps from the
timer’s own callback function. This technique effectively produces a
reusable, asynchronous timer.
&quot;&quot;&quot; [1].

Doing so greatly decreases CPU time spend in:
- setSharedTimerFireInterval(): 15.4% -&gt; 4.6%
- stopSharedTimer(): 14.6% -&gt; 8.6%

Overall CPU time spent on bing.com in timerFired() goes down from
~61.2% to ~49.5%.

This patch also refactors the SharedTimer code to share as much as
possible between Mac and iOS.

This patch is based in part on the following patch:
http://trac.webkit.org/changeset/143210

[1] https://developer.apple.com/library/prerelease/ios/documentation/CoreFoundation/Reference/CFRunLoopTimerRef/index.html#//apple_ref/c/func/CFRunLoopTimerSetNextFireDate

* WebCore.xcodeproj/project.pbxproj:
* platform/SharedTimer.h:
(WebCore::SharedTimer::invalidate):
(WebCore::MainThreadSharedTimer::setFiredFunction): Deleted.
(WebCore::MainThreadSharedTimer::setFireInterval): Deleted.
(WebCore::MainThreadSharedTimer::stop): Deleted.
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::fireTimersInNestedEventLoop):
* platform/cf/SharedTimerCF.mm: Added.
(WebCore::applicationDidBecomeActive):
(WebCore::setupPowerObserver):
(WebCore::setSharedTimerFiredFunction):
(WebCore::timerFired):
(WebCore::restartSharedTimer):
(WebCore::invalidateSharedTimer):
(WebCore::setSharedTimerFireInterval):
(WebCore::stopSharedTimer):
* platform/efl/SharedTimerEfl.cpp:
(WebCore::invalidateSharedTimer):
* platform/gtk/SharedTimerGtk.cpp:
(WebCore::invalidateSharedTimer):
* platform/ios/SharedTimerIOS.mm: Removed.
* platform/mac/PowerObserverMac.h: Copied from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
* platform/mac/PowerObserverMac.mm: Renamed from Source/WebCore/platform/mac/SharedTimerMac.mm.
(WebCore::PowerObserver::PowerObserver):
(WebCore::PowerObserver::~PowerObserver):
(WebCore::PowerObserver::didReceiveSystemPowerNotification):
* platform/win/SharedTimerWin.cpp:
(WebCore::removeSharedTimer):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#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>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcfSharedTimerCFmm">trunk/Source/WebCore/platform/cf/SharedTimerCF.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPowerObserverMach">trunk/Source/WebCore/platform/mac/PowerObserverMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPowerObserverMacmm">trunk/Source/WebCore/platform/mac/PowerObserverMac.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosSharedTimerIOSmm">trunk/Source/WebCore/platform/ios/SharedTimerIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacSharedTimerMacmm">trunk/Source/WebCore/platform/mac/SharedTimerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/ChangeLog        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2015-03-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [Mac][iOS] setSharedTimerFireInterval() / stopSharedTimer() are expensive
+        https://bugs.webkit.org/show_bug.cgi?id=142752
+        &lt;rdar://problem/20176731&gt;
+
+        Reviewed by Antti Koivisto.
+
+        setSharedTimerFireInterval() / stopSharedTimer() are expensive on Mac
+        and iOS on pages using a lot of timers.
+
+        For example, on bing.com / iOS, ~15.4% of the CPU time is spent in
+        setSharedTimerFireInterval() and ~14.7% of the CPU time is spent in
+        stopSharedTimer(). The expensive calls are CFRunLoopAddTimer (11.4%),
+        CFRunLoopTimerInvalidate (14.1%), CFRunLoopTimerCreate (3.3%).
+
+        The issue is that we keep creating, adding to run loop modes, and then
+        destroying the sharedTimer for each firing event. This is very
+        expensive. In such case, the CFRunLoopTimerRef documentation advises to
+        &quot;&quot;&quot;
+        ... create a repeating timer with an initial firing time in the distant
+        future (or the initial firing time) and a very large repeat interval—on
+        the order of decades or more—and add it to all the necessary run loop
+        modes. Then, when you know when the timer should fire next, you reset
+        the firing time with CFRunLoopTimerSetNextFireDate, perhaps from the
+        timer’s own callback function. This technique effectively produces a
+        reusable, asynchronous timer.
+        &quot;&quot;&quot; [1].
+
+        Doing so greatly decreases CPU time spend in:
+        - setSharedTimerFireInterval(): 15.4% -&gt; 4.6%
+        - stopSharedTimer(): 14.6% -&gt; 8.6%
+
+        Overall CPU time spent on bing.com in timerFired() goes down from
+        ~61.2% to ~49.5%.
+
+        This patch also refactors the SharedTimer code to share as much as
+        possible between Mac and iOS.
+
+        This patch is based in part on the following patch:
+        http://trac.webkit.org/changeset/143210
+
+        [1] https://developer.apple.com/library/prerelease/ios/documentation/CoreFoundation/Reference/CFRunLoopTimerRef/index.html#//apple_ref/c/func/CFRunLoopTimerSetNextFireDate
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/SharedTimer.h:
+        (WebCore::SharedTimer::invalidate):
+        (WebCore::MainThreadSharedTimer::setFiredFunction): Deleted.
+        (WebCore::MainThreadSharedTimer::setFireInterval): Deleted.
+        (WebCore::MainThreadSharedTimer::stop): Deleted.
+        * platform/ThreadTimers.cpp:
+        (WebCore::ThreadTimers::fireTimersInNestedEventLoop):
+        * platform/cf/SharedTimerCF.mm: Added.
+        (WebCore::applicationDidBecomeActive):
+        (WebCore::setupPowerObserver):
+        (WebCore::setSharedTimerFiredFunction):
+        (WebCore::timerFired):
+        (WebCore::restartSharedTimer):
+        (WebCore::invalidateSharedTimer):
+        (WebCore::setSharedTimerFireInterval):
+        (WebCore::stopSharedTimer):
+        * platform/efl/SharedTimerEfl.cpp:
+        (WebCore::invalidateSharedTimer):
+        * platform/gtk/SharedTimerGtk.cpp:
+        (WebCore::invalidateSharedTimer):
+        * platform/ios/SharedTimerIOS.mm: Removed.
+        * platform/mac/PowerObserverMac.h: Copied from Source/WebCore/platform/efl/SharedTimerEfl.cpp.
+        * platform/mac/PowerObserverMac.mm: Renamed from Source/WebCore/platform/mac/SharedTimerMac.mm.
+        (WebCore::PowerObserver::PowerObserver):
+        (WebCore::PowerObserver::~PowerObserver):
+        (WebCore::PowerObserver::didReceiveSystemPowerNotification):
+        * platform/win/SharedTimerWin.cpp:
+        (WebCore::removeSharedTimer):
+
</ins><span class="cx"> 2015-03-17  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cannot invoke action menus anymore
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -1638,6 +1638,9 @@
</span><span class="cx">                 4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
</span><span class="cx">                 46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */; };
</span><span class="cx">                 46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                46D791141AB89A9B001B696B /* SharedTimerCF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46D791131AB89A9B001B696B /* SharedTimerCF.mm */; };
+                46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; };
+                46DBB6511AB8C96F00D9A813 /* PowerObserverMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */; };
</ins><span class="cx">                 46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
</span><span class="cx">                 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
</span><span class="lines">@@ -3308,7 +3311,6 @@
</span><span class="cx">                 93309E20099E64920056E581 /* VisiblePosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DD1099E64910056E581 /* VisiblePosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93309E23099E64920056E581 /* WrapContentsInDummySpanCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309DD4099E64910056E581 /* WrapContentsInDummySpanCommand.cpp */; };
</span><span class="cx">                 93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */; };
</span><del>-                93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93309E9F099EB78C0056E581 /* SharedTimerMac.mm */; };
</del><span class="cx">                 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309EA0099EB78C0056E581 /* SharedTimer.h */; };
</span><span class="cx">                 93309EA4099EB78C0056E581 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309EA1099EB78C0056E581 /* Timer.cpp */; };
</span><span class="cx">                 93354A3C0B24F8C9003F6DEA /* UIEventWithKeyState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */; };
</span><span class="lines">@@ -6234,7 +6236,6 @@
</span><span class="cx">                 E453901E0EAFCACA003695C8 /* PasteboardIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390190EAFCACA003695C8 /* PasteboardIOS.mm */; };
</span><span class="cx">                 E45390430EAFD637003695C8 /* PlatformScreenIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */; };
</span><span class="cx">                 E45390450EAFD637003695C8 /* ScrollViewIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390340EAFD637003695C8 /* ScrollViewIOS.mm */; };
</span><del>-                E45390460EAFD637003695C8 /* SharedTimerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390350EAFD637003695C8 /* SharedTimerIOS.mm */; };
</del><span class="cx">                 E45390470EAFD637003695C8 /* SoundIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390360EAFD637003695C8 /* SoundIOS.mm */; };
</span><span class="cx">                 E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
</span><span class="cx">                 E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
</span><span class="lines">@@ -8767,6 +8768,9 @@
</span><span class="cx">                 4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileMetadata.h; path = platform/FileMetadata.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeoNotifier.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                46D791131AB89A9B001B696B /* SharedTimerCF.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedTimerCF.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PowerObserverMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 49291E4A134172C800E753DE /* ImageRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageRenderingMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -10519,7 +10523,6 @@
</span><span class="cx">                 93309DD1099E64910056E581 /* VisiblePosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisiblePosition.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93309DD4099E64910056E581 /* WrapContentsInDummySpanCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WrapContentsInDummySpanCommand.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WrapContentsInDummySpanCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                93309E9F099EB78C0056E581 /* SharedTimerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedTimerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 93309EA0099EB78C0056E581 /* SharedTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedTimer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93309EA1099EB78C0056E581 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9332AB3D16515D7700D827EC /* GraphicsContext3DNEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DNEON.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13813,7 +13816,6 @@
</span><span class="cx">                 E45390190EAFCACA003695C8 /* PasteboardIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PasteboardIOS.mm; path = ios/PasteboardIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformScreenIOS.mm; path = ios/PlatformScreenIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E45390340EAFD637003695C8 /* ScrollViewIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ScrollViewIOS.mm; path = ios/ScrollViewIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E45390350EAFD637003695C8 /* SharedTimerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SharedTimerIOS.mm; path = ios/SharedTimerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 E45390360EAFD637003695C8 /* SoundIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SoundIOS.mm; path = ios/SoundIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebCoreSystemInterfaceIOS.mm; path = ios/WebCoreSystemInterfaceIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WidgetIOS.mm; path = ios/WidgetIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15205,6 +15207,7 @@
</span><span class="cx">                                 2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */,
</span><span class="cx">                                 2D76BB801945632400CFD29A /* RunLoopObserver.h */,
</span><span class="cx">                                 512DD8E20D91E2B4000F89EE /* SharedBufferCF.cpp */,
</span><ins>+                                46D791131AB89A9B001B696B /* SharedTimerCF.mm */,
</ins><span class="cx">                                 1A98956A0AA78F80005EF5EF /* URLCF.cpp */,
</span><span class="cx">                                 5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */,
</span><span class="cx">                                 5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */,
</span><span class="lines">@@ -16659,6 +16662,8 @@
</span><span class="cx">                                 C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
</span><span class="cx">                                 BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
</span><span class="cx">                                 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
</span><ins>+                                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */,
+                                46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */,
</ins><span class="cx">                                 0081FEFE16B0A2B6008AAA7A /* PublicSuffixMac.mm */,
</span><span class="cx">                                 BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */,
</span><span class="cx">                                 BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */,
</span><span class="lines">@@ -16668,7 +16673,6 @@
</span><span class="cx">                                 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */,
</span><span class="cx">                                 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */,
</span><span class="cx">                                 1A4A95510B4EDCFF002D8C3C /* SharedBufferMac.mm */,
</span><del>-                                93309E9F099EB78C0056E581 /* SharedTimerMac.mm */,
</del><span class="cx">                                 0A4844980CA44CB200B7BD48 /* SoftLinking.h */,
</span><span class="cx">                                 4B3043C80AE0371D00A82647 /* SoundMac.mm */,
</span><span class="cx">                                 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.cpp */,
</span><span class="lines">@@ -18729,7 +18733,6 @@
</span><span class="cx">                                 E45390340EAFD637003695C8 /* ScrollViewIOS.mm */,
</span><span class="cx">                                 BEA807C60F714A0300524199 /* SelectionRect.cpp */,
</span><span class="cx">                                 BEA807C70F714A0300524199 /* SelectionRect.h */,
</span><del>-                                E45390350EAFD637003695C8 /* SharedTimerIOS.mm */,
</del><span class="cx">                                 E45390360EAFD637003695C8 /* SoundIOS.mm */,
</span><span class="cx">                                 4476531A133170990006B789 /* SSLKeyGeneratorIOS.cpp */,
</span><span class="cx">                                 0F03C0731884695E00A5F8CA /* SystemMemory.h */,
</span><span class="lines">@@ -26831,6 +26834,7 @@
</span><span class="cx">                                 BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */,
</span><span class="cx">                                 CDE83DB2183C44060031EAA3 /* VideoPlaybackQuality.h in Headers */,
</span><span class="cx">                                 07C59B5717F4AC15000FBCBB /* VideoStreamTrack.h in Headers */,
</span><ins>+                                46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */,
</ins><span class="cx">                                 BE88E0DF1715D2A200658D98 /* VideoTrack.h in Headers */,
</span><span class="cx">                                 BE88E0E21715D2A200658D98 /* VideoTrackList.h in Headers */,
</span><span class="cx">                                 CD8B5A46180DFF4E008B8E65 /* VideoTrackMediaSource.h in Headers */,
</span><span class="lines">@@ -27968,6 +27972,7 @@
</span><span class="cx">                                 9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */,
</span><span class="cx">                                 4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */,
</span><span class="cx">                                 93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
</span><ins>+                                46D791141AB89A9B001B696B /* SharedTimerCF.mm in Sources */,
</ins><span class="cx">                                 0760C17A1AA8FC7D009ED7B8 /* MediaPlaybackTargetMac.mm in Sources */,
</span><span class="cx">                                 FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */,
</span><span class="cx">                                 ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
</span><span class="lines">@@ -29335,6 +29340,7 @@
</span><span class="cx">                                 B27535630B053814002CE64F /* PathCG.cpp in Sources */,
</span><span class="cx">                                 A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */,
</span><span class="cx">                                 A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */,
</span><ins>+                                46DBB6511AB8C96F00D9A813 /* PowerObserverMac.mm in Sources */,
</ins><span class="cx">                                 A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */,
</span><span class="cx">                                 B27535640B053814002CE64F /* PDFDocumentImage.cpp in Sources */,
</span><span class="cx">                                 2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */,
</span><span class="lines">@@ -29692,8 +29698,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>-                                E45390460EAFD637003695C8 /* SharedTimerIOS.mm in Sources */,
-                                93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */,
</del><span class="cx">                                 B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */,
</span><span class="cx">                                 163E88F7118A39D200ED9231 /* SimpleFontDataCoreText.cpp in Sources */,
</span><span class="cx">                                 E48944A2180B57D800F165D8 /* SimpleLineLayout.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformSharedTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/SharedTimer.h (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/SharedTimer.h        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/SharedTimer.h        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><span class="cx">         // The fire interval is in seconds relative to the current monotonic clock time.
</span><span class="cx">         virtual void setFireInterval(double) = 0;
</span><span class="cx">         virtual void stop() = 0;
</span><ins>+
+        virtual void invalidate() { }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -52,24 +54,30 @@
</span><span class="cx">     void setSharedTimerFiredFunction(void (*)());
</span><span class="cx">     void setSharedTimerFireInterval(double);
</span><span class="cx">     void stopSharedTimer();
</span><ins>+    void invalidateSharedTimer();
</ins><span class="cx"> 
</span><span class="cx">     // Implementation of SharedTimer for the main thread.
</span><del>-    class MainThreadSharedTimer : public SharedTimer {
</del><ins>+    class MainThreadSharedTimer final : public SharedTimer {
</ins><span class="cx">     public:
</span><del>-        virtual void setFiredFunction(void (*function)())
</del><ins>+        void setFiredFunction(void (*function)()) override
</ins><span class="cx">         {
</span><span class="cx">             setSharedTimerFiredFunction(function);
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        virtual void setFireInterval(double interval)
</del><ins>+        void setFireInterval(double interval) override
</ins><span class="cx">         {
</span><span class="cx">             setSharedTimerFireInterval(interval);
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        virtual void stop()
</del><ins>+        void stop() override
</ins><span class="cx">         {
</span><span class="cx">             stopSharedTimer();
</span><span class="cx">         }
</span><ins>+
+        void invalidate() override
+        {
+            invalidateSharedTimer();
+        }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThreadTimerscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThreadTimers.cpp (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThreadTimers.cpp        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/ThreadTimers.cpp        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -145,6 +145,12 @@
</span><span class="cx"> {
</span><span class="cx">     // Reset the reentrancy guard so the timers can fire again.
</span><span class="cx">     m_firingTimers = false;
</span><ins>+
+    if (m_sharedTimer) {
+        m_sharedTimer-&gt;invalidate();
+        m_pendingSharedTimerFireTime = 0;
+    }
+
</ins><span class="cx">     updateSharedTimer();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfSharedTimerCFmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/cf/SharedTimerCF.mm (0 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/SharedTimerCF.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/cf/SharedTimerCF.mm        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -0,0 +1,127 @@
</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 &quot;config.h&quot;
+#import &quot;SharedTimer.h&quot;
+
+#if PLATFORM(MAC)
+#import &quot;PowerObserverMac.h&quot;
+#elif PLATFORM(IOS)
+#import &quot;WebCoreThreadRun.h&quot;
+#endif
+
+namespace WebCore {
+
+static CFRunLoopTimerRef sharedTimer;
+static void (*sharedTimerFiredFunction)();
+static void timerFired(CFRunLoopTimerRef, void*);
+static void restartSharedTimer();
+
+static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits&lt;CFTimeInterval&gt;::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&lt;PowerObserver&gt;(restartSharedTimer).release();
+#elif PLATFORM(IOS)
+    static bool registeredForApplicationNotification = false;
+    if (!registeredForApplicationNotification) {
+        registeredForApplicationNotification = true;
+        CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
+        CFNotificationCenterAddObserver(notificationCenter, 0, applicationDidBecomeActive, CFSTR(&quot;UIApplicationDidBecomeActiveNotification&quot;), NULL, CFNotificationSuspensionBehaviorCoalesce);
+    }
+#endif
+}
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+    ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == f);
+
+    sharedTimerFiredFunction = f;
+}
+
+static void timerFired(CFRunLoopTimerRef, void*)
+{
+    @autoreleasepool {
+        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);
+        CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
+
+        setupPowerObserver();
+
+        return;
+    }
+
+    CFRunLoopTimerSetNextFireDate(sharedTimer, fireDate);
+}
+
+void stopSharedTimer()
+{
+    if (!sharedTimer)
+        return;
+
+    CFRunLoopTimerSetNextFireDate(sharedTimer, kCFTimeIntervalDistantFuture);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformeflSharedTimerEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -74,5 +74,9 @@
</span><span class="cx">     addNewTimer(interval);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void invalidateSharedTimer()
+{
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkSharedTimerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/gtk/SharedTimerGtk.cpp        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -57,4 +57,8 @@
</span><span class="cx">     gSharedTimer.cancel();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void invalidateSharedTimer()
+{
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosSharedTimerIOSmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/SharedTimerIOS.mm (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/SharedTimerIOS.mm        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/ios/SharedTimerIOS.mm        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2010, 2011, 2013 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. AND ITS CONTRIBUTORS ``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 ITS 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 &quot;config.h&quot;
-#import &quot;SharedTimer.h&quot;
-
-#import &quot;WebCoreThread.h&quot;
-#import &quot;WebCoreThreadRun.h&quot;
-#import &lt;wtf/Assertions.h&gt;
-
-using namespace WebCore;
-
-namespace WebCore {
-static CFRunLoopTimerRef sharedTimer;
-static void timerFired(CFRunLoopTimerRef, void*);
-
-static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
-{
-    WebThreadRun(^{
-        if (!sharedTimer)
-            return;
-
-        stopSharedTimer();
-        timerFired(0, 0);
-    });
-}
-
-typedef void (*SharedTimerFiredFunction)();
-static SharedTimerFiredFunction sharedTimerFiredFunction;
-
-void setSharedTimerFiredFunction(SharedTimerFiredFunction function)
-{
-    ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == function);
-
-    sharedTimerFiredFunction = function;
-}
-
-static void timerFired(CFRunLoopTimerRef, void*)
-{
-    @autoreleasepool {
-        sharedTimerFiredFunction();
-    }
-}
-
-void setSharedTimerFireInterval(double interval)
-{
-    ASSERT(sharedTimerFiredFunction);
-
-    if (sharedTimer) {
-        CFRunLoopTimerInvalidate(sharedTimer);
-        CFRelease(sharedTimer);
-    }
-
-    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
-    sharedTimer = CFRunLoopTimerCreate(0, fireDate, 0, 0, 0, timerFired, 0);
-    CFRunLoopAddTimer(WebThreadRunLoop(), sharedTimer, kCFRunLoopCommonModes);
-
-    static bool registeredForApplicationNotification = false;
-    if (!registeredForApplicationNotification) {
-        registeredForApplicationNotification = true;
-        CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
-        CFNotificationCenterAddObserver(notificationCenter, 0, applicationDidBecomeActive, CFSTR(&quot;UIApplicationDidBecomeActiveNotification&quot;), NULL, CFNotificationSuspensionBehaviorCoalesce);
-    }
-}
-
-void stopSharedTimer()
-{
-    if (!sharedTimer)
-        return;
-
-    CFRunLoopTimerInvalidate(sharedTimer);
-    CFRelease(sharedTimer);
-    sharedTimer = 0;
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPowerObserverMachfromrev181670trunkSourceWebCoreplatformeflSharedTimerEflcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/mac/PowerObserverMac.h (from rev 181670, trunk/Source/WebCore/platform/efl/SharedTimerEfl.cpp) (0 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PowerObserverMac.h                                (rev 0)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.h        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -0,0 +1,56 @@
</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.
+ */
+
+#ifndef PowerObserverMac_h
+#define PowerObserverMac_h
+
+#import &lt;IOKit/IOMessage.h&gt;
+#import &lt;IOKit/pwr_mgt/IOPMLib.h&gt;
+#import &lt;functional&gt;
+#import &lt;wtf/Noncopyable.h&gt;
+
+namespace WebCore {
+
+class PowerObserver {
+    WTF_MAKE_NONCOPYABLE(PowerObserver);
+
+public:
+    PowerObserver(const std::function&lt;void()&gt;&amp; powerOnHander);
+    ~PowerObserver();
+
+private:
+    void didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument);
+
+    std::function&lt;void()&gt; m_powerOnHander;
+    io_connect_t m_powerConnection;
+    IONotificationPortRef m_notificationPort;
+    io_object_t m_notifierReference;
+    dispatch_queue_t m_dispatchQueue;
+};
+
+} // namespace WebCore
+
+#endif // PowerObserverMac_h
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPowerObserverMacmmfromrev181670trunkSourceWebCoreplatformmacSharedTimerMacmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/mac/PowerObserverMac.mm (from rev 181670, trunk/Source/WebCore/platform/mac/SharedTimerMac.mm) (0 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PowerObserverMac.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.mm        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -0,0 +1,77 @@
</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 &quot;config.h&quot;
+
+#if PLATFORM(MAC)
+#import &quot;PowerObserverMac.h&quot;
+
+namespace WebCore {
+
+PowerObserver::PowerObserver(const std::function&lt;void()&gt;&amp; powerOnHander)
+    : m_powerOnHander(powerOnHander)
+    , m_powerConnection(0)
+    , m_notificationPort(nullptr)
+    , m_notifierReference(0)
+    , m_dispatchQueue(dispatch_queue_create(&quot;com.apple.WebKit.PowerObserver&quot;, 0))
+{
+    m_powerConnection = IORegisterForSystemPower(this, &amp;m_notificationPort, [](void* context, io_service_t service, uint32_t messageType, void* messageArgument) {
+        static_cast&lt;PowerObserver*&gt;(context)-&gt;didReceiveSystemPowerNotification(service, messageType, messageArgument);
+    }, &amp;m_notifierReference);
+    if (!m_powerConnection)
+        return;
+
+    IONotificationPortSetDispatchQueue(m_notificationPort, m_dispatchQueue);
+}
+
+PowerObserver::~PowerObserver()
+{
+    if (!m_powerConnection)
+        return;
+
+    dispatch_release(m_dispatchQueue);
+
+    IODeregisterForSystemPower(&amp;m_notifierReference);
+    IOServiceClose(m_powerConnection);
+    IONotificationPortDestroy(m_notificationPort);
+}
+
+void PowerObserver::didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument)
+{
+    IOAllowPowerChange(m_powerConnection, reinterpret_cast&lt;long&gt;(messageArgument));
+
+    // We only care about the &quot;wake from sleep&quot; message.
+    if (messageType != kIOMessageSystemWillPowerOn)
+        return;
+
+    // We need to restart the timer on the main thread.
+    CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^() {
+        m_powerOnHander();
+    });
+}
+
+} // namespace WebCore
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacSharedTimerMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/SharedTimerMac.mm (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/SharedTimerMac.mm        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/mac/SharedTimerMac.mm        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -1,154 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2010 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 &quot;config.h&quot;
-#import &quot;SharedTimer.h&quot;
-
-#import &lt;IOKit/IOMessage.h&gt;
-#import &lt;IOKit/pwr_mgt/IOPMLib.h&gt;
-#import &lt;stdio.h&gt;
-#import &lt;wtf/Assertions.h&gt;
-#import &lt;wtf/Noncopyable.h&gt;
-#import &lt;wtf/PassOwnPtr.h&gt;
-
-namespace WebCore {
-
-static CFRunLoopTimerRef sharedTimer;
-static void (*sharedTimerFiredFunction)();
-static void timerFired(CFRunLoopTimerRef, void*);
-
-class PowerObserver {
-    WTF_MAKE_NONCOPYABLE(PowerObserver);
-    
-public:
-    PowerObserver();
-    ~PowerObserver();
-
-private:
-    void didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument);
-
-    void restartSharedTimer();
-
-    io_connect_t m_powerConnection;
-    IONotificationPortRef m_notificationPort;
-    io_object_t m_notifierReference;
-    dispatch_queue_t m_dispatchQueue;
-};
-
-PowerObserver::PowerObserver()
-    : m_powerConnection(0)
-    , m_notificationPort(nullptr)
-    , m_notifierReference(0)
-    , m_dispatchQueue(dispatch_queue_create(&quot;com.apple.WebKit.PowerObserver&quot;, 0))
-{
-    m_powerConnection = IORegisterForSystemPower(this, &amp;m_notificationPort, [](void* context, io_service_t service, uint32_t messageType, void* messageArgument) {
-        static_cast&lt;PowerObserver*&gt;(context)-&gt;didReceiveSystemPowerNotification(service, messageType, messageArgument);
-    }, &amp;m_notifierReference);
-    if (!m_powerConnection)
-        return;
-
-    IONotificationPortSetDispatchQueue(m_notificationPort, m_dispatchQueue);
-}
-
-PowerObserver::~PowerObserver()
-{
-    if (!m_powerConnection)
-        return;
-
-    dispatch_release(m_dispatchQueue);
-
-    IODeregisterForSystemPower(&amp;m_notifierReference);
-    IOServiceClose(m_powerConnection);
-    IONotificationPortDestroy(m_notificationPort);
-}
-
-void PowerObserver::didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument)
-{
-    IOAllowPowerChange(m_powerConnection, reinterpret_cast&lt;long&gt;(messageArgument));
-
-    // We only care about the &quot;wake from sleep&quot; message.
-    if (messageType != kIOMessageSystemWillPowerOn)
-        return;
-
-    // We need to restart the timer on the main thread.
-    CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^() {
-        restartSharedTimer();
-    });
-}
-
-void PowerObserver::restartSharedTimer()
-{
-    ASSERT(CFRunLoopGetCurrent() == CFRunLoopGetMain());
-
-    if (!sharedTimer)
-        return;
-
-    stopSharedTimer();
-    timerFired(0, 0);
-}
-
-static PowerObserver* powerObserver;
-
-void setSharedTimerFiredFunction(void (*f)())
-{
-    ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == f);
-
-    sharedTimerFiredFunction = f;
-}
-
-static void timerFired(CFRunLoopTimerRef, void*)
-{
-    @autoreleasepool {
-        sharedTimerFiredFunction();
-    }
-}
-
-void setSharedTimerFireInterval(double interval)
-{
-    ASSERT(sharedTimerFiredFunction);
-
-    if (sharedTimer) {
-        CFRunLoopTimerInvalidate(sharedTimer);
-        CFRelease(sharedTimer);
-    }
-
-    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
-    sharedTimer = CFRunLoopTimerCreate(0, fireDate, 0, 0, 0, timerFired, 0);
-    CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
-    
-    if (!powerObserver)
-        powerObserver = std::make_unique&lt;PowerObserver&gt;().release();
-}
-
-void stopSharedTimer()
-{
-    if (sharedTimer) {
-        CFRunLoopTimerInvalidate(sharedTimer);
-        CFRelease(sharedTimer);
-        sharedTimer = 0;
-    }
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformwinSharedTimerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/SharedTimerWin.cpp (181670 => 181671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/SharedTimerWin.cpp        2015-03-17 23:06:37 UTC (rev 181670)
+++ trunk/Source/WebCore/platform/win/SharedTimerWin.cpp        2015-03-17 23:42:46 UTC (rev 181671)
</span><span class="lines">@@ -198,4 +198,8 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void invalidateSharedTimer()
+{
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>