<!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>[215241] trunk</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/215241">215241</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2017-04-11 11:25:42 -0700 (Tue, 11 Apr 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=170725

Reviewed by Sam Weinig.

Source/JavaScriptCore:

This patch makes GCActivityCallback return MonotonicTime instead of raw double value.

* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::nextFireTime):
* heap/GCActivityCallback.h:

Source/WebCore:

Use MonotonicTime instead of raw doubles.
Currently, large part of data structures and helper functions are the same in
ResourceUsageOverlayCocoa.mm and ResourceUsageOverlayLinux.cpp. This should be
unified in a separate patch.

* page/ResourceUsageData.h:
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::gcTimerString):
(WebCore::ResourceUsageOverlay::platformDraw):
* page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::gcTimerString):

Source/WTF:

Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.

* wtf/MonotonicTime.h:
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawSeconds):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::nan):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(WTF::MonotonicTime::operator==):
(WTF::MonotonicTime::operator!=):
(WTF::MonotonicTime::operator&lt;):
(WTF::MonotonicTime::operator&gt;):
(WTF::MonotonicTime::operator&lt;=):
(WTF::MonotonicTime::operator&gt;=):

Tools:

* TestWebKitAPI/Tests/WTF/Time.cpp:
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCActivityCallbackcpp">trunk/Source/JavaScriptCore/heap/GCActivityCallback.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapGCActivityCallbackh">trunk/Source/JavaScriptCore/heap/GCActivityCallback.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfMonotonicTimeh">trunk/Source/WTF/wtf/MonotonicTime.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageResourceUsageDatah">trunk/Source/WebCore/page/ResourceUsageData.h</a></li>
<li><a href="#trunkSourceWebCorepagecocoaResourceUsageOverlayCocoamm">trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm</a></li>
<li><a href="#trunkSourceWebCorepagelinuxResourceUsageOverlayLinuxcpp">trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFTimecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-04-11  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
+        https://bugs.webkit.org/show_bug.cgi?id=170725
+
+        Reviewed by Sam Weinig.
+
+        This patch makes GCActivityCallback return MonotonicTime instead of raw double value.
+
+        * heap/GCActivityCallback.cpp:
+        (JSC::GCActivityCallback::nextFireTime):
+        * heap/GCActivityCallback.h:
+
</ins><span class="cx"> 2017-04-11  Guillaume Emont  &lt;guijemont@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [jsc] Add missing MacroAssemblerMIPS::or32() implementation
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCActivityCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCActivityCallback.cpp (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCActivityCallback.cpp        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/JavaScriptCore/heap/GCActivityCallback.cpp        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -76,9 +76,9 @@
</span><span class="cx">     CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + s_decade.seconds());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double GCActivityCallback::nextFireTime()
</del><ins>+MonotonicTime GCActivityCallback::nextFireTime()
</ins><span class="cx"> {
</span><del>-    return CFRunLoopTimerGetNextFireDate(m_timer.get());
</del><ins>+    return MonotonicTime::now() + (CFRunLoopTimerGetNextFireDate(m_timer.get()) - CFAbsoluteTimeGetCurrent());
</ins><span class="cx"> }
</span><span class="cx"> #else
</span><span class="cx"> void GCActivityCallback::scheduleTimer(Seconds newDelay)
</span><span class="lines">@@ -98,11 +98,9 @@
</span><span class="cx">     m_timer.startOneShot(s_decade);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-double GCActivityCallback::nextFireTime()
</del><ins>+MonotonicTime GCActivityCallback::nextFireTime()
</ins><span class="cx"> {
</span><del>-    // FIXME: Should return MonotonicTime.
-    // https://bugs.webkit.org/show_bug.cgi?id=170725
-    return (MonotonicTime::now() + m_timer.secondsUntilFire()).secondsSinceEpoch().value();
</del><ins>+    return MonotonicTime::now() + m_timer.secondsUntilFire();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapGCActivityCallbackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/GCActivityCallback.h (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/GCActivityCallback.h        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/JavaScriptCore/heap/GCActivityCallback.h        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> 
</span><span class="cx">     static bool s_shouldCreateGCTimer;
</span><span class="cx"> 
</span><del>-    double nextFireTime();
</del><ins>+    MonotonicTime nextFireTime();
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual Seconds lastGCLength() = 0;
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WTF/ChangeLog        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -1,5 +1,30 @@
</span><span class="cx"> 2017-04-11  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><ins>+        [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
+        https://bugs.webkit.org/show_bug.cgi?id=170725
+
+        Reviewed by Sam Weinig.
+
+        Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.
+
+        * wtf/MonotonicTime.h:
+        (WTF::MonotonicTime::MonotonicTime):
+        (WTF::MonotonicTime::fromRawSeconds):
+        (WTF::MonotonicTime::infinity):
+        (WTF::MonotonicTime::nan):
+        (WTF::MonotonicTime::secondsSinceEpoch):
+        (WTF::MonotonicTime::operator bool):
+        (WTF::MonotonicTime::operator+):
+        (WTF::MonotonicTime::operator-):
+        (WTF::MonotonicTime::operator==):
+        (WTF::MonotonicTime::operator!=):
+        (WTF::MonotonicTime::operator&lt;):
+        (WTF::MonotonicTime::operator&gt;):
+        (WTF::MonotonicTime::operator&lt;=):
+        (WTF::MonotonicTime::operator&gt;=):
+
+2017-04-11  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
</ins><span class="cx">         Unreviewed, build fix for Windows port after r215228
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=170723
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfMonotonicTimeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/MonotonicTime.h (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MonotonicTime.h        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WTF/wtf/MonotonicTime.h        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -46,35 +46,34 @@
</span><span class="cx">     static const ClockType clockType = ClockType::Monotonic;
</span><span class="cx">     
</span><span class="cx">     // This is the epoch. So, x.secondsSinceEpoch() should be the same as x - MonotonicTime().
</span><del>-    MonotonicTime() { }
</del><ins>+    constexpr MonotonicTime() { }
</ins><span class="cx">     
</span><span class="cx">     // Call this if you know for sure that the double represents time according to
</span><span class="cx">     // WTF::monotonicallyIncreasingTime(). It must be in seconds and it must be from the same time
</span><span class="cx">     // source.
</span><del>-    static MonotonicTime fromRawSeconds(double value)
</del><ins>+    static constexpr MonotonicTime fromRawSeconds(double value)
</ins><span class="cx">     {
</span><del>-        MonotonicTime result;
-        result.m_value = value;
-        return result;
</del><ins>+        return MonotonicTime(value);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     WTF_EXPORT_PRIVATE static MonotonicTime now();
</span><span class="cx">     
</span><del>-    static MonotonicTime infinity() { return fromRawSeconds(std::numeric_limits&lt;double&gt;::infinity()); }
</del><ins>+    static constexpr MonotonicTime infinity() { return fromRawSeconds(std::numeric_limits&lt;double&gt;::infinity()); }
+    static constexpr MonotonicTime nan() { return fromRawSeconds(std::numeric_limits&lt;double&gt;::quiet_NaN()); }
</ins><span class="cx"> 
</span><del>-    Seconds secondsSinceEpoch() const { return Seconds(m_value); }
</del><ins>+    constexpr Seconds secondsSinceEpoch() const { return Seconds(m_value); }
</ins><span class="cx">     
</span><span class="cx">     MonotonicTime approximateMonotonicTime() const { return *this; }
</span><span class="cx">     WTF_EXPORT_PRIVATE WallTime approximateWallTime() const;
</span><span class="cx">     
</span><del>-    explicit operator bool() const { return !!m_value; }
</del><ins>+    explicit constexpr operator bool() const { return !!m_value; }
</ins><span class="cx">     
</span><del>-    MonotonicTime operator+(Seconds other) const
</del><ins>+    constexpr MonotonicTime operator+(Seconds other) const
</ins><span class="cx">     {
</span><span class="cx">         return fromRawSeconds(m_value + other.value());
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    MonotonicTime operator-(Seconds other) const
</del><ins>+    constexpr MonotonicTime operator-(Seconds other) const
</ins><span class="cx">     {
</span><span class="cx">         return fromRawSeconds(m_value - other.value());
</span><span class="cx">     }
</span><span class="lines">@@ -86,7 +85,7 @@
</span><span class="cx">     
</span><span class="cx">     // Time is a scalar and scalars can be negated as this could arise from algebraic
</span><span class="cx">     // transformations. So, we allow it.
</span><del>-    MonotonicTime operator-() const
</del><ins>+    constexpr MonotonicTime operator-() const
</ins><span class="cx">     {
</span><span class="cx">         return fromRawSeconds(-m_value);
</span><span class="cx">     }
</span><span class="lines">@@ -101,37 +100,37 @@
</span><span class="cx">         return *this = *this - other;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    Seconds operator-(MonotonicTime other) const
</del><ins>+    constexpr Seconds operator-(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return Seconds(m_value - other.m_value);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator==(MonotonicTime other) const
</del><ins>+    constexpr bool operator==(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value == other.m_value;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator!=(MonotonicTime other) const
</del><ins>+    constexpr bool operator!=(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value != other.m_value;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator&lt;(MonotonicTime other) const
</del><ins>+    constexpr bool operator&lt;(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value &lt; other.m_value;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator&gt;(MonotonicTime other) const
</del><ins>+    constexpr bool operator&gt;(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value &gt; other.m_value;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator&lt;=(MonotonicTime other) const
</del><ins>+    constexpr bool operator&lt;=(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value &lt;= other.m_value;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool operator&gt;=(MonotonicTime other) const
</del><ins>+    constexpr bool operator&gt;=(MonotonicTime other) const
</ins><span class="cx">     {
</span><span class="cx">         return m_value &gt;= other.m_value;
</span><span class="cx">     }
</span><span class="lines">@@ -139,6 +138,11 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    constexpr MonotonicTime(double rawValue)
+        : m_value(rawValue)
+    {
+    }
+
</ins><span class="cx">     double m_value { 0 };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WebCore/ChangeLog        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-04-11  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
+        https://bugs.webkit.org/show_bug.cgi?id=170725
+
+        Reviewed by Sam Weinig.
+
+        Use MonotonicTime instead of raw doubles.
+        Currently, large part of data structures and helper functions are the same in
+        ResourceUsageOverlayCocoa.mm and ResourceUsageOverlayLinux.cpp. This should be
+        unified in a separate patch.
+
+        * page/ResourceUsageData.h:
+        * page/cocoa/ResourceUsageOverlayCocoa.mm:
+        (WebCore::gcTimerString):
+        (WebCore::ResourceUsageOverlay::platformDraw):
+        * page/linux/ResourceUsageOverlayLinux.cpp:
+        (WebCore::gcTimerString):
+
</ins><span class="cx"> 2017-04-11  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Activate WebRTC data channel tests for WK1
</span></span></pre></div>
<a id="trunkSourceWebCorepageResourceUsageDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ResourceUsageData.h (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ResourceUsageData.h        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WebCore/page/ResourceUsageData.h        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(RESOURCE_USAGE)
</span><span class="cx"> 
</span><span class="cx"> #include &lt;array&gt;
</span><ins>+#include &lt;wtf/MonotonicTime.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -68,8 +69,8 @@
</span><span class="cx">     size_t totalDirtySize { 0 };
</span><span class="cx">     size_t totalExternalSize { 0 };
</span><span class="cx">     std::array&lt;MemoryCategoryInfo, MemoryCategory::NumberOfCategories&gt; categories;
</span><del>-    double timeOfNextEdenCollection { 0 };
-    double timeOfNextFullCollection { 0 };
</del><ins>+    MonotonicTime timeOfNextEdenCollection { MonotonicTime::nan() };
+    MonotonicTime timeOfNextFullCollection { MonotonicTime::nan() };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagecocoaResourceUsageOverlayCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -154,8 +154,8 @@
</span><span class="cx">     RingBuffer&lt;size_t&gt; totalExternalSize;
</span><span class="cx">     RingBuffer&lt;size_t&gt; gcHeapSize;
</span><span class="cx">     std::array&lt;HistoricMemoryCategoryInfo, MemoryCategory::NumberOfCategories&gt; categories;
</span><del>-    double timeOfNextEdenCollection { 0 };
-    double timeOfNextFullCollection { 0 };
</del><ins>+    MonotonicTime timeOfNextEdenCollection { MonotonicTime::nan() };
+    MonotonicTime timeOfNextFullCollection { MonotonicTime::nan() };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> HistoricResourceUsageData::HistoricResourceUsageData()
</span><span class="lines">@@ -433,11 +433,11 @@
</span><span class="cx">     return String::format(&quot;%lu&quot;, number);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static String gcTimerString(double timerFireDate, double now)
</del><ins>+static String gcTimerString(MonotonicTime timerFireDate, MonotonicTime now)
</ins><span class="cx"> {
</span><del>-    if (!timerFireDate)
</del><ins>+    if (std::isnan(timerFireDate))
</ins><span class="cx">         return ASCIILiteral(&quot;[not scheduled]&quot;);
</span><del>-    return String::format(&quot;%g&quot;, timerFireDate - now);
</del><ins>+    return String::format(&quot;%g&quot;, (timerFireDate - now).seconds());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceUsageOverlay::platformDraw(CGContextRef context)
</span><span class="lines">@@ -478,7 +478,7 @@
</span><span class="cx">     }
</span><span class="cx">     y -= 5;
</span><span class="cx"> 
</span><del>-    double now = WTF::currentTime();
</del><ins>+    MonotonicTime now = MonotonicTime::now();
</ins><span class="cx">     showText(context, 10, y + 10, colorForLabels, String::format(&quot;    Eden GC: %s&quot;, gcTimerString(data.timeOfNextEdenCollection, now).ascii().data()));
</span><span class="cx">     showText(context, 10, y + 20, colorForLabels, String::format(&quot;    Full GC: %s&quot;, gcTimerString(data.timeOfNextFullCollection, now).ascii().data()));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagelinuxResourceUsageOverlayLinuxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -59,11 +59,11 @@
</span><span class="cx">     return String::format(&quot;%lu&quot;, number);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static String gcTimerString(double timerFireDate, double now)
</del><ins>+static String gcTimerString(MonotonicTime timerFireDate, MonotonicTime now)
</ins><span class="cx"> {
</span><del>-    if (!timerFireDate)
</del><ins>+    if (std::isnan(timerFireDate))
</ins><span class="cx">         return ASCIILiteral(&quot;[not scheduled]&quot;);
</span><del>-    return String::format(&quot;%g&quot;, timerFireDate - now);
</del><ins>+    return String::format(&quot;%g&quot;, (timerFireDate - now).seconds());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static const float gFontSize = 14;
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">         context.drawText(m_textFont, TextRun(string), position);
</span><span class="cx">         position.move(0, gFontSize + 2);
</span><span class="cx"> 
</span><del>-        double now = WTF::currentTime();
</del><ins>+        MonotonicTime now = MonotonicTime::now();
</ins><span class="cx">         string = &quot;Eden GC: &quot; + gcTimerString(gData.timeOfNextEdenCollection, now);
</span><span class="cx">         context.drawText(m_textFont, TextRun(string), position);
</span><span class="cx">         position.move(0, gFontSize + 2);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Tools/ChangeLog        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-04-11  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
+        https://bugs.webkit.org/show_bug.cgi?id=170725
+
+        Reviewed by Sam Weinig.
+
+        * TestWebKitAPI/Tests/WTF/Time.cpp:
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2017-04-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Revert r215217
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFTimecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp (215240 => 215241)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp        2017-04-11 17:34:01 UTC (rev 215240)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp        2017-04-11 18:25:42 UTC (rev 215241)
</span><span class="lines">@@ -353,5 +353,37 @@
</span><span class="cx">     EXPECT_TRUE(negativeInfinity.nanosecondsAs&lt;uint64_t&gt;() == 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// Test MonotonicTime constexpr features. If they are not calculated in constexpr,
+// they invokes global constructors and becomes compile errors.
+static const MonotonicTime NaN = MonotonicTime::nan();
+static const MonotonicTime Infinity = MonotonicTime::infinity();
+static const MonotonicTime Zero = MonotonicTime::fromRawSeconds(0);
+static const MonotonicTime One = Zero + Seconds(1);
+static const MonotonicTime NegativeOne = Zero - Seconds(1);
+static const bool ZeroIsFalse = !!Zero;
+static const bool Equal = Zero == Zero;
+static const bool NotEqual = Zero != One;
+static const bool LessThan = Zero &lt; One;
+static const bool GreaterThan = One &gt; Zero;
+static const bool LessThanOrEqual = Zero &lt;= Zero;
+static const bool GreaterThanOrEqual = Zero &gt;= Zero;
+
+TEST(WTF_Time, constexprMonotonicTime)
+{
+    EXPECT_TRUE(std::isnan(NaN));
+    EXPECT_TRUE(std::isinf(Infinity));
+    EXPECT_TRUE(Zero.secondsSinceEpoch().value() == 0.0);
+    EXPECT_TRUE(One.secondsSinceEpoch().value() == 1.0);
+    EXPECT_TRUE(NegativeOne.secondsSinceEpoch().value() == -1.0);
+    EXPECT_FALSE(ZeroIsFalse);
+    EXPECT_TRUE(Equal);
+    EXPECT_TRUE(NotEqual);
+    EXPECT_TRUE(LessThan);
+    EXPECT_TRUE(GreaterThan);
+    EXPECT_TRUE(LessThanOrEqual);
+    EXPECT_TRUE(GreaterThanOrEqual);
+}
+
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>