<!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>[208415] 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/208415">208415</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-11-04 20:02:39 -0700 (Fri, 04 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
https://bugs.webkit.org/show_bug.cgi?id=152045

Reviewed by Andy Estes.
Source/JavaScriptCore:

        
Probably the nicest example of why this patch is a good idea is the change in
AtomicsObject.cpp.

* jit/ICStats.cpp:
(JSC::ICStats::ICStats):
* runtime/AtomicsObject.cpp:
(JSC::atomicsFuncWait):

Source/WebCore:


No new layout tests because no new behavior. The new WTF time classes have some unit tests
in TestWebKitAPI.

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::blobSize):
* platform/MainThreadSharedTimer.h:
* platform/SharedTimer.h:
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::updateSharedTimer):
* platform/cf/MainThreadSharedTimerCF.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/efl/MainThreadSharedTimerEfl.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/glib/MainThreadSharedTimerGLib.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/win/MainThreadSharedTimerWin.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::runInMode):

Source/WebKit2:


* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::wait):
(IPC::Connection::sendMessage):
(IPC::Connection::timeoutRespectingIgnoreTimeoutsForTesting):
(IPC::Connection::waitForMessage):
(IPC::Connection::sendSyncMessage):
(IPC::Connection::waitForSyncReply):
* Platform/IPC/Connection.h:
(IPC::Connection::sendSync):
(IPC::Connection::waitForAndDispatchImmediately):
* Platform/IPC/MessageSender.h:
(IPC::MessageSender::sendSync):
* UIProcess/ChildProcessProxy.h:
(WebKit::ChildProcessProxy::sendSync):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::applicationWillTerminate):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(-[WKOneShotDisplayLinkHandler displayLinkFired:]):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
(WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::stringSelectionForPasteboard):
(WebKit::WebPageProxy::dataSelectionForPasteboard):
(WebKit::WebPageProxy::readSelectionFromPasteboard):
(WebKit::WebPageProxy::shouldDelayWindowOrderingForEvent):
(WebKit::WebPageProxy::acceptsFirstMouse):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
(WebKit::WebChromeClient::print):
(WebKit::WebChromeClient::exceededDatabaseQuota):
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::postSynchronousMessageForTesting):

Source/WTF:

        
We used to use 'double' for all time measurements. Sometimes it was milliseconds,
sometimes it was seconds. Sometimes we measured a span of time, sometimes we spoke of time
since some epoch. When we spoke of time since epoch, we either used a monotonic clock or
a wall clock. The type - always 'double' - never told us what kind of time we had, even
though there were roughly six of them (sec interval, ms interval, sec since epoch on wall,
ms since epoch on wall, sec since epoch monotonic, ms since epoch monotonic).
        
At some point, we thought that it would be a good idea to replace these doubles with
std::chrono. But since replacing some things with std::chrono, we found it to be terribly
inconvenient:
        
- Outrageous API. I never want to say std::chrono::milliseconds(blah). I never want to say
  std::chrono::steady_clock::timepoint. The syntax for duration_cast is ugly, and ideally
  duration_cast would not even be a thing.
        
- No overflow protection. std::chrono uses integers by default and using anything else is
  clumsy. But the integer math is done without regard for the rough edges of integer math,
  so any cast between std::chrono types risks overflow. Any comparison risks overflow
  because it may do conversions silently. We have even found bugs where some C++
  implementations had more overflows than others, which ends up being a special kind of
  hell. In many cases, the overflow also has nasal demons.
        
It's an error to represent time using integers. It would have been excusable back when
floating point math was not guaranteed to be supported on all platforms, but that would
have been a long time ago. Time is a continuous, infinite concept and it's a perfect fit
for floating point:
        
- Floating point preserves precision under multiplication in all but extreme cases, so
  using floating point for time means that unit conversions are almost completely
  lossless. This means that we don't have to think very hard about what units to use. In
  this patch, we use seconds almost everywhere. We only convert at boundaries, like an API
  boundary that wants something other than seconds.
        
- Floating point makes it easy to reason about infinity, which is something that time code
  wants to do a lot. Example: when would you like to timeout? Infinity please! This is the
  most elegant way of having an API support both a timeout variant and a no-timeout
  variant.

- Floating point does well-understood things when math goes wrong, and these things are
  pretty well optimized to match what a mathematician would do when computing with real
  numbers represented using scientific notation with a finite number of significant
  digits. This means that time math under floating point looks like normal math. On the
  other hand, std::chrono time math looks like garbage because you have to always check
  for multiple possible UB corners whenever you touch large integers. Integers that
  represent time are very likely to be large and you don't have to do much to overflow
  them. At this time, based on the number of bugs we have already seen due to chrono
  overflows, I am not certain that we even understand what are all of the corner cases
  that we should even check for.
        
This patch introduces a new set of timekeeping classes that are all based on double, and
all internally use seconds. These classes support algebraic typing. The classes are:
        
- Seconds: this is for measuring a duration.
- WallTime: time since epoch according to a wall clock (aka real time clock).
- MonotonicTime: time since epoch according to a monotonic clock.
- ClockType: enum that says either Wall or Monotonic.
- TimeWithDynamicClockType: a tuple of double and ClockType, which represents either a
  wall time or a monotonic time.
        
All of these classes behave like C++ values and are cheap to copy around since they are
very nearly POD. This supports comprehensive conversions between the various time types.
Most of this is by way of algebra. Here are just some of the rules we recognize:
        
WallTime = WallTime + Seconds
Seconds = WallTime - WallTime
MonotonicTime = MonotonicTime + Seconds
etc...
        
We support negative, infinite, and NaN times because math.
        
We support conversions between MonotonicTime and WallTime, like:
        
WallTime wt = mt.approximateWallTime()
        
This is called this &quot;approximate&quot; because the only way to do it is to get the current time
on both clocks and convert relative to that.
        
Many of our APIs would be happy using whatever notion of time the user wanted to use. For
those APIs, which includes Condition and ParkingLot, we have TimeWithDynamicClockType. You
can automatically convert WallTime or MonotonicTime to TimeWithDynamicClockType. This
means that if you use a WallTime with Condition::waitUntil, then Condition's internal
logic for when it should wake up makes its decision based on the current WallTime - but if
you use MonotonicTime then waitUntil will make its decision based on current
MonotonicTime. This is a greater level of flexibility than chrono allowed, since chrono
did not have the concept of a dynamic clock type.
        
This patch does not include conversions between std::chrono and these new time classes,
because past experience shows that we're quite bad at getting conversions between
std::chrono and anything else right. Also, I didn't need such conversion code because this
patch only converts code that transitively touches ParkingLot and Condition. It was easy
to get all of that code onto the new time classes.

* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/CMakeLists.txt:
* wtf/ClockType.cpp: Added.
(WTF::printInternal):
* wtf/ClockType.h: Added.
* wtf/Condition.h:
(WTF::ConditionBase::waitUntil):
(WTF::ConditionBase::waitFor):
(WTF::ConditionBase::wait):
(WTF::ConditionBase::waitUntilWallClockSeconds): Deleted.
(WTF::ConditionBase::waitUntilMonotonicClockSeconds): Deleted.
(WTF::ConditionBase::waitForSeconds): Deleted.
(WTF::ConditionBase::waitForSecondsImpl): Deleted.
(WTF::ConditionBase::waitForImpl): Deleted.
(WTF::ConditionBase::absoluteFromRelative): Deleted.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue&lt;DataType&gt;::waitForMessage):
* wtf/CurrentTime.cpp:
(WTF::sleep):
* wtf/MessageQueue.h:
(WTF::MessageQueue::infiniteTime): Deleted.
* wtf/MonotonicTime.cpp: Added.
(WTF::MonotonicTime::now):
(WTF::MonotonicTime::approximateWallTime):
(WTF::MonotonicTime::dump):
(WTF::MonotonicTime::sleep):
* wtf/MonotonicTime.h: Added.
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawDouble):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::approximateMonotonicTime):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(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;=):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/ParkingLot.h:
(WTF::ParkingLot::parkConditionally):
(WTF::ParkingLot::compareAndPark):
* wtf/Seconds.cpp: Added.
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::dump):
(WTF::Seconds::sleep):
* wtf/Seconds.h: Added.
(WTF::Seconds::Seconds):
(WTF::Seconds::value):
(WTF::Seconds::seconds):
(WTF::Seconds::milliseconds):
(WTF::Seconds::microseconds):
(WTF::Seconds::nanoseconds):
(WTF::Seconds::fromMilliseconds):
(WTF::Seconds::fromMicroseconds):
(WTF::Seconds::fromNanoseconds):
(WTF::Seconds::infinity):
(WTF::Seconds::operator bool):
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::operator*):
(WTF::Seconds::operator/):
(WTF::Seconds::operator+=):
(WTF::Seconds::operator-=):
(WTF::Seconds::operator*=):
(WTF::Seconds::operator/=):
(WTF::Seconds::operator==):
(WTF::Seconds::operator!=):
(WTF::Seconds::operator&lt;):
(WTF::Seconds::operator&gt;):
(WTF::Seconds::operator&lt;=):
(WTF::Seconds::operator&gt;=):
* wtf/TimeWithDynamicClockType.cpp: Added.
(WTF::TimeWithDynamicClockType::now):
(WTF::TimeWithDynamicClockType::nowWithSameClock):
(WTF::TimeWithDynamicClockType::wallTime):
(WTF::TimeWithDynamicClockType::monotonicTime):
(WTF::TimeWithDynamicClockType::approximateWallTime):
(WTF::TimeWithDynamicClockType::approximateMonotonicTime):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator&lt;):
(WTF::TimeWithDynamicClockType::operator&gt;):
(WTF::TimeWithDynamicClockType::operator&lt;=):
(WTF::TimeWithDynamicClockType::operator&gt;=):
(WTF::TimeWithDynamicClockType::dump):
(WTF::TimeWithDynamicClockType::sleep):
* wtf/TimeWithDynamicClockType.h: Added.
(WTF::TimeWithDynamicClockType::TimeWithDynamicClockType):
(WTF::TimeWithDynamicClockType::fromRawDouble):
(WTF::TimeWithDynamicClockType::secondsSinceEpoch):
(WTF::TimeWithDynamicClockType::clockType):
(WTF::TimeWithDynamicClockType::withSameClockAndRawDouble):
(WTF::TimeWithDynamicClockType::operator bool):
(WTF::TimeWithDynamicClockType::operator+):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator+=):
(WTF::TimeWithDynamicClockType::operator-=):
(WTF::TimeWithDynamicClockType::operator==):
(WTF::TimeWithDynamicClockType::operator!=):
* wtf/WallTime.cpp: Added.
(WTF::WallTime::now):
(WTF::WallTime::approximateMonotonicTime):
(WTF::WallTime::dump):
(WTF::WallTime::sleep):
* wtf/WallTime.h: Added.
(WTF::WallTime::WallTime):
(WTF::WallTime::fromRawDouble):
(WTF::WallTime::infinity):
(WTF::WallTime::secondsSinceEpoch):
(WTF::WallTime::approximateWallTime):
(WTF::WallTime::operator bool):
(WTF::WallTime::operator+):
(WTF::WallTime::operator-):
(WTF::WallTime::operator+=):
(WTF::WallTime::operator-=):
(WTF::WallTime::operator==):
(WTF::WallTime::operator!=):
(WTF::WallTime::operator&lt;):
(WTF::WallTime::operator&gt;):
(WTF::WallTime::operator&lt;=):
(WTF::WallTime::operator&gt;=):
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::wait):
* wtf/threads/BinarySemaphore.h:

Tools:


* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Condition.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
(TestWebKitAPI::ToUpperConverter::stopProducing):
(TestWebKitAPI::ToUpperConverter::stopConsuming):
* TestWebKitAPI/Tests/WTF/Time.cpp: Added.
(WTF::operator&lt;&lt;):
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejitICStatscpp">trunk/Source/JavaScriptCore/jit/ICStats.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeAtomicsObjectcpp">trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfAutomaticThreadcpp">trunk/Source/WTF/wtf/AutomaticThread.cpp</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWTFwtfConditionh">trunk/Source/WTF/wtf/Condition.h</a></li>
<li><a href="#trunkSourceWTFwtfCrossThreadQueueh">trunk/Source/WTF/wtf/CrossThreadQueue.h</a></li>
<li><a href="#trunkSourceWTFwtfCurrentTimecpp">trunk/Source/WTF/wtf/CurrentTime.cpp</a></li>
<li><a href="#trunkSourceWTFwtfMessageQueueh">trunk/Source/WTF/wtf/MessageQueue.h</a></li>
<li><a href="#trunkSourceWTFwtfParkingLotcpp">trunk/Source/WTF/wtf/ParkingLot.cpp</a></li>
<li><a href="#trunkSourceWTFwtfParkingLoth">trunk/Source/WTF/wtf/ParkingLot.h</a></li>
<li><a href="#trunkSourceWTFwtfthreadsBinarySemaphorecpp">trunk/Source/WTF/wtf/threads/BinarySemaphore.cpp</a></li>
<li><a href="#trunkSourceWTFwtfthreadsBinarySemaphoreh">trunk/Source/WTF/wtf/threads/BinarySemaphore.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistrycpp">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMainThreadSharedTimerh">trunk/Source/WebCore/platform/MainThreadSharedTimer.h</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="#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="#trunkSourceWebCoreplatformglibMainThreadSharedTimerGLibcpp">trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinMainThreadSharedTimerWincpp">trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerRunLoopcpp">trunk/Source/WebCore/workers/WorkerRunLoop.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectioncpp">trunk/Source/WebKit2/Platform/IPC/Connection.cpp</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectionh">trunk/Source/WebKit2/Platform/IPC/Connection.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCMessageSenderh">trunk/Source/WebKit2/Platform/IPC/MessageSender.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAcceleratedDrawingAreaProxycpp">trunk/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessChildProcessProxyh">trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDrawingAreaProxyh">trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessStorageStorageManagercpp">trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxyh">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacTiledCoreAnimationDrawingAreaProxyh">trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacTiledCoreAnimationDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPICMakeListstxt">trunk/Tools/TestWebKitAPI/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFConditioncpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFSynchronizedFixedQueuecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfClockTypecpp">trunk/Source/WTF/wtf/ClockType.cpp</a></li>
<li><a href="#trunkSourceWTFwtfClockTypeh">trunk/Source/WTF/wtf/ClockType.h</a></li>
<li><a href="#trunkSourceWTFwtfMonotonicTimecpp">trunk/Source/WTF/wtf/MonotonicTime.cpp</a></li>
<li><a href="#trunkSourceWTFwtfMonotonicTimeh">trunk/Source/WTF/wtf/MonotonicTime.h</a></li>
<li><a href="#trunkSourceWTFwtfSecondscpp">trunk/Source/WTF/wtf/Seconds.cpp</a></li>
<li><a href="#trunkSourceWTFwtfSecondsh">trunk/Source/WTF/wtf/Seconds.h</a></li>
<li><a href="#trunkSourceWTFwtfTimeWithDynamicClockTypecpp">trunk/Source/WTF/wtf/TimeWithDynamicClockType.cpp</a></li>
<li><a href="#trunkSourceWTFwtfTimeWithDynamicClockTypeh">trunk/Source/WTF/wtf/TimeWithDynamicClockType.h</a></li>
<li><a href="#trunkSourceWTFwtfWallTimecpp">trunk/Source/WTF/wtf/WallTime.cpp</a></li>
<li><a href="#trunkSourceWTFwtfWallTimeh">trunk/Source/WTF/wtf/WallTime.h</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 (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
+        https://bugs.webkit.org/show_bug.cgi?id=152045
+
+        Reviewed by Andy Estes.
+        
+        Probably the nicest example of why this patch is a good idea is the change in
+        AtomicsObject.cpp.
+
+        * jit/ICStats.cpp:
+        (JSC::ICStats::ICStats):
+        * runtime/AtomicsObject.cpp:
+        (JSC::atomicsFuncWait):
+
</ins><span class="cx"> 2016-11-04  JF Bastien  &lt;jfbastien@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         testWASM should be very sad if no options are provided
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitICStatscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ICStats.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ICStats.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/JavaScriptCore/jit/ICStats.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -63,7 +63,8 @@
</span><span class="cx">         [this] () {
</span><span class="cx">             LockHolder locker(m_lock);
</span><span class="cx">             for (;;) {
</span><del>-                m_condition.waitForSeconds(m_lock, 1, [this] () -&gt; bool { return m_shouldStop; });
</del><ins>+                m_condition.waitFor(
+                    m_lock, Seconds(1), [this] () -&gt; bool { return m_shouldStop; });
</ins><span class="cx">                 if (m_shouldStop)
</span><span class="cx">                     break;
</span><span class="cx">                 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeAtomicsObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    double timeoutInNanoseconds = timeoutInMilliseconds * 1000 * 1000;
</del><ins>+    Seconds timeout = Seconds::fromMilliseconds(timeoutInMilliseconds);
</ins><span class="cx"> 
</span><span class="cx">     // This covers the proposed rule:
</span><span class="cx">     //
</span><span class="lines">@@ -314,32 +314,11 @@
</span><span class="cx">     //
</span><span class="cx">     // exec-&gt;argument(3) returns undefined if it's not provided and ToNumber(undefined) returns NaN,
</span><span class="cx">     // so NaN is the only special case.
</span><del>-    if (timeoutInNanoseconds == timeoutInNanoseconds)
-        timeoutInNanoseconds = std::max(0., timeoutInNanoseconds);
</del><ins>+    if (timeout == timeout)
+        timeout = std::max(Seconds(0), timeout);
</ins><span class="cx">     else
</span><del>-        timeoutInNanoseconds = std::numeric_limits&lt;double&gt;::infinity();
</del><ins>+        timeout = Seconds::infinity();
</ins><span class="cx">     
</span><del>-    // What happens next is a pile of nonsense, but it's all needed because of corner cases
-    // inside std::chrono.
-    // FIXME: Stop using std::chrono.
-    
-    ParkingLot::Clock::time_point timeout;
-    if (timeoutInNanoseconds &gt; static_cast&lt;double&gt;(std::numeric_limits&lt;int64_t&gt;::max()))
-        timeout = ParkingLot::Clock::time_point::max();
-    else {
-        std::chrono::nanoseconds relativeTimeout =
-            std::chrono::nanoseconds(static_cast&lt;int64_t&gt;(timeoutInNanoseconds));
-        if (relativeTimeout &lt; std::chrono::nanoseconds::zero())
-            timeout = ParkingLot::Clock::now();
-        else if (relativeTimeout &gt; ParkingLot::Clock::duration::max())
-            timeout = ParkingLot::Clock::time_point::max();
-        else {
-            ParkingLot::Clock::duration myRelativeTimeout =
-                std::chrono::duration_cast&lt;ParkingLot::Clock::duration&gt;(relativeTimeout);
-            timeout = ParkingLot::Clock::now() + myRelativeTimeout;
-        }
-    }
-    
</del><span class="cx">     bool didPassValidation = false;
</span><span class="cx">     ParkingLot::ParkResult result;
</span><span class="cx">     {
</span><span class="lines">@@ -351,7 +330,7 @@
</span><span class="cx">                 return didPassValidation;
</span><span class="cx">             },
</span><span class="cx">             [] () { },
</span><del>-            timeout);
</del><ins>+            MonotonicTime::now() + timeout);
</ins><span class="cx">     }
</span><span class="cx">     const char* resultString;
</span><span class="cx">     if (!didPassValidation)
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/ChangeLog        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,3 +1,239 @@
</span><ins>+2016-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
+        https://bugs.webkit.org/show_bug.cgi?id=152045
+
+        Reviewed by Andy Estes.
+        
+        We used to use 'double' for all time measurements. Sometimes it was milliseconds,
+        sometimes it was seconds. Sometimes we measured a span of time, sometimes we spoke of time
+        since some epoch. When we spoke of time since epoch, we either used a monotonic clock or
+        a wall clock. The type - always 'double' - never told us what kind of time we had, even
+        though there were roughly six of them (sec interval, ms interval, sec since epoch on wall,
+        ms since epoch on wall, sec since epoch monotonic, ms since epoch monotonic).
+        
+        At some point, we thought that it would be a good idea to replace these doubles with
+        std::chrono. But since replacing some things with std::chrono, we found it to be terribly
+        inconvenient:
+        
+        - Outrageous API. I never want to say std::chrono::milliseconds(blah). I never want to say
+          std::chrono::steady_clock::timepoint. The syntax for duration_cast is ugly, and ideally
+          duration_cast would not even be a thing.
+        
+        - No overflow protection. std::chrono uses integers by default and using anything else is
+          clumsy. But the integer math is done without regard for the rough edges of integer math,
+          so any cast between std::chrono types risks overflow. Any comparison risks overflow
+          because it may do conversions silently. We have even found bugs where some C++
+          implementations had more overflows than others, which ends up being a special kind of
+          hell. In many cases, the overflow also has nasal demons.
+        
+        It's an error to represent time using integers. It would have been excusable back when
+        floating point math was not guaranteed to be supported on all platforms, but that would
+        have been a long time ago. Time is a continuous, infinite concept and it's a perfect fit
+        for floating point:
+        
+        - Floating point preserves precision under multiplication in all but extreme cases, so
+          using floating point for time means that unit conversions are almost completely
+          lossless. This means that we don't have to think very hard about what units to use. In
+          this patch, we use seconds almost everywhere. We only convert at boundaries, like an API
+          boundary that wants something other than seconds.
+        
+        - Floating point makes it easy to reason about infinity, which is something that time code
+          wants to do a lot. Example: when would you like to timeout? Infinity please! This is the
+          most elegant way of having an API support both a timeout variant and a no-timeout
+          variant.
+
+        - Floating point does well-understood things when math goes wrong, and these things are
+          pretty well optimized to match what a mathematician would do when computing with real
+          numbers represented using scientific notation with a finite number of significant
+          digits. This means that time math under floating point looks like normal math. On the
+          other hand, std::chrono time math looks like garbage because you have to always check
+          for multiple possible UB corners whenever you touch large integers. Integers that
+          represent time are very likely to be large and you don't have to do much to overflow
+          them. At this time, based on the number of bugs we have already seen due to chrono
+          overflows, I am not certain that we even understand what are all of the corner cases
+          that we should even check for.
+        
+        This patch introduces a new set of timekeeping classes that are all based on double, and
+        all internally use seconds. These classes support algebraic typing. The classes are:
+        
+        - Seconds: this is for measuring a duration.
+        - WallTime: time since epoch according to a wall clock (aka real time clock).
+        - MonotonicTime: time since epoch according to a monotonic clock.
+        - ClockType: enum that says either Wall or Monotonic.
+        - TimeWithDynamicClockType: a tuple of double and ClockType, which represents either a
+          wall time or a monotonic time.
+        
+        All of these classes behave like C++ values and are cheap to copy around since they are
+        very nearly POD. This supports comprehensive conversions between the various time types.
+        Most of this is by way of algebra. Here are just some of the rules we recognize:
+        
+        WallTime = WallTime + Seconds
+        Seconds = WallTime - WallTime
+        MonotonicTime = MonotonicTime + Seconds
+        etc...
+        
+        We support negative, infinite, and NaN times because math.
+        
+        We support conversions between MonotonicTime and WallTime, like:
+        
+        WallTime wt = mt.approximateWallTime()
+        
+        This is called this &quot;approximate&quot; because the only way to do it is to get the current time
+        on both clocks and convert relative to that.
+        
+        Many of our APIs would be happy using whatever notion of time the user wanted to use. For
+        those APIs, which includes Condition and ParkingLot, we have TimeWithDynamicClockType. You
+        can automatically convert WallTime or MonotonicTime to TimeWithDynamicClockType. This
+        means that if you use a WallTime with Condition::waitUntil, then Condition's internal
+        logic for when it should wake up makes its decision based on the current WallTime - but if
+        you use MonotonicTime then waitUntil will make its decision based on current
+        MonotonicTime. This is a greater level of flexibility than chrono allowed, since chrono
+        did not have the concept of a dynamic clock type.
+        
+        This patch does not include conversions between std::chrono and these new time classes,
+        because past experience shows that we're quite bad at getting conversions between
+        std::chrono and anything else right. Also, I didn't need such conversion code because this
+        patch only converts code that transitively touches ParkingLot and Condition. It was easy
+        to get all of that code onto the new time classes.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/AutomaticThread.cpp:
+        (WTF::AutomaticThread::start):
+        * wtf/CMakeLists.txt:
+        * wtf/ClockType.cpp: Added.
+        (WTF::printInternal):
+        * wtf/ClockType.h: Added.
+        * wtf/Condition.h:
+        (WTF::ConditionBase::waitUntil):
+        (WTF::ConditionBase::waitFor):
+        (WTF::ConditionBase::wait):
+        (WTF::ConditionBase::waitUntilWallClockSeconds): Deleted.
+        (WTF::ConditionBase::waitUntilMonotonicClockSeconds): Deleted.
+        (WTF::ConditionBase::waitForSeconds): Deleted.
+        (WTF::ConditionBase::waitForSecondsImpl): Deleted.
+        (WTF::ConditionBase::waitForImpl): Deleted.
+        (WTF::ConditionBase::absoluteFromRelative): Deleted.
+        * wtf/CrossThreadQueue.h:
+        (WTF::CrossThreadQueue&lt;DataType&gt;::waitForMessage):
+        * wtf/CurrentTime.cpp:
+        (WTF::sleep):
+        * wtf/MessageQueue.h:
+        (WTF::MessageQueue::infiniteTime): Deleted.
+        * wtf/MonotonicTime.cpp: Added.
+        (WTF::MonotonicTime::now):
+        (WTF::MonotonicTime::approximateWallTime):
+        (WTF::MonotonicTime::dump):
+        (WTF::MonotonicTime::sleep):
+        * wtf/MonotonicTime.h: Added.
+        (WTF::MonotonicTime::MonotonicTime):
+        (WTF::MonotonicTime::fromRawDouble):
+        (WTF::MonotonicTime::infinity):
+        (WTF::MonotonicTime::secondsSinceEpoch):
+        (WTF::MonotonicTime::approximateMonotonicTime):
+        (WTF::MonotonicTime::operator bool):
+        (WTF::MonotonicTime::operator+):
+        (WTF::MonotonicTime::operator-):
+        (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;=):
+        * wtf/ParkingLot.cpp:
+        (WTF::ParkingLot::parkConditionallyImpl):
+        (WTF::ParkingLot::unparkOne):
+        (WTF::ParkingLot::unparkOneImpl):
+        (WTF::ParkingLot::unparkCount):
+        * wtf/ParkingLot.h:
+        (WTF::ParkingLot::parkConditionally):
+        (WTF::ParkingLot::compareAndPark):
+        * wtf/Seconds.cpp: Added.
+        (WTF::Seconds::operator+):
+        (WTF::Seconds::operator-):
+        (WTF::Seconds::dump):
+        (WTF::Seconds::sleep):
+        * wtf/Seconds.h: Added.
+        (WTF::Seconds::Seconds):
+        (WTF::Seconds::value):
+        (WTF::Seconds::seconds):
+        (WTF::Seconds::milliseconds):
+        (WTF::Seconds::microseconds):
+        (WTF::Seconds::nanoseconds):
+        (WTF::Seconds::fromMilliseconds):
+        (WTF::Seconds::fromMicroseconds):
+        (WTF::Seconds::fromNanoseconds):
+        (WTF::Seconds::infinity):
+        (WTF::Seconds::operator bool):
+        (WTF::Seconds::operator+):
+        (WTF::Seconds::operator-):
+        (WTF::Seconds::operator*):
+        (WTF::Seconds::operator/):
+        (WTF::Seconds::operator+=):
+        (WTF::Seconds::operator-=):
+        (WTF::Seconds::operator*=):
+        (WTF::Seconds::operator/=):
+        (WTF::Seconds::operator==):
+        (WTF::Seconds::operator!=):
+        (WTF::Seconds::operator&lt;):
+        (WTF::Seconds::operator&gt;):
+        (WTF::Seconds::operator&lt;=):
+        (WTF::Seconds::operator&gt;=):
+        * wtf/TimeWithDynamicClockType.cpp: Added.
+        (WTF::TimeWithDynamicClockType::now):
+        (WTF::TimeWithDynamicClockType::nowWithSameClock):
+        (WTF::TimeWithDynamicClockType::wallTime):
+        (WTF::TimeWithDynamicClockType::monotonicTime):
+        (WTF::TimeWithDynamicClockType::approximateWallTime):
+        (WTF::TimeWithDynamicClockType::approximateMonotonicTime):
+        (WTF::TimeWithDynamicClockType::operator-):
+        (WTF::TimeWithDynamicClockType::operator&lt;):
+        (WTF::TimeWithDynamicClockType::operator&gt;):
+        (WTF::TimeWithDynamicClockType::operator&lt;=):
+        (WTF::TimeWithDynamicClockType::operator&gt;=):
+        (WTF::TimeWithDynamicClockType::dump):
+        (WTF::TimeWithDynamicClockType::sleep):
+        * wtf/TimeWithDynamicClockType.h: Added.
+        (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType):
+        (WTF::TimeWithDynamicClockType::fromRawDouble):
+        (WTF::TimeWithDynamicClockType::secondsSinceEpoch):
+        (WTF::TimeWithDynamicClockType::clockType):
+        (WTF::TimeWithDynamicClockType::withSameClockAndRawDouble):
+        (WTF::TimeWithDynamicClockType::operator bool):
+        (WTF::TimeWithDynamicClockType::operator+):
+        (WTF::TimeWithDynamicClockType::operator-):
+        (WTF::TimeWithDynamicClockType::operator+=):
+        (WTF::TimeWithDynamicClockType::operator-=):
+        (WTF::TimeWithDynamicClockType::operator==):
+        (WTF::TimeWithDynamicClockType::operator!=):
+        * wtf/WallTime.cpp: Added.
+        (WTF::WallTime::now):
+        (WTF::WallTime::approximateMonotonicTime):
+        (WTF::WallTime::dump):
+        (WTF::WallTime::sleep):
+        * wtf/WallTime.h: Added.
+        (WTF::WallTime::WallTime):
+        (WTF::WallTime::fromRawDouble):
+        (WTF::WallTime::infinity):
+        (WTF::WallTime::secondsSinceEpoch):
+        (WTF::WallTime::approximateWallTime):
+        (WTF::WallTime::operator bool):
+        (WTF::WallTime::operator+):
+        (WTF::WallTime::operator-):
+        (WTF::WallTime::operator+=):
+        (WTF::WallTime::operator-=):
+        (WTF::WallTime::operator==):
+        (WTF::WallTime::operator!=):
+        (WTF::WallTime::operator&lt;):
+        (WTF::WallTime::operator&gt;):
+        (WTF::WallTime::operator&lt;=):
+        (WTF::WallTime::operator&gt;=):
+        * wtf/threads/BinarySemaphore.cpp:
+        (WTF::BinarySemaphore::wait):
+        * wtf/threads/BinarySemaphore.h:
+
</ins><span class="cx"> 2016-11-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DFG plays fast and loose with the shadow values of a Phi
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -29,6 +29,16 @@
</span><span class="cx">                 0F43D8F21DB5ADDC00108FB6 /* AutomaticThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F43D8F01DB5ADDC00108FB6 /* AutomaticThread.h */; };
</span><span class="cx">                 0F4570431BE5B58F0062A629 /* Dominators.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4570421BE5B58F0062A629 /* Dominators.h */; };
</span><span class="cx">                 0F4570451BE834410062A629 /* BubbleSort.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4570441BE834410062A629 /* BubbleSort.h */; };
</span><ins>+                0F66B28A1DC97BAB004A1D3F /* ClockType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2801DC97BAB004A1D3F /* ClockType.cpp */; };
+                0F66B28B1DC97BAB004A1D3F /* ClockType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66B2811DC97BAB004A1D3F /* ClockType.h */; };
+                0F66B28C1DC97BAB004A1D3F /* MonotonicTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2821DC97BAB004A1D3F /* MonotonicTime.cpp */; };
+                0F66B28D1DC97BAB004A1D3F /* MonotonicTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66B2831DC97BAB004A1D3F /* MonotonicTime.h */; };
+                0F66B28E1DC97BAB004A1D3F /* Seconds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2841DC97BAB004A1D3F /* Seconds.cpp */; };
+                0F66B28F1DC97BAB004A1D3F /* Seconds.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66B2851DC97BAB004A1D3F /* Seconds.h */; };
+                0F66B2901DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2861DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp */; };
+                0F66B2911DC97BAB004A1D3F /* TimeWithDynamicClockType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66B2871DC97BAB004A1D3F /* TimeWithDynamicClockType.h */; };
+                0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2881DC97BAB004A1D3F /* WallTime.cpp */; };
+                0F66B2931DC97BAB004A1D3F /* WallTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66B2891DC97BAB004A1D3F /* WallTime.h */; };
</ins><span class="cx">                 0F725CAC1C50461600AD943A /* RangeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F725CAB1C50461600AD943A /* RangeSet.h */; };
</span><span class="cx">                 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7C5FB51D885CF20044F5E2 /* FastBitVector.cpp */; };
</span><span class="cx">                 0F824A681B7443A0002E345D /* ParkingLot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F824A641B7443A0002E345D /* ParkingLot.cpp */; };
</span><span class="lines">@@ -372,6 +382,16 @@
</span><span class="cx">                 0F43D8F01DB5ADDC00108FB6 /* AutomaticThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomaticThread.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F4570421BE5B58F0062A629 /* Dominators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Dominators.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F4570441BE834410062A629 /* BubbleSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BubbleSort.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0F66B2801DC97BAB004A1D3F /* ClockType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClockType.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2811DC97BAB004A1D3F /* ClockType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClockType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2821DC97BAB004A1D3F /* MonotonicTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MonotonicTime.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2831DC97BAB004A1D3F /* MonotonicTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonotonicTime.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2841DC97BAB004A1D3F /* Seconds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Seconds.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2851DC97BAB004A1D3F /* Seconds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Seconds.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2861DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeWithDynamicClockType.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2871DC97BAB004A1D3F /* TimeWithDynamicClockType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeWithDynamicClockType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2881DC97BAB004A1D3F /* WallTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WallTime.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F66B2891DC97BAB004A1D3F /* WallTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WallTime.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F725CAB1C50461600AD943A /* RangeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RangeSet.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F7C5FB51D885CF20044F5E2 /* FastBitVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FastBitVector.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F824A641B7443A0002E345D /* ParkingLot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParkingLot.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -863,6 +883,8 @@
</span><span class="cx">                                 EB95E1EF161A72410089A2F5 /* ByteOrder.h */,
</span><span class="cx">                                 A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
</span><span class="cx">                                 A8A4726B151A825A004123FF /* CheckedBoolean.h */,
</span><ins>+                                0F66B2801DC97BAB004A1D3F /* ClockType.cpp */,
+                                0F66B2811DC97BAB004A1D3F /* ClockType.h */,
</ins><span class="cx">                                 0FC4EDE51696149600F65041 /* CommaPrinter.h */,
</span><span class="cx">                                 0F8F2B8F172E00F0007DBDA5 /* CompilationThread.cpp */,
</span><span class="cx">                                 0F8F2B90172E00F0007DBDA5 /* CompilationThread.h */,
</span><span class="lines">@@ -946,6 +968,8 @@
</span><span class="cx">                                 A8A472CD151A825B004123FF /* MetaAllocator.cpp */,
</span><span class="cx">                                 A8A472CE151A825B004123FF /* MetaAllocator.h */,
</span><span class="cx">                                 A8A472CF151A825B004123FF /* MetaAllocatorHandle.h */,
</span><ins>+                                0F66B2821DC97BAB004A1D3F /* MonotonicTime.cpp */,
+                                0F66B2831DC97BAB004A1D3F /* MonotonicTime.h */,
</ins><span class="cx">                                 FE8225301B2A1E5B00BA68FD /* NakedPtr.h */,
</span><span class="cx">                                 1A3F6BE6174ADA2100B2EEA7 /* NeverDestroyed.h */,
</span><span class="cx">                                 0F0D85B317234CB100338210 /* NoLock.h */,
</span><span class="lines">@@ -1007,6 +1031,8 @@
</span><span class="cx">                                 1469419516EAAFF80024E146 /* SchedulePairMac.mm */,
</span><span class="cx">                                 1A3524AA1D63A2FF0031729B /* Scope.h */,
</span><span class="cx">                                 0FEC84B01BDACD390080FF74 /* ScopedLambda.h */,
</span><ins>+                                0F66B2841DC97BAB004A1D3F /* Seconds.cpp */,
+                                0F66B2851DC97BAB004A1D3F /* Seconds.h */,
</ins><span class="cx">                                 A8A47306151A825B004123FF /* SegmentedVector.h */,
</span><span class="cx">                                 A8A47307151A825B004123FF /* SentinelLinkedList.h */,
</span><span class="cx">                                 A8A47308151A825B004123FF /* SHA1.cpp */,
</span><span class="lines">@@ -1043,6 +1069,8 @@
</span><span class="cx">                                 A8A47336151A825B004123FF /* ThreadingPthreads.cpp */,
</span><span class="cx">                                 A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */,
</span><span class="cx">                                 A8A4733F151A825B004123FF /* ThreadSpecific.h */,
</span><ins>+                                0F66B2861DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp */,
+                                0F66B2871DC97BAB004A1D3F /* TimeWithDynamicClockType.h */,
</ins><span class="cx">                                 553071C91C40427200384898 /* TinyLRUCache.h */,
</span><span class="cx">                                 0FED67B51B22D4D80066CE15 /* TinyPtrSet.h */,
</span><span class="cx">                                 149EF16216BBFE0D000A4331 /* TriState.h */,
</span><span class="lines">@@ -1054,6 +1082,8 @@
</span><span class="cx">                                 A8A47370151A825B004123FF /* Vector.h */,
</span><span class="cx">                                 A8A47371151A825B004123FF /* VectorTraits.h */,
</span><span class="cx">                                 A8A47372151A825B004123FF /* VMTags.h */,
</span><ins>+                                0F66B2881DC97BAB004A1D3F /* WallTime.cpp */,
+                                0F66B2891DC97BAB004A1D3F /* WallTime.h */,
</ins><span class="cx">                                 974CFC8D16A4F327006D5404 /* WeakPtr.h */,
</span><span class="cx">                                 0F3501631BB258C800F0A2A3 /* WeakRandom.h */,
</span><span class="cx">                                 0FE4479A1B7AAA03009498EB /* WordLock.cpp */,
</span><span class="lines">@@ -1259,7 +1289,9 @@
</span><span class="cx">                                 0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
</span><span class="cx">                                 0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */,
</span><span class="cx">                                 8134013915B092FD001FF0B8 /* Base64.h in Headers */,
</span><ins>+                                0F66B28F1DC97BAB004A1D3F /* Seconds.h in Headers */,
</ins><span class="cx">                                 A8A473A9151A825B004123FF /* bignum-dtoa.h in Headers */,
</span><ins>+                                0F66B2911DC97BAB004A1D3F /* TimeWithDynamicClockType.h in Headers */,
</ins><span class="cx">                                 A8A473AB151A825B004123FF /* bignum.h in Headers */,
</span><span class="cx">                                 A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */,
</span><span class="cx">                                 A8A4738A151A825B004123FF /* Bitmap.h in Headers */,
</span><span class="lines">@@ -1340,6 +1372,7 @@
</span><span class="cx">                                 93AC91A818942FC400244939 /* LChar.h in Headers */,
</span><span class="cx">                                 539EB0631D55284200C82EF7 /* LEBDecoder.h in Headers */,
</span><span class="cx">                                 A70DA0851799F04D00529A9B /* ListDump.h in Headers */,
</span><ins>+                                0F66B2931DC97BAB004A1D3F /* WallTime.h in Headers */,
</ins><span class="cx">                                 A8A473E1151A825B004123FF /* ListHashSet.h in Headers */,
</span><span class="cx">                                 0FE1646B1B6FFC9600400E7C /* Lock.h in Headers */,
</span><span class="cx">                                 A8A473E3151A825B004123FF /* Locker.h in Headers */,
</span><span class="lines">@@ -1399,6 +1432,7 @@
</span><span class="cx">                                 14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */,
</span><span class="cx">                                 1469419616EAAFF80024E146 /* SchedulePair.h in Headers */,
</span><span class="cx">                                 1A3524AB1D63A2FF0031729B /* Scope.h in Headers */,
</span><ins>+                                0F66B28D1DC97BAB004A1D3F /* MonotonicTime.h in Headers */,
</ins><span class="cx">                                 0FEC84B11BDACD390080FF74 /* ScopedLambda.h in Headers */,
</span><span class="cx">                                 A5098B021C16A4F900087797 /* SecuritySPI.h in Headers */,
</span><span class="cx">                                 A8A4741F151A825B004123FF /* SegmentedVector.h in Headers */,
</span><span class="lines">@@ -1466,6 +1500,7 @@
</span><span class="cx">                                 E4A0AD3A1A96245500536DF6 /* WorkQueue.h in Headers */,
</span><span class="cx">                                 A8A47446151A825B004123FF /* WTFString.h in Headers */,
</span><span class="cx">                                 A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
</span><ins>+                                0F66B28B1DC97BAB004A1D3F /* ClockType.h in Headers */,
</ins><span class="cx">                                 CE73E02519DCB7AB00580D5C /* XPCSPI.h in Headers */,
</span><span class="cx">                                 C8B0E1A1E01A486EB95E0D11 /* IndexSet.h in Headers */,
</span><span class="cx">                                 C916B975F02F4F7E8B4AB12D /* IndexMap.h in Headers */,
</span><span class="lines">@@ -1581,6 +1616,7 @@
</span><span class="cx">                                 A8A473AA151A825B004123FF /* bignum.cc in Sources */,
</span><span class="cx">                                 A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */,
</span><span class="cx">                                 A8A4738B151A825B004123FF /* BitVector.cpp in Sources */,
</span><ins>+                                0F66B2901DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp in Sources */,
</ins><span class="cx">                                 DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */,
</span><span class="cx">                                 A8A473AC151A825B004123FF /* cached-powers.cc in Sources */,
</span><span class="cx">                                 A8A47460151A825B004123FF /* CollatorDefault.cpp in Sources */,
</span><span class="lines">@@ -1641,6 +1677,9 @@
</span><span class="cx">                                 A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */,
</span><span class="cx">                                 0FDDBFA71666DFA300C55FEF /* StringPrintStream.cpp in Sources */,
</span><span class="cx">                                 A8A47443151A825B004123FF /* StringStatics.cpp in Sources */,
</span><ins>+                                0F66B28A1DC97BAB004A1D3F /* ClockType.cpp in Sources */,
+                                0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */,
+                                0F66B28E1DC97BAB004A1D3F /* Seconds.cpp in Sources */,
</ins><span class="cx">                                 0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */,
</span><span class="cx">                                 93F1993E19D7958D00C2390B /* StringView.cpp in Sources */,
</span><span class="cx">                                 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */,
</span><span class="lines">@@ -1652,6 +1691,7 @@
</span><span class="cx">                                 A8A47448151A825B004123FF /* ThreadIdentifierDataPthreads.cpp in Sources */,
</span><span class="cx">                                 A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
</span><span class="cx">                                 A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */,
</span><ins>+                                0F66B28C1DC97BAB004A1D3F /* MonotonicTime.cpp in Sources */,
</ins><span class="cx">                                 1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
</span><span class="cx">                                 1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
</span><span class="cx">                                 1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfAutomaticThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/AutomaticThread.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/AutomaticThread.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/AutomaticThread.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -180,9 +180,8 @@
</span><span class="cx">                             return stop(locker);
</span><span class="cx">                         RELEASE_ASSERT(result == PollResult::Wait);
</span><span class="cx">                         // Shut the thread down after one second.
</span><del>-                        double timeout = monotonicallyIncreasingTime() + 1;
</del><span class="cx">                         bool awokenByNotify =
</span><del>-                            m_condition-&gt;m_condition.waitUntilMonotonicClockSeconds(*m_lock, timeout);
</del><ins>+                            m_condition-&gt;m_condition.waitFor(*m_lock, Seconds(1));
</ins><span class="cx">                         if (!awokenByNotify) {
</span><span class="cx">                             if (verbose)
</span><span class="cx">                                 dataLog(RawPointer(this), &quot;: Going to sleep!\n&quot;);
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -12,6 +12,7 @@
</span><span class="cx">     BubbleSort.h
</span><span class="cx">     BumpPointerAllocator.h
</span><span class="cx">     ByteOrder.h
</span><ins>+    ClockType.h
</ins><span class="cx">     CompilationThread.h
</span><span class="cx">     Compiler.h
</span><span class="cx">     Condition.h
</span><span class="lines">@@ -64,6 +65,7 @@
</span><span class="cx">     MessageQueue.h
</span><span class="cx">     MetaAllocator.h
</span><span class="cx">     MetaAllocatorHandle.h
</span><ins>+    MonotonicTime.h
</ins><span class="cx">     Noncopyable.h
</span><span class="cx">     NumberOfCores.h
</span><span class="cx">     OSAllocator.h
</span><span class="lines">@@ -101,6 +103,7 @@
</span><span class="cx">     SharedTask.h
</span><span class="cx">     SaturatedArithmetic.h
</span><span class="cx">     ScopedLambda.h
</span><ins>+    Seconds.h
</ins><span class="cx">     SegmentedVector.h
</span><span class="cx">     SmallPtrSet.h
</span><span class="cx">     StackBounds.h
</span><span class="lines">@@ -116,6 +119,7 @@
</span><span class="cx">     ThreadSpecific.h
</span><span class="cx">     Threading.h
</span><span class="cx">     ThreadingPrimitives.h
</span><ins>+    TimeWithDynamicClockType.h
</ins><span class="cx">     TinyPtrSet.h
</span><span class="cx">     UniqueRef.h
</span><span class="cx">     VMTags.h
</span><span class="lines">@@ -124,6 +128,7 @@
</span><span class="cx">     Vector.h
</span><span class="cx">     VectorTraits.h
</span><span class="cx">     WTFThreadData.h
</span><ins>+    WallTime.h
</ins><span class="cx">     WeakPtr.h
</span><span class="cx">     WordLock.h
</span><span class="cx">     WorkQueue.h
</span><span class="lines">@@ -176,6 +181,7 @@
</span><span class="cx">     Atomics.cpp
</span><span class="cx">     AutomaticThread.cpp
</span><span class="cx">     BitVector.cpp
</span><ins>+    ClockType.cpp
</ins><span class="cx">     CompilationThread.cpp
</span><span class="cx">     CrossThreadCopier.cpp
</span><span class="cx">     CryptographicUtilities.cpp
</span><span class="lines">@@ -195,6 +201,7 @@
</span><span class="cx">     MainThread.cpp
</span><span class="cx">     MediaTime.cpp
</span><span class="cx">     MetaAllocator.cpp
</span><ins>+    MonotonicTime.cpp
</ins><span class="cx">     NumberOfCores.cpp
</span><span class="cx">     OSRandomSource.cpp
</span><span class="cx">     PageBlock.cpp
</span><span class="lines">@@ -207,12 +214,15 @@
</span><span class="cx">     RefCountedLeakCounter.cpp
</span><span class="cx">     RunLoop.cpp
</span><span class="cx">     SHA1.cpp
</span><ins>+    Seconds.cpp
</ins><span class="cx">     SixCharacterHash.cpp
</span><span class="cx">     StackBounds.cpp
</span><span class="cx">     StackStats.cpp
</span><span class="cx">     StringPrintStream.cpp
</span><span class="cx">     Threading.cpp
</span><ins>+    TimeWithDynamicClockType.cpp
</ins><span class="cx">     WTFThreadData.cpp
</span><ins>+    WallTime.cpp
</ins><span class="cx">     WordLock.cpp
</span><span class="cx">     WorkQueue.cpp
</span><span class="cx">     dtoa.cpp
</span></span></pre></div>
<a id="trunkSourceWTFwtfClockTypecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/ClockType.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/ClockType.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/ClockType.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &quot;config.h&quot;
+#include &quot;ClockType.h&quot;
+
+#include &lt;wtf/PrintStream.h&gt;
+
+namespace WTF {
+
+void printInternal(PrintStream&amp; out, ClockType type)
+{
+    switch (type) {
+    case ClockType::Wall:
+        out.print(&quot;Wall&quot;);
+        return;
+    case ClockType::Monotonic:
+        out.print(&quot;Monotonic&quot;);
+        return;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfClockTypeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/ClockType.h (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/ClockType.h                                (rev 0)
+++ trunk/Source/WTF/wtf/ClockType.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 WTF_ClockType_h
+#define WTF_ClockType_h
+
+namespace WTF {
+
+class PrintStream;
+
+enum class ClockType {
+    Wall,
+    Monotonic
+};
+
+WTF_EXPORT_PRIVATE void printInternal(PrintStream&amp;, ClockType);
+
+} // namespace WTF
+
+using WTF::ClockType;
+
+#endif // WTF_ClockType_h
</ins></span></pre></div>
<a id="trunkSourceWTFwtfConditionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Condition.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Condition.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/Condition.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,11 +26,11 @@
</span><span class="cx"> #ifndef WTF_Condition_h
</span><span class="cx"> #define WTF_Condition_h
</span><span class="cx"> 
</span><del>-#include &lt;chrono&gt;
</del><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/ParkingLot.h&gt;
</span><ins>+#include &lt;wtf/TimeWithDynamicClockType.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +46,10 @@
</span><span class="cx"> // This is a struct without a constructor or destructor so that it can be statically initialized.
</span><span class="cx"> // Use Lock in instance variables.
</span><span class="cx"> struct ConditionBase {
</span><del>-    typedef ParkingLot::Clock Clock;
</del><ins>+    // Condition will accept any kind of time and convert it internally, but this typedef tells
+    // you what kind of time Condition would be able to use without conversions. However, if you
+    // are unlikely to be affected by the cost of conversions, it is better to use MonotonicTime.
+    typedef ParkingLot::Time Time;
</ins><span class="cx">     
</span><span class="cx">     // Wait on a parking queue while releasing the given lock. It will unlock the lock just before
</span><span class="cx">     // parking, and relock it upon wakeup. Returns true if we woke up due to some call to
</span><span class="lines">@@ -64,10 +67,10 @@
</span><span class="cx">     // which may not release the lock for past timeout. But, this behavior is consistent with OpenGroup
</span><span class="cx">     // documentation for timedwait().
</span><span class="cx">     template&lt;typename LockType&gt;
</span><del>-    bool waitUntil(LockType&amp; lock, Clock::time_point timeout)
</del><ins>+    bool waitUntil(LockType&amp; lock, const TimeWithDynamicClockType&amp; timeout)
</ins><span class="cx">     {
</span><span class="cx">         bool result;
</span><del>-        if (timeout &lt; Clock::now()) {
</del><ins>+        if (timeout &lt; timeout.nowWithSameClock()) {
</ins><span class="cx">             lock.unlock();
</span><span class="cx">             result = false;
</span><span class="cx">         } else {
</span><span class="lines">@@ -89,7 +92,8 @@
</span><span class="cx">     // Wait until the given predicate is satisfied. Returns true if it is satisfied in the end.
</span><span class="cx">     // May return early due to timeout.
</span><span class="cx">     template&lt;typename LockType, typename Functor&gt;
</span><del>-    bool waitUntil(LockType&amp; lock, Clock::time_point timeout, const Functor&amp; predicate)
</del><ins>+    bool waitUntil(
+        LockType&amp; lock, const TimeWithDynamicClockType&amp; timeout, const Functor&amp; predicate)
</ins><span class="cx">     {
</span><span class="cx">         while (!predicate()) {
</span><span class="cx">             if (!waitUntil(lock, timeout))
</span><span class="lines">@@ -100,17 +104,23 @@
</span><span class="cx"> 
</span><span class="cx">     // Wait until the given predicate is satisfied. Returns true if it is satisfied in the end.
</span><span class="cx">     // May return early due to timeout.
</span><del>-    template&lt;typename LockType, typename DurationType, typename Functor&gt;
</del><ins>+    template&lt;typename LockType, typename Functor&gt;
</ins><span class="cx">     bool waitFor(
</span><del>-        LockType&amp; lock, const DurationType&amp; relativeTimeout, const Functor&amp; predicate)
</del><ins>+        LockType&amp; lock, Seconds relativeTimeout, const Functor&amp; predicate)
</ins><span class="cx">     {
</span><del>-        return waitUntil(lock, absoluteFromRelative(relativeTimeout), predicate);
</del><ins>+        return waitUntil(lock, MonotonicTime::now() + relativeTimeout, predicate);
</ins><span class="cx">     }
</span><ins>+    
+    template&lt;typename LockType&gt;
+    bool waitFor(LockType&amp; lock, Seconds relativeTimeout)
+    {
+        return waitUntil(lock, MonotonicTime::now() + relativeTimeout);
+    }
</ins><span class="cx"> 
</span><span class="cx">     template&lt;typename LockType&gt;
</span><span class="cx">     void wait(LockType&amp; lock)
</span><span class="cx">     {
</span><del>-        waitUntil(lock, Clock::time_point::max());
</del><ins>+        waitUntil(lock, Time::infinity());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename LockType, typename Functor&gt;
</span><span class="lines">@@ -120,53 +130,6 @@
</span><span class="cx">             wait(lock);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    template&lt;typename LockType, typename TimeType&gt;
-    bool waitUntil(LockType&amp; lock, const TimeType&amp; timeout)
-    {
-        if (timeout == TimeType::max()) {
-            wait(lock);
-            return true;
-        }
-        return waitForImpl(lock, timeout - TimeType::clock::now());
-    }
-
-    template&lt;typename LockType&gt;
-    bool waitUntilWallClockSeconds(LockType&amp; lock, double absoluteTimeoutSeconds)
-    {
-        return waitForSecondsImpl(lock, absoluteTimeoutSeconds - currentTime());
-    }
-
-    template&lt;typename LockType&gt;
-    bool waitUntilMonotonicClockSeconds(LockType&amp; lock, double absoluteTimeoutSeconds)
-    {
-        return waitForSecondsImpl(lock, absoluteTimeoutSeconds - monotonicallyIncreasingTime());
-    }
-    
-    template&lt;typename LockType, typename Functor&gt;
-    bool waitForSeconds(LockType&amp; lock, double relativeTimeoutSeconds, const Functor&amp; predicate)
-    {
-        double relativeTimeoutNanoseconds = relativeTimeoutSeconds * (1000.0 * 1000.0 * 1000.0);
-        
-        if (!(relativeTimeoutNanoseconds &gt; 0)) {
-            // This handles insta-timeouts as well as NaN.
-            lock.unlock();
-            lock.lock();
-            return false;
-        }
-
-        if (relativeTimeoutNanoseconds &gt; static_cast&lt;double&gt;(std::numeric_limits&lt;int64_t&gt;::max())) {
-            // If the timeout in nanoseconds cannot be expressed using a 64-bit integer, then we
-            // might as well wait forever.
-            wait(lock, predicate);
-            return true;
-        }
-        
-        auto relativeTimeout =
-            std::chrono::nanoseconds(static_cast&lt;int64_t&gt;(relativeTimeoutNanoseconds));
-
-        return waitFor(lock, relativeTimeout, predicate);
-    }
-
</del><span class="cx">     // Note that this method is extremely fast when nobody is waiting. It is not necessary to try to
</span><span class="cx">     // avoid calling this method. This returns true if someone was actually woken up.
</span><span class="cx">     bool notifyOne()
</span><span class="lines">@@ -207,58 +170,8 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx"> protected:
</span><del>-    template&lt;typename LockType&gt;
-    bool waitForSecondsImpl(LockType&amp; lock, double relativeTimeoutSeconds)
-    {
-        double relativeTimeoutNanoseconds = relativeTimeoutSeconds * (1000.0 * 1000.0 * 1000.0);
-        
-        if (!(relativeTimeoutNanoseconds &gt; 0)) {
-            // This handles insta-timeouts as well as NaN.
-            lock.unlock();
-            lock.lock();
-            return false;
-        }
-
-        if (relativeTimeoutNanoseconds &gt; static_cast&lt;double&gt;(std::numeric_limits&lt;int64_t&gt;::max())) {
-            // If the timeout in nanoseconds cannot be expressed using a 64-bit integer, then we
-            // might as well wait forever.
-            wait(lock);
-            return true;
-        }
-        
-        auto relativeTimeout =
-            std::chrono::nanoseconds(static_cast&lt;int64_t&gt;(relativeTimeoutNanoseconds));
-
-        return waitForImpl(lock, relativeTimeout);
-    }
-    
-    template&lt;typename LockType, typename DurationType&gt;
-    bool waitForImpl(LockType&amp; lock, const DurationType&amp; relativeTimeout)
-    {
-        return waitUntil(lock, absoluteFromRelative(relativeTimeout));
-    }
-
-    template&lt;typename DurationType&gt;
-    Clock::time_point absoluteFromRelative(const DurationType&amp; relativeTimeout)
-    {
-        if (relativeTimeout &lt; DurationType::zero())
-            return Clock::time_point::min();
-
-        if (relativeTimeout &gt; Clock::duration::max()) {
-            // This is highly unlikely. But if it happens, we want to not do anything dumb. Sleeping
-            // without a timeout seems sensible when the timeout duration is greater than what can be
-            // expressed using steady_clock.
-            return Clock::time_point::max();
-        }
-        
-        Clock::duration myRelativeTimeout =
-            std::chrono::duration_cast&lt;Clock::duration&gt;(relativeTimeout);
-
-        return Clock::now() + myRelativeTimeout;
-    }
-
</del><span class="cx">     Atomic&lt;bool&gt; m_hasWaiters;
</span><del>-};    
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> class Condition : public ConditionBase {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(Condition);
</span></span></pre></div>
<a id="trunkSourceWTFwtfCrossThreadQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CrossThreadQueue.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CrossThreadQueue.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/CrossThreadQueue.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -74,8 +74,7 @@
</span><span class="cx">         if (found != m_queue.end())
</span><span class="cx">             break;
</span><span class="cx"> 
</span><del>-        static const double infiniteTime = std::numeric_limits&lt;double&gt;::max();
-        m_condition.waitUntilWallClockSeconds(m_lock, infiniteTime);
</del><ins>+        m_condition.wait(m_lock);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return m_queue.takeFirst();
</span></span></pre></div>
<a id="trunkSourceWTFwtfCurrentTimecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CurrentTime.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CurrentTime.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/CurrentTime.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2007-2009 Torch Mobile, Inc.
</span><span class="cx">  * Copyright (C) 2008 Cameron Zwarich &lt;cwzwarich@uwaterloo.ca&gt;
</span><span class="lines">@@ -340,7 +340,7 @@
</span><span class="cx">     Lock fakeLock;
</span><span class="cx">     Condition fakeCondition;
</span><span class="cx">     LockHolder fakeLocker(fakeLock);
</span><del>-    fakeCondition.waitUntilMonotonicClockSeconds(fakeLock, monotonicallyIncreasingTime() + value);
</del><ins>+    fakeCondition.waitFor(fakeLock, Seconds(value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfMessageQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/MessageQueue.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MessageQueue.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/MessageQueue.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009 Google Inc. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &lt;wtf/Lock.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><ins>+#include &lt;wtf/WallTime.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx">         std::unique_ptr&lt;DataType&gt; tryGetMessage();
</span><span class="cx">         std::unique_ptr&lt;DataType&gt; tryGetMessageIgnoringKilled();
</span><span class="cx">         template&lt;typename Predicate&gt;
</span><del>-        std::unique_ptr&lt;DataType&gt; waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp;, Predicate&amp;&amp;, double absoluteTime);
</del><ins>+        std::unique_ptr&lt;DataType&gt; waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp;, Predicate&amp;&amp;, WallTime absoluteTime);
</ins><span class="cx"> 
</span><span class="cx">         template&lt;typename Predicate&gt;
</span><span class="cx">         void removeIf(Predicate&amp;&amp;);
</span><span class="lines">@@ -76,8 +77,6 @@
</span><span class="cx">         // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time.
</span><span class="cx">         bool isEmpty();
</span><span class="cx"> 
</span><del>-        static double infiniteTime() { return std::numeric_limits&lt;double&gt;::max(); }
-
</del><span class="cx">     private:
</span><span class="cx">         mutable Lock m_mutex;
</span><span class="cx">         Condition m_condition;
</span><span class="lines">@@ -130,7 +129,7 @@
</span><span class="cx">     inline auto MessageQueue&lt;DataType&gt;::waitForMessage() -&gt; std::unique_ptr&lt;DataType&gt;
</span><span class="cx">     {
</span><span class="cx">         MessageQueueWaitResult exitReason; 
</span><del>-        std::unique_ptr&lt;DataType&gt; result = waitForMessageFilteredWithTimeout(exitReason, [](const DataType&amp;) { return true; }, infiniteTime());
</del><ins>+        std::unique_ptr&lt;DataType&gt; result = waitForMessageFilteredWithTimeout(exitReason, [](const DataType&amp;) { return true; }, WallTime::infinity());
</ins><span class="cx">         ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived);
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -137,7 +136,7 @@
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename DataType&gt;
</span><span class="cx">     template&lt;typename Predicate&gt;
</span><del>-    inline auto MessageQueue&lt;DataType&gt;::waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp; result, Predicate&amp;&amp; predicate, double absoluteTime) -&gt; std::unique_ptr&lt;DataType&gt;
</del><ins>+    inline auto MessageQueue&lt;DataType&gt;::waitForMessageFilteredWithTimeout(MessageQueueWaitResult&amp; result, Predicate&amp;&amp; predicate, WallTime absoluteTime) -&gt; std::unique_ptr&lt;DataType&gt;
</ins><span class="cx">     {
</span><span class="cx">         LockHolder lock(m_mutex);
</span><span class="cx">         bool timedOut = false;
</span><span class="lines">@@ -151,10 +150,10 @@
</span><span class="cx">             if (found != m_queue.end())
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><del>-            timedOut = !m_condition.waitUntilWallClockSeconds(m_mutex, absoluteTime);
</del><ins>+            timedOut = !m_condition.waitUntil(m_mutex, absoluteTime);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        ASSERT(!timedOut || absoluteTime != infiniteTime());
</del><ins>+        ASSERT(!timedOut || absoluteTime != WallTime::infinity());
</ins><span class="cx"> 
</span><span class="cx">         if (m_killed) {
</span><span class="cx">             result = MessageQueueTerminated;
</span></span></pre></div>
<a id="trunkSourceWTFwtfMonotonicTimecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/MonotonicTime.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MonotonicTime.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/MonotonicTime.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &quot;config.h&quot;
+#include &quot;MonotonicTime.h&quot;
+
+#include &quot;CurrentTime.h&quot;
+#include &quot;PrintStream.h&quot;
+#include &quot;TimeWithDynamicClockType.h&quot;
+#include &quot;WallTime.h&quot;
+
+namespace WTF {
+
+MonotonicTime MonotonicTime::now()
+{
+    return fromRawSeconds(monotonicallyIncreasingTime());
+}
+
+WallTime MonotonicTime::approximateWallTime() const
+{
+    return *this - now() + WallTime::now();
+}
+
+void MonotonicTime::dump(PrintStream&amp; out) const
+{
+    out.print(&quot;Monotonic(&quot;, m_value, &quot; sec)&quot;);
+}
+
+} // namespace WTF
+
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfMonotonicTimeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/MonotonicTime.h (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MonotonicTime.h                                (rev 0)
+++ trunk/Source/WTF/wtf/MonotonicTime.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 WTF_MonotonicTime_h
+#define WTF_MonotonicTime_h
+
+#include &lt;wtf/ClockType.h&gt;
+#include &lt;wtf/Seconds.h&gt;
+
+namespace WTF {
+
+class WallTime;
+class PrintStream;
+
+// The current time according to a monotonic clock. Monotonic clocks don't go backwards and
+// possibly don't count downtime. This uses floating point internally so that you can reason about
+// infinity and other things that arise in math. It's acceptable to use this to wrap NaN times,
+// negative times, and infinite times, so long as they are all relative to the same clock.
+// Specifically, MonotonicTime should be used in agreement with the principle that
+// MonotonicTime::now().secondsSinceEpoch().value() is the same as
+// WTF::monotonicallyIncreasingTime().
+class MonotonicTime {
+public:
+    static const ClockType clockType = ClockType::Monotonic;
+    
+    // This is the epoch. So, x.secondsSinceEpoch() should be the same as x - MonotonicTime().
+    MonotonicTime() { }
+    
+    // Call this if you know for sure that the double represents time according to
+    // WTF::monotonicallyIncreasingTime(). It must be in seconds and it must be from the same time
+    // source.
+    static MonotonicTime fromRawSeconds(double value)
+    {
+        MonotonicTime result;
+        result.m_value = value;
+        return result;
+    }
+    
+    WTF_EXPORT_PRIVATE static MonotonicTime now();
+    
+    static MonotonicTime infinity() { return fromRawSeconds(std::numeric_limits&lt;double&gt;::infinity()); }
+
+    Seconds secondsSinceEpoch() const { return Seconds(m_value); }
+    
+    MonotonicTime approximateMonotonicTime() const { return *this; }
+    WTF_EXPORT_PRIVATE WallTime approximateWallTime() const;
+    
+    explicit operator bool() const { return !!m_value; }
+    
+    MonotonicTime operator+(Seconds other) const
+    {
+        return fromRawSeconds(m_value + other.value());
+    }
+    
+    MonotonicTime operator-(Seconds other) const
+    {
+        return fromRawSeconds(m_value - other.value());
+    }
+    
+    // Time is a scalar and scalars can be negated as this could arise from algebraic
+    // transformations. So, we allow it.
+    MonotonicTime operator-() const
+    {
+        return fromRawSeconds(-m_value);
+    }
+    
+    MonotonicTime operator+=(Seconds other)
+    {
+        return *this = *this + other;
+    }
+    
+    MonotonicTime operator-=(Seconds other)
+    {
+        return *this = *this - other;
+    }
+    
+    Seconds operator-(MonotonicTime other) const
+    {
+        return Seconds(m_value - other.m_value);
+    }
+    
+    bool operator==(MonotonicTime other) const
+    {
+        return m_value == other.m_value;
+    }
+    
+    bool operator!=(MonotonicTime other) const
+    {
+        return m_value != other.m_value;
+    }
+    
+    bool operator&lt;(MonotonicTime other) const
+    {
+        return m_value &lt; other.m_value;
+    }
+    
+    bool operator&gt;(MonotonicTime other) const
+    {
+        return m_value &gt; other.m_value;
+    }
+    
+    bool operator&lt;=(MonotonicTime other) const
+    {
+        return m_value &lt;= other.m_value;
+    }
+    
+    bool operator&gt;=(MonotonicTime other) const
+    {
+        return m_value &gt;= other.m_value;
+    }
+    
+    WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
+
+private:
+    double m_value { 0 };
+};
+
+} // namespace WTF
+
+using WTF::MonotonicTime;
+
+#endif // WTF_MonotonicTime_h
</ins></span></pre></div>
<a id="trunkSourceWTFwtfParkingLotcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/ParkingLot.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/ParkingLot.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/ParkingLot.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -54,8 +54,8 @@
</span><span class="cx"> 
</span><span class="cx">     ThreadIdentifier threadIdentifier;
</span><span class="cx">     
</span><del>-    std::mutex parkingLock;
-    std::condition_variable parkingCondition;
</del><ins>+    Mutex parkingLock;
+    ThreadCondition parkingCondition;
</ins><span class="cx"> 
</span><span class="cx">     const void* address { nullptr };
</span><span class="cx">     
</span><span class="lines">@@ -564,7 +564,7 @@
</span><span class="cx">     const void* address,
</span><span class="cx">     const ScopedLambda&lt;bool()&gt;&amp; validation,
</span><span class="cx">     const ScopedLambda&lt;void()&gt;&amp; beforeSleep,
</span><del>-    Clock::time_point timeout)
</del><ins>+    const TimeWithDynamicClockType&amp; timeout)
</ins><span class="cx"> {
</span><span class="cx">     if (verbose)
</span><span class="cx">         dataLog(toString(currentThread(), &quot;: parking.\n&quot;));
</span><span class="lines">@@ -592,20 +592,17 @@
</span><span class="cx">     
</span><span class="cx">     bool didGetDequeued;
</span><span class="cx">     {
</span><del>-        std::unique_lock&lt;std::mutex&gt; locker(me-&gt;parkingLock);
-        while (me-&gt;address &amp;&amp; Clock::now() &lt; timeout) {
-            // Falling back to wait() works around a bug in libstdc++ implementation of std::condition_variable. See:
-            // - https://bugs.webkit.org/show_bug.cgi?id=148027
-            // - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58931
-            if (timeout == Clock::time_point::max())
-                me-&gt;parkingCondition.wait(locker);
-            else
-                me-&gt;parkingCondition.wait_until(locker, timeout);
</del><ins>+        MutexLocker locker(me-&gt;parkingLock);
+        while (me-&gt;address &amp;&amp; timeout.nowWithSameClock() &lt; timeout) {
+            me-&gt;parkingCondition.timedWait(
+                me-&gt;parkingLock, timeout.approximateWallTime().secondsSinceEpoch().value());
</ins><span class="cx">             
</span><del>-            // Because of the above, we do this thing, which is hilariously awful, but ensures that the worst case is
-            // a CPU-eating spin but not a deadlock.
-            locker.unlock();
-            locker.lock();
</del><ins>+            // It's possible for the OS to decide not to wait. If it does that then it will also
+            // decide not to release the lock. If there's a bug in the time math, then this could
+            // result in a deadlock. Flashing the lock means that at worst it's just a CPU-eating
+            // spin.
+            me-&gt;parkingLock.unlock();
+            me-&gt;parkingLock.lock();
</ins><span class="cx">         }
</span><span class="cx">         ASSERT(!me-&gt;address || me-&gt;address == address);
</span><span class="cx">         didGetDequeued = !me-&gt;address;
</span><span class="lines">@@ -640,7 +637,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Make sure that no matter what, me-&gt;address is null after this point.
</span><span class="cx">     {
</span><del>-        std::unique_lock&lt;std::mutex&gt; locker(me-&gt;parkingLock);
</del><ins>+        MutexLocker locker(me-&gt;parkingLock);
</ins><span class="cx">         if (!didDequeue) {
</span><span class="cx">             // If we did not dequeue ourselves, then someone else did. They will set our address to
</span><span class="cx">             // null. We don't want to proceed until they do this, because otherwise, they may set
</span><span class="lines">@@ -647,7 +644,7 @@
</span><span class="cx">             // our address to null in some distant future when we're already trying to wait for
</span><span class="cx">             // other things.
</span><span class="cx">             while (me-&gt;address)
</span><del>-                me-&gt;parkingCondition.wait(locker);
</del><ins>+                me-&gt;parkingCondition.wait(me-&gt;parkingLock);
</ins><span class="cx">         }
</span><span class="cx">         me-&gt;address = nullptr;
</span><span class="cx">     }
</span><span class="lines">@@ -695,11 +692,11 @@
</span><span class="cx">     ASSERT(threadData-&gt;address);
</span><span class="cx">     
</span><span class="cx">     {
</span><del>-        std::unique_lock&lt;std::mutex&gt; locker(threadData-&gt;parkingLock);
</del><ins>+        MutexLocker locker(threadData-&gt;parkingLock);
</ins><span class="cx">         threadData-&gt;address = nullptr;
</span><span class="cx">         threadData-&gt;token = 0;
</span><span class="cx">     }
</span><del>-    threadData-&gt;parkingCondition.notify_one();
</del><ins>+    threadData-&gt;parkingCondition.signal();
</ins><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -741,11 +738,11 @@
</span><span class="cx">     ASSERT(threadData-&gt;address);
</span><span class="cx">     
</span><span class="cx">     {
</span><del>-        std::unique_lock&lt;std::mutex&gt; locker(threadData-&gt;parkingLock);
</del><ins>+        MutexLocker locker(threadData-&gt;parkingLock);
</ins><span class="cx">         threadData-&gt;address = nullptr;
</span><span class="cx">     }
</span><span class="cx">     // At this point, the threadData may die. Good thing we have a RefPtr&lt;&gt; on it.
</span><del>-    threadData-&gt;parkingCondition.notify_one();
</del><ins>+    threadData-&gt;parkingCondition.signal();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NEVER_INLINE unsigned ParkingLot::unparkCount(const void* address, unsigned count)
</span><span class="lines">@@ -779,10 +776,10 @@
</span><span class="cx">             dataLog(toString(currentThread(), &quot;: unparking &quot;, RawPointer(threadData.get()), &quot; with address &quot;, RawPointer(threadData-&gt;address), &quot;\n&quot;));
</span><span class="cx">         ASSERT(threadData-&gt;address);
</span><span class="cx">         {
</span><del>-            std::unique_lock&lt;std::mutex&gt; locker(threadData-&gt;parkingLock);
</del><ins>+            MutexLocker locker(threadData-&gt;parkingLock);
</ins><span class="cx">             threadData-&gt;address = nullptr;
</span><span class="cx">         }
</span><del>-        threadData-&gt;parkingCondition.notify_one();
</del><ins>+        threadData-&gt;parkingCondition.signal();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (verbose)
</span></span></pre></div>
<a id="trunkSourceWTFwtfParkingLoth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/ParkingLot.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/ParkingLot.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/ParkingLot.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -26,11 +26,11 @@
</span><span class="cx"> #ifndef WTF_ParkingLot_h
</span><span class="cx"> #define WTF_ParkingLot_h
</span><span class="cx"> 
</span><del>-#include &lt;chrono&gt;
</del><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;wtf/Atomics.h&gt;
</span><span class="cx"> #include &lt;wtf/ScopedLambda.h&gt;
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><ins>+#include &lt;wtf/TimeWithDynamicClockType.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="lines">@@ -39,7 +39,15 @@
</span><span class="cx">     ParkingLot(const ParkingLot&amp;) = delete;
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    typedef std::chrono::steady_clock Clock;
</del><ins>+    // ParkingLot will accept any kind of time and convert it internally, but this typedef tells
+    // you what kind of time ParkingLot would be able to use without conversions. It's sad that
+    // this is WallTime not MonotonicTime, but that's just how OS wait functions work. However,
+    // because ParkingLot evaluates whether it should wait by checking if your time has passed
+    // using whatever clock you used, specifying timeouts in MonotonicTime is semantically better.
+    // For example, if the user sets his computer's clock back during the time that you wanted to
+    // wait for one second, and you specified the timeout using the MonotonicTime, then ParkingLot
+    // will be smart enough to know that your one second has elapsed.
+    typedef WallTime Time;
</ins><span class="cx">     
</span><span class="cx">     // Parks the thread in a queue associated with the given address, which cannot be null. The
</span><span class="cx">     // parking only succeeds if the validation function returns true while the queue lock is held.
</span><span class="lines">@@ -68,7 +76,7 @@
</span><span class="cx">         const void* address,
</span><span class="cx">         const ValidationFunctor&amp; validation,
</span><span class="cx">         const BeforeSleepFunctor&amp; beforeSleep,
</span><del>-        Clock::time_point timeout)
</del><ins>+        const TimeWithDynamicClockType&amp; timeout)
</ins><span class="cx">     {
</span><span class="cx">         return parkConditionallyImpl(
</span><span class="cx">             address,
</span><span class="lines">@@ -89,7 +97,7 @@
</span><span class="cx">                 return value == expected;
</span><span class="cx">             },
</span><span class="cx">             [] () { },
</span><del>-            Clock::time_point::max());
</del><ins>+            Time::infinity());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Unparking status given to you anytime you unparkOne().
</span><span class="lines">@@ -158,7 +166,7 @@
</span><span class="cx">         const void* address,
</span><span class="cx">         const ScopedLambda&lt;bool()&gt;&amp; validation,
</span><span class="cx">         const ScopedLambda&lt;void()&gt;&amp; beforeSleep,
</span><del>-        Clock::time_point timeout);
</del><ins>+        const TimeWithDynamicClockType&amp; timeout);
</ins><span class="cx">     
</span><span class="cx">     WTF_EXPORT_PRIVATE static void unparkOneImpl(
</span><span class="cx">         const void* address, const ScopedLambda&lt;intptr_t(UnparkResult)&gt;&amp; callback);
</span></span></pre></div>
<a id="trunkSourceWTFwtfSecondscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/Seconds.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Seconds.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/Seconds.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &quot;config.h&quot;
+#include &quot;Seconds.h&quot;
+
+#include &quot;CurrentTime.h&quot;
+#include &quot;MonotonicTime.h&quot;
+#include &quot;PrintStream.h&quot;
+#include &quot;TimeWithDynamicClockType.h&quot;
+#include &quot;WallTime.h&quot;
+
+namespace WTF {
+
+WallTime Seconds::operator+(WallTime other) const
+{
+    return other + *this;
+}
+
+MonotonicTime Seconds::operator+(MonotonicTime other) const
+{
+    return other + *this;
+}
+
+TimeWithDynamicClockType Seconds::operator+(const TimeWithDynamicClockType&amp; other) const
+{
+    return other + *this;
+}
+
+WallTime Seconds::operator-(WallTime other) const
+{
+    return WallTime::fromRawSeconds(value() - other.secondsSinceEpoch().value());
+}
+
+MonotonicTime Seconds::operator-(MonotonicTime other) const
+{
+    return MonotonicTime::fromRawSeconds(value() - other.secondsSinceEpoch().value());
+}
+
+TimeWithDynamicClockType Seconds::operator-(const TimeWithDynamicClockType&amp; other) const
+{
+    return other.withSameClockAndRawSeconds(value() - other.secondsSinceEpoch().value());
+}
+
+void Seconds::dump(PrintStream&amp; out) const
+{
+    out.print(m_value, &quot; sec&quot;);
+}
+
+void sleep(Seconds value)
+{
+    sleep(value.value());
+}
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfSecondsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/Seconds.h (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Seconds.h                                (rev 0)
+++ trunk/Source/WTF/wtf/Seconds.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 WTF_Seconds_h
+#define WTF_Seconds_h
+
+namespace WTF {
+
+class MonotonicTime;
+class PrintStream;
+class TimeWithDynamicClockType;
+class WallTime;
+
+class Seconds {
+public:
+    Seconds() { }
+    
+    explicit constexpr Seconds(double value)
+        : m_value(value)
+    {
+    }
+    
+    double value() const { return m_value; }
+    
+    double seconds() const { return m_value; }
+    double milliseconds() const { return seconds() * 1000; }
+    double microseconds() const { return milliseconds() * 1000; }
+    double nanoseconds() const { return microseconds() * 1000; }
+    
+    static constexpr Seconds fromMilliseconds(double value)
+    {
+        return Seconds(value / 1000);
+    }
+    
+    static constexpr Seconds fromMicroseconds(double value)
+    {
+        return fromMilliseconds(value / 1000);
+    }
+    
+    static constexpr Seconds fromNanoseconds(double value)
+    {
+        return fromMicroseconds(value / 1000);
+    }
+    
+    static constexpr Seconds infinity()
+    {
+        return Seconds(std::numeric_limits&lt;double&gt;::infinity());
+    }
+    
+    explicit operator bool() const { return !!m_value; }
+    
+    Seconds operator+(Seconds other) const
+    {
+        return Seconds(value() + other.value());
+    }
+    
+    Seconds operator-(Seconds other) const
+    {
+        return Seconds(value() - other.value());
+    }
+    
+    Seconds operator-() const
+    {
+        return Seconds(-value());
+    }
+    
+    // It makes sense to consider scaling a duration, like, &quot;I want to wait 5 times as long as
+    // last time!&quot;.
+    Seconds operator*(double scalar) const
+    {
+        return Seconds(value() * scalar);
+    }
+    
+    Seconds operator/(double scalar) const
+    {
+        return Seconds(value() / scalar);
+    }
+    
+    // It's reasonable to think about ratios between Seconds.
+    double operator/(Seconds other) const
+    {
+        return value() / other.value();
+    }
+    
+    Seconds&amp; operator+=(Seconds other)
+    {
+        return *this = *this + other;
+    }
+    
+    Seconds&amp; operator-=(Seconds other)
+    {
+        return *this = *this - other;
+    }
+    
+    Seconds&amp; operator*=(double scalar)
+    {
+        return *this = *this * scalar;
+    }
+    
+    Seconds&amp; operator/=(double scalar)
+    {
+        return *this = *this / scalar;
+    }
+    
+    WTF_EXPORT_PRIVATE WallTime operator+(WallTime) const;
+    WTF_EXPORT_PRIVATE MonotonicTime operator+(MonotonicTime) const;
+    WTF_EXPORT_PRIVATE TimeWithDynamicClockType operator+(const TimeWithDynamicClockType&amp;) const;
+    
+    WTF_EXPORT_PRIVATE WallTime operator-(WallTime) const;
+    WTF_EXPORT_PRIVATE MonotonicTime operator-(MonotonicTime) const;
+    WTF_EXPORT_PRIVATE TimeWithDynamicClockType operator-(const TimeWithDynamicClockType&amp;) const;
+    
+    bool operator==(Seconds other) const
+    {
+        return m_value == other.m_value;
+    }
+    
+    bool operator!=(Seconds other) const
+    {
+        return m_value != other.m_value;
+    }
+    
+    bool operator&lt;(Seconds other) const
+    {
+        return m_value &lt; other.m_value;
+    }
+    
+    bool operator&gt;(Seconds other) const
+    {
+        return m_value &gt; other.m_value;
+    }
+    
+    bool operator&lt;=(Seconds other) const
+    {
+        return m_value &lt;= other.m_value;
+    }
+    
+    bool operator&gt;=(Seconds other) const
+    {
+        return m_value &gt;= other.m_value;
+    }
+    
+    WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
+    
+private:
+    double m_value { 0 };
+};
+
+WTF_EXPORT_PRIVATE void sleep(Seconds);
+
+} // namespae WTF
+
+using WTF::Seconds;
+
+#endif // WTF_Seconds_h
</ins></span></pre></div>
<a id="trunkSourceWTFwtfTimeWithDynamicClockTypecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/TimeWithDynamicClockType.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/TimeWithDynamicClockType.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/TimeWithDynamicClockType.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &quot;config.h&quot;
+#include &quot;TimeWithDynamicClockType.h&quot;
+
+#include &quot;Condition.h&quot;
+#include &quot;Lock.h&quot;
+#include &quot;PrintStream.h&quot;
+
+namespace WTF {
+
+TimeWithDynamicClockType TimeWithDynamicClockType::now(ClockType type)
+{
+    switch (type) {
+    case ClockType::Wall:
+        return WallTime::now();
+    case ClockType::Monotonic:
+        return MonotonicTime::now();
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return TimeWithDynamicClockType();
+}
+
+TimeWithDynamicClockType TimeWithDynamicClockType::nowWithSameClock() const
+{
+    return now(clockType());
+}
+
+WallTime TimeWithDynamicClockType::wallTime() const
+{
+    RELEASE_ASSERT(m_type == ClockType::Wall);
+    return WallTime::fromRawSeconds(m_value);
+}
+
+MonotonicTime TimeWithDynamicClockType::monotonicTime() const
+{
+    RELEASE_ASSERT(m_type == ClockType::Monotonic);
+    return MonotonicTime::fromRawSeconds(m_value);
+}
+
+WallTime TimeWithDynamicClockType::approximateWallTime() const
+{
+    switch (m_type) {
+    case ClockType::Wall:
+        return wallTime();
+    case ClockType::Monotonic:
+        return monotonicTime().approximateWallTime();
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return WallTime();
+}
+
+MonotonicTime TimeWithDynamicClockType::approximateMonotonicTime() const
+{
+    switch (m_type) {
+    case ClockType::Wall:
+        return wallTime().approximateMonotonicTime();
+    case ClockType::Monotonic:
+        return monotonicTime();
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return MonotonicTime();
+}
+
+Seconds TimeWithDynamicClockType::operator-(const TimeWithDynamicClockType&amp; other) const
+{
+    RELEASE_ASSERT(m_type == other.m_type);
+    return Seconds(m_value - other.m_value);
+}
+
+bool TimeWithDynamicClockType::operator&lt;(const TimeWithDynamicClockType&amp; other) const
+{
+    RELEASE_ASSERT(m_type == other.m_type);
+    return m_value &lt; other.m_value;
+}
+
+bool TimeWithDynamicClockType::operator&gt;(const TimeWithDynamicClockType&amp; other) const
+{
+    RELEASE_ASSERT(m_type == other.m_type);
+    return m_value &gt; other.m_value;
+}
+
+bool TimeWithDynamicClockType::operator&lt;=(const TimeWithDynamicClockType&amp; other) const
+{
+    RELEASE_ASSERT(m_type == other.m_type);
+    return m_value &lt;= other.m_value;
+}
+
+bool TimeWithDynamicClockType::operator&gt;=(const TimeWithDynamicClockType&amp; other) const
+{
+    RELEASE_ASSERT(m_type == other.m_type);
+    return m_value &gt;= other.m_value;
+}
+
+void TimeWithDynamicClockType::dump(PrintStream&amp; out) const
+{
+    out.print(m_type, &quot;(&quot;, m_value, &quot; sec)&quot;);
+}
+
+void sleep(const TimeWithDynamicClockType&amp; time)
+{
+    Lock fakeLock;
+    Condition fakeCondition;
+    LockHolder fakeLocker(fakeLock);
+    fakeCondition.waitUntil(fakeLock, time);
+}
+
+} // namespace WTF
+
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfTimeWithDynamicClockTypeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/TimeWithDynamicClockType.h (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/TimeWithDynamicClockType.h                                (rev 0)
+++ trunk/Source/WTF/wtf/TimeWithDynamicClockType.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 WTF_TimeWithDynamicClockType_h
+#define WTF_TimeWithDynamicClockType_h
+
+#include &lt;wtf/ClockType.h&gt;
+#include &lt;wtf/MonotonicTime.h&gt;
+#include &lt;wtf/WallTime.h&gt;
+
+namespace WTF {
+
+class PrintStream;
+
+class TimeWithDynamicClockType {
+public:
+    TimeWithDynamicClockType() { }
+    
+    TimeWithDynamicClockType(WallTime time)
+        : m_value(time.secondsSinceEpoch().value())
+        , m_type(ClockType::Wall)
+    {
+    }
+    
+    TimeWithDynamicClockType(MonotonicTime time)
+        : m_value(time.secondsSinceEpoch().value())
+        , m_type(ClockType::Monotonic)
+    {
+    }
+    
+    static TimeWithDynamicClockType fromRawSeconds(double value, ClockType type)
+    {
+        TimeWithDynamicClockType result;
+        result.m_value = value;
+        result.m_type = type;
+        return result;
+    }
+    
+    Seconds secondsSinceEpoch() const { return Seconds(m_value); }
+    ClockType clockType() const { return m_type; }
+    
+    WTF_EXPORT_PRIVATE static TimeWithDynamicClockType now(ClockType);
+    
+    WTF_EXPORT_PRIVATE TimeWithDynamicClockType nowWithSameClock() const;
+    
+    TimeWithDynamicClockType withSameClockAndRawSeconds(double value) const
+    {
+        return TimeWithDynamicClockType::fromRawSeconds(value, clockType());
+    }
+    
+    // Asserts that the time is of the type you want.
+    WTF_EXPORT_PRIVATE WallTime wallTime() const;
+    WTF_EXPORT_PRIVATE MonotonicTime monotonicTime() const;
+    
+    WTF_EXPORT_PRIVATE WallTime approximateWallTime() const;
+    WTF_EXPORT_PRIVATE MonotonicTime approximateMonotonicTime() const;
+    
+    explicit operator bool() const { return !!m_value; }
+    
+    TimeWithDynamicClockType operator+(Seconds other) const
+    {
+        return withSameClockAndRawSeconds(m_value + other.value());
+    }
+    
+    TimeWithDynamicClockType operator-(Seconds other) const
+    {
+        return withSameClockAndRawSeconds(m_value - other.value());
+    }
+    
+    // Time is a scalar and scalars can be negated as this could arise from algebraic
+    // transformations. So, we allow it.
+    TimeWithDynamicClockType operator-() const
+    {
+        return withSameClockAndRawSeconds(-m_value);
+    }
+    
+    TimeWithDynamicClockType operator+=(Seconds other)
+    {
+        return *this = *this + other;
+    }
+    
+    TimeWithDynamicClockType operator-=(Seconds other)
+    {
+        return *this = *this - other;
+    }
+    
+    WTF_EXPORT_PRIVATE Seconds operator-(const TimeWithDynamicClockType&amp;) const;
+    
+    bool operator==(const TimeWithDynamicClockType&amp; other) const
+    {
+        return m_value == other.m_value
+            &amp;&amp; m_type == other.m_type;
+    }
+    
+    bool operator!=(const TimeWithDynamicClockType&amp; other) const
+    {
+        return !(*this == other);
+    }
+    
+    // To do relative comparisons, you must be using times with the same clock type.
+    WTF_EXPORT_PRIVATE bool operator&lt;(const TimeWithDynamicClockType&amp;) const;
+    WTF_EXPORT_PRIVATE bool operator&gt;(const TimeWithDynamicClockType&amp;) const;
+    WTF_EXPORT_PRIVATE bool operator&lt;=(const TimeWithDynamicClockType&amp;) const;
+    WTF_EXPORT_PRIVATE bool operator&gt;=(const TimeWithDynamicClockType&amp;) const;
+    
+    WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
+    
+private:
+    double m_value { 0 };
+    ClockType m_type { ClockType::Wall };
+};
+
+WTF_EXPORT_PRIVATE void sleep(const TimeWithDynamicClockType&amp;);
+
+} // namespace WTF
+
+using WTF::TimeWithDynamicClockType;
+
+#endif // WTF_TimeWithDynamicClockType_h
</ins></span></pre></div>
<a id="trunkSourceWTFwtfWallTimecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/WallTime.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WallTime.cpp                                (rev 0)
+++ trunk/Source/WTF/wtf/WallTime.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &quot;config.h&quot;
+#include &quot;WallTime.h&quot;
+
+#include &quot;CurrentTime.h&quot;
+#include &quot;MonotonicTime.h&quot;
+#include &quot;PrintStream.h&quot;
+#include &quot;TimeWithDynamicClockType.h&quot;
+
+namespace WTF {
+
+WallTime WallTime::now()
+{
+    return fromRawSeconds(currentTime());
+}
+
+MonotonicTime WallTime::approximateMonotonicTime() const
+{
+    return *this - now() + MonotonicTime::now();
+}
+
+void WallTime::dump(PrintStream&amp; out) const
+{
+    out.print(&quot;Wall(&quot;, m_value, &quot; sec)&quot;);
+}
+
+} // namespace WTF
+
+
</ins></span></pre></div>
<a id="trunkSourceWTFwtfWallTimeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/WallTime.h (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WallTime.h                                (rev 0)
+++ trunk/Source/WTF/wtf/WallTime.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 WTF_WallTime_h
+#define WTF_WallTime_h
+
+#include &lt;wtf/ClockType.h&gt;
+#include &lt;wtf/Seconds.h&gt;
+
+namespace WTF {
+
+class MonotonicTime;
+class PrintStream;
+
+// The current time according to a wall clock (aka real time clock). This uses floating point
+// internally so that you can reason about infinity and other things that arise in math. It's
+// acceptable to use this to wrap NaN times, negative times, and infinite times, so long as they
+// are relative to the same clock. Specifically, WallTime should be used in agreement with the
+// principle that WallTime::now().secondsSinceEpoch().value() is the same as WTF::currentTime().
+class WallTime {
+public:
+    static const ClockType clockType = ClockType::Wall;
+    
+    // This is the epoch. So, x.secondsSinceEpoch() should be the same as x - WallTime().
+    WallTime() { }
+    
+    // Call this if you know for sure that the double represents time according to
+    // WTF::currentTime(). It must be in seconds and it must be from the same time source.
+    static WallTime fromRawSeconds(double value)
+    {
+        WallTime result;
+        result.m_value = value;
+        return result;
+    }
+    
+    WTF_EXPORT_PRIVATE static WallTime now();
+    
+    static WallTime infinity() { return fromRawSeconds(std::numeric_limits&lt;double&gt;::infinity()); }
+    
+    Seconds secondsSinceEpoch() const { return Seconds(m_value); }
+    
+    WallTime approximateWallTime() const { return *this; }
+    WTF_EXPORT_PRIVATE MonotonicTime approximateMonotonicTime() const;
+    
+    explicit operator bool() const { return !!m_value; }
+    
+    WallTime operator+(Seconds other) const
+    {
+        return fromRawSeconds(m_value + other.value());
+    }
+    
+    WallTime operator-(Seconds other) const
+    {
+        return fromRawSeconds(m_value - other.value());
+    }
+    
+    // Time is a scalar and scalars can be negated as this could arise from algebraic
+    // transformations. So, we allow it.
+    WallTime operator-() const
+    {
+        return fromRawSeconds(-m_value);
+    }
+    
+    WallTime&amp; operator+=(Seconds other)
+    {
+        return *this = *this + other;
+    }
+    
+    WallTime&amp; operator-=(Seconds other)
+    {
+        return *this = *this - other;
+    }
+    
+    Seconds operator-(WallTime other) const
+    {
+        return Seconds(m_value - other.m_value);
+    }
+    
+    bool operator==(WallTime other) const
+    {
+        return m_value == other.m_value;
+    }
+    
+    bool operator!=(WallTime other) const
+    {
+        return m_value != other.m_value;
+    }
+    
+    bool operator&lt;(WallTime other) const
+    {
+        return m_value &lt; other.m_value;
+    }
+    
+    bool operator&gt;(WallTime other) const
+    {
+        return m_value &gt; other.m_value;
+    }
+    
+    bool operator&lt;=(WallTime other) const
+    {
+        return m_value &lt;= other.m_value;
+    }
+    
+    bool operator&gt;=(WallTime other) const
+    {
+        return m_value &gt;= other.m_value;
+    }
+    
+    WTF_EXPORT_PRIVATE void dump(PrintStream&amp;) const;
+    
+private:
+    double m_value { 0 };
+};
+
+WTF_EXPORT_PRIVATE void sleep(WallTime);
+
+} // namespace WTF
+
+using WTF::WallTime;
+
+#endif // WTF_WallTime_h
</ins></span></pre></div>
<a id="trunkSourceWTFwtfthreadsBinarySemaphorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/threads/BinarySemaphore.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/threads/BinarySemaphore.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/threads/BinarySemaphore.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -45,13 +45,14 @@
</span><span class="cx">     m_condition.signal();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool BinarySemaphore::wait(double absoluteTime)
</del><ins>+bool BinarySemaphore::wait(TimeWithDynamicClockType absoluteTime)
</ins><span class="cx"> {
</span><span class="cx">     MutexLocker locker(m_mutex);
</span><span class="cx"> 
</span><span class="cx">     bool timedOut = false;
</span><span class="cx">     while (!m_isSet) {
</span><del>-        timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
</del><ins>+        timedOut = !m_condition.timedWait(
+            m_mutex, absoluteTime.approximateWallTime().secondsSinceEpoch().value());
</ins><span class="cx">         if (timedOut)
</span><span class="cx">             return false;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWTFwtfthreadsBinarySemaphoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/threads/BinarySemaphore.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/threads/BinarySemaphore.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WTF/wtf/threads/BinarySemaphore.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/ThreadingPrimitives.h&gt;
</span><ins>+#include &lt;wtf/TimeWithDynamicClockType.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="lines">@@ -39,7 +40,7 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE ~BinarySemaphore();
</span><span class="cx"> 
</span><span class="cx">     WTF_EXPORT_PRIVATE void signal();
</span><del>-    WTF_EXPORT_PRIVATE bool wait(double absoluteTime);
</del><ins>+    WTF_EXPORT_PRIVATE bool wait(TimeWithDynamicClockType);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool m_isSet;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/ChangeLog        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
+        https://bugs.webkit.org/show_bug.cgi?id=152045
+
+        Reviewed by Andy Estes.
+
+        No new layout tests because no new behavior. The new WTF time classes have some unit tests
+        in TestWebKitAPI.
+
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::blobSize):
+        * platform/MainThreadSharedTimer.h:
+        * platform/SharedTimer.h:
+        * platform/ThreadTimers.cpp:
+        (WebCore::ThreadTimers::updateSharedTimer):
+        * platform/cf/MainThreadSharedTimerCF.cpp:
+        (WebCore::MainThreadSharedTimer::setFireInterval):
+        * platform/efl/MainThreadSharedTimerEfl.cpp:
+        (WebCore::MainThreadSharedTimer::setFireInterval):
+        * platform/glib/MainThreadSharedTimerGLib.cpp:
+        (WebCore::MainThreadSharedTimer::setFireInterval):
+        * platform/win/MainThreadSharedTimerWin.cpp:
+        (WebCore::MainThreadSharedTimer::setFireInterval):
+        * workers/WorkerRunLoop.cpp:
+        (WebCore::WorkerRunLoop::runInMode):
+
</ins><span class="cx"> 2016-11-04  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         RenderFlowThread state reset cleanup.
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">             resultSize = blobRegistry().blobSize(url);
</span><span class="cx">             semaphore.signal();
</span><span class="cx">         });
</span><del>-        semaphore.wait(std::numeric_limits&lt;double&gt;::max());
</del><ins>+        semaphore.wait(WallTime::infinity());
</ins><span class="cx">     }
</span><span class="cx">     return resultSize;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMainThreadSharedTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MainThreadSharedTimer.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MainThreadSharedTimer.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2015 Igalia S.L.
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     static MainThreadSharedTimer&amp; singleton();
</span><span class="cx"> 
</span><span class="cx">     void setFiredFunction(std::function&lt;void()&gt;&amp;&amp;) override;
</span><del>-    void setFireInterval(double) override;
</del><ins>+    void setFireInterval(Seconds) override;
</ins><span class="cx">     void stop() override;
</span><span class="cx">     void invalidate() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformSharedTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/SharedTimer.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/SharedTimer.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/SharedTimer.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;wtf/FastMalloc.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><ins>+#include &lt;wtf/Seconds.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -43,7 +44,7 @@
</span><span class="cx">     virtual void setFiredFunction(std::function&lt;void()&gt;&amp;&amp;) = 0;
</span><span class="cx"> 
</span><span class="cx">     // The fire interval is in seconds relative to the current monotonic clock time.
</span><del>-    virtual void setFireInterval(double) = 0;
</del><ins>+    virtual void setFireInterval(Seconds) = 0;
</ins><span class="cx">     virtual void stop() = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void invalidate() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThreadTimerscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThreadTimers.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThreadTimers.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/ThreadTimers.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009 Google Inc. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">                 return;
</span><span class="cx">         } 
</span><span class="cx">         m_pendingSharedTimerFireTime = nextFireTime;
</span><del>-        m_sharedTimer-&gt;setFireInterval(std::max(nextFireTime - currentMonotonicTime, 0.0));
</del><ins>+        m_sharedTimer-&gt;setFireInterval(Seconds(std::max(nextFireTime - currentMonotonicTime, 0.0)));
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfMainThreadSharedTimerCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2010, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -93,11 +93,11 @@
</span><span class="cx">     sharedTimer = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MainThreadSharedTimer::setFireInterval(double interval)
</del><ins>+void MainThreadSharedTimer::setFireInterval(Seconds interval)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_firedFunction);
</span><span class="cx"> 
</span><del>-    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
</del><ins>+    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval.value();
</ins><span class="cx">     if (!sharedTimer) {
</span><span class="cx">         sharedTimer = CFRunLoopTimerCreate(nullptr, fireDate, kCFTimeIntervalDistantFuture, 0, 0, timerFired, nullptr);
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformeflMainThreadSharedTimerEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/efl/MainThreadSharedTimerEfl.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx">  *           (C) 2008 Afonso Rabelo Costa Jr.
</span><span class="cx">  *           (C) 2009-2010 ProFUSION embedded systems
</span><span class="cx">  *           (C) 2009-2010 Samsung Electronics
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -53,10 +54,10 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MainThreadSharedTimer::setFireInterval(double interval)
</del><ins>+void MainThreadSharedTimer::setFireInterval(Seconds interval)
</ins><span class="cx"> {
</span><span class="cx">     stop();
</span><del>-    sharedTimer = ecore_timer_loop_add(interval, timerEvent, nullptr);
</del><ins>+    sharedTimer = ecore_timer_loop_add(interval.value(), timerEvent, nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MainThreadSharedTimer::invalidate()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformglibMainThreadSharedTimerGLibcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
</span><span class="cx">  * All rights reserved.
</span><span class="cx">  *
</span><span class="lines">@@ -39,10 +39,10 @@
</span><span class="cx">     m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MainThreadSharedTimer::setFireInterval(double interval)
</del><ins>+void MainThreadSharedTimer::setFireInterval(Seconds interval)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_firedFunction);
</span><del>-    m_timer.startOneShot(interval);
</del><ins>+    m_timer.startOneShot(interval.value());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MainThreadSharedTimer::stop()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinMainThreadSharedTimerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -121,12 +121,12 @@
</span><span class="cx">         PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MainThreadSharedTimer::setFireInterval(double interval)
</del><ins>+void MainThreadSharedTimer::setFireInterval(Seconds intervalInSeconds)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_firedFunction);
</span><span class="cx"> 
</span><ins>+    double interval = intervalInSeconds.milliseconds();
</ins><span class="cx">     unsigned intervalInMS;
</span><del>-    interval *= 1000;
</del><span class="cx">     if (interval &gt; USER_TIMER_MAXIMUM)
</span><span class="cx">         intervalInMS = USER_TIMER_MAXIMUM;
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerRunLoopcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerRunLoop.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerRunLoop.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2009 Google Inc. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  * 
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -49,16 +50,16 @@
</span><span class="cx"> public:
</span><span class="cx">     // SharedTimer interface.
</span><span class="cx">     void setFiredFunction(std::function&lt;void()&gt;&amp;&amp; function) override { m_sharedTimerFunction = WTFMove(function); }
</span><del>-    void setFireInterval(double interval) override { m_nextFireTime = interval + currentTime(); }
-    void stop() override { m_nextFireTime = 0; }
</del><ins>+    void setFireInterval(Seconds interval) override { m_nextFireTime = interval + WallTime::now(); }
+    void stop() override { m_nextFireTime = WallTime(); }
</ins><span class="cx"> 
</span><span class="cx">     bool isActive() { return m_sharedTimerFunction &amp;&amp; m_nextFireTime; }
</span><del>-    double fireTime() { return m_nextFireTime; }
</del><ins>+    WallTime fireTime() { return m_nextFireTime; }
</ins><span class="cx">     void fire() { m_sharedTimerFunction(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     std::function&lt;void()&gt; m_sharedTimerFunction;
</span><del>-    double m_nextFireTime { 0 };
</del><ins>+    WallTime m_nextFireTime;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class ModePredicate {
</span><span class="lines">@@ -157,15 +158,16 @@
</span><span class="cx">         g_main_context_iteration(mainContext, FALSE);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    double deadline = MessageQueue&lt;Task&gt;::infiniteTime();
</del><ins>+    WallTime deadline = WallTime::infinity();
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CF)
</span><span class="cx">     CFAbsoluteTime nextCFRunLoopTimerFireDate = CFRunLoopGetNextTimerFireDate(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
</span><span class="cx">     double timeUntilNextCFRunLoopTimerInSeconds = nextCFRunLoopTimerFireDate - CFAbsoluteTimeGetCurrent();
</span><del>-    deadline = currentTime() + std::max(0.0, timeUntilNextCFRunLoopTimerInSeconds);
</del><ins>+    deadline = WallTime::now() + std::max(
+        Seconds(0), Seconds(timeUntilNextCFRunLoopTimerInSeconds));
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    double absoluteTime = 0.0;
</del><ins>+    WallTime absoluteTime;
</ins><span class="cx">     if (waitMode == WaitForMessage) {
</span><span class="cx">         if (predicate.isDefaultMode() &amp;&amp; m_sharedTimer-&gt;isActive())
</span><span class="cx">             absoluteTime = std::min(deadline, m_sharedTimer-&gt;fireTime());
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/ChangeLog        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2016-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
+        https://bugs.webkit.org/show_bug.cgi?id=152045
+
+        Reviewed by Andy Estes.
+
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::SyncMessageState::wait):
+        (IPC::Connection::sendMessage):
+        (IPC::Connection::timeoutRespectingIgnoreTimeoutsForTesting):
+        (IPC::Connection::waitForMessage):
+        (IPC::Connection::sendSyncMessage):
+        (IPC::Connection::waitForSyncReply):
+        * Platform/IPC/Connection.h:
+        (IPC::Connection::sendSync):
+        (IPC::Connection::waitForAndDispatchImmediately):
+        * Platform/IPC/MessageSender.h:
+        (IPC::MessageSender::sendSync):
+        * UIProcess/ChildProcessProxy.h:
+        (WebKit::ChildProcessProxy::sendSync):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
+        * UIProcess/Storage/StorageManager.cpp:
+        (WebKit::StorageManager::applicationWillTerminate):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (-[WKOneShotDisplayLinkHandler displayLinkFired:]):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+        (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::stringSelectionForPasteboard):
+        (WebKit::WebPageProxy::dataSelectionForPasteboard):
+        (WebKit::WebPageProxy::readSelectionFromPasteboard):
+        (WebKit::WebPageProxy::shouldDelayWindowOrderingForEvent):
+        (WebKit::WebPageProxy::acceptsFirstMouse):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
+        (WebKit::WebChromeClient::runJavaScriptAlert):
+        (WebKit::WebChromeClient::runJavaScriptConfirm):
+        (WebKit::WebChromeClient::runJavaScriptPrompt):
+        (WebKit::WebChromeClient::print):
+        (WebKit::WebChromeClient::exceededDatabaseQuota):
+        (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::postSynchronousMessageForTesting):
+
</ins><span class="cx"> 2016-11-04  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Safari does not emit composition end if blurred for dead key / Japanese IME
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">         m_waitForSyncReplySemaphore.signal();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool wait(double absoluteTime)
</del><ins>+    bool wait(TimeWithDynamicClockType absoluteTime)
</ins><span class="cx">     {
</span><span class="cx">         return m_waitForSyncReplySemaphore.wait(absoluteTime);
</span><span class="cx">     }
</span><span class="lines">@@ -376,7 +376,7 @@
</span><span class="cx">         auto wrappedMessage = createSyncMessageEncoder(&quot;IPC&quot;, &quot;WrappedAsyncMessageForTesting&quot;, encoder-&gt;destinationID(), syncRequestID);
</span><span class="cx">         wrappedMessage-&gt;setFullySynchronousModeForTesting();
</span><span class="cx">         wrappedMessage-&gt;wrapForTesting(WTFMove(encoder));
</span><del>-        return static_cast&lt;bool&gt;(sendSyncMessage(syncRequestID, WTFMove(wrappedMessage), std::chrono::milliseconds::max(), { }));
</del><ins>+        return static_cast&lt;bool&gt;(sendSyncMessage(syncRequestID, WTFMove(wrappedMessage), Seconds::infinity(), { }));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (sendOptions.contains(SendOption::DispatchMessageEvenWhenWaitingForSyncReply)
</span><span class="lines">@@ -420,12 +420,12 @@
</span><span class="cx">     return sendMessage(WTFMove(encoder), { });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::chrono::milliseconds Connection::timeoutRespectingIgnoreTimeoutsForTesting(std::chrono::milliseconds timeout) const
</del><ins>+Seconds Connection::timeoutRespectingIgnoreTimeoutsForTesting(Seconds timeout) const
</ins><span class="cx"> {
</span><del>-    return m_ignoreTimeoutsForTesting ? std::chrono::milliseconds::max() : timeout;
</del><ins>+    return m_ignoreTimeoutsForTesting ? Seconds::infinity() : timeout;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;Decoder&gt; Connection::waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions)
</del><ins>+std::unique_ptr&lt;Decoder&gt; Connection::waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, Seconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(RunLoop::isMain());
</span><span class="cx"> 
</span><span class="lines">@@ -469,10 +469,7 @@
</span><span class="cx">         m_waitingForMessage = &amp;waitingForMessage;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Clamp the timeout to however much time is remaining on our clock.
-    auto now = Condition::Clock::now();
-    auto remainingClockTime = std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;(Condition::Clock::time_point::max() - now);
-    auto absoluteTimeout = now + std::min(remainingClockTime, timeout);
</del><ins>+    MonotonicTime absoluteTimeout = MonotonicTime::now() + timeout;
</ins><span class="cx"> 
</span><span class="cx">     // Now wait for it to be set.
</span><span class="cx">     while (true) {
</span><span class="lines">@@ -496,7 +493,7 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;Decoder&gt; Connection::sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt; encoder, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</del><ins>+std::unique_ptr&lt;Decoder&gt; Connection::sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt; encoder, Seconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(RunLoop::isMain());
</span><span class="cx"> 
</span><span class="lines">@@ -541,10 +538,10 @@
</span><span class="cx">     return reply;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;Decoder&gt; Connection::waitForSyncReply(uint64_t syncRequestID, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</del><ins>+std::unique_ptr&lt;Decoder&gt; Connection::waitForSyncReply(uint64_t syncRequestID, Seconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</ins><span class="cx"> {
</span><span class="cx">     timeout = timeoutRespectingIgnoreTimeoutsForTesting(timeout);
</span><del>-    double absoluteTime = currentTime() + (timeout.count() / 1000.0);
</del><ins>+    WallTime absoluteTime = WallTime::now() + timeout;
</ins><span class="cx"> 
</span><span class="cx">     willSendSyncMessage(sendSyncOptions);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
</span><span class="cx">  *
</span><span class="lines">@@ -166,13 +166,13 @@
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt; bool send(T&amp;&amp; message, uint64_t destinationID, OptionSet&lt;SendOption&gt; sendOptions = { });
</span><span class="cx">     template&lt;typename T&gt; void sendWithReply(T&amp;&amp; message, uint64_t destinationID, FunctionDispatcher&amp; replyDispatcher, Function&lt;void (Optional&lt;typename CodingType&lt;typename T::Reply&gt;::Type&gt;)&gt;&amp;&amp; replyHandler);
</span><del>-    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout = std::chrono::milliseconds::max(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { });
-    template&lt;typename T&gt; bool waitForAndDispatchImmediately(uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions = { });
</del><ins>+    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, Seconds timeout = Seconds::infinity(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { });
+    template&lt;typename T&gt; bool waitForAndDispatchImmediately(uint64_t destinationID, Seconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions = { });
</ins><span class="cx"> 
</span><span class="cx">     bool sendMessage(std::unique_ptr&lt;Encoder&gt;, OptionSet&lt;SendOption&gt; sendOptions);
</span><span class="cx">     void sendMessageWithReply(uint64_t requestID, std::unique_ptr&lt;Encoder&gt;, FunctionDispatcher&amp; replyDispatcher, Function&lt;void (std::unique_ptr&lt;Decoder&gt;)&gt;&amp;&amp; replyHandler);
</span><span class="cx">     std::unique_ptr&lt;Encoder&gt; createSyncMessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, uint64_t&amp; syncRequestID);
</span><del>-    std::unique_ptr&lt;Decoder&gt; sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt;, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions);
</del><ins>+    std::unique_ptr&lt;Decoder&gt; sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt;, Seconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions);
</ins><span class="cx">     bool sendSyncReply(std::unique_ptr&lt;Encoder&gt;);
</span><span class="cx"> 
</span><span class="cx">     void wakeUpRunLoop();
</span><span class="lines">@@ -208,9 +208,9 @@
</span><span class="cx">     void platformInitialize(Identifier);
</span><span class="cx">     void platformInvalidate();
</span><span class="cx">     
</span><del>-    std::unique_ptr&lt;Decoder&gt; waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;WaitForOption&gt;);
</del><ins>+    std::unique_ptr&lt;Decoder&gt; waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, Seconds timeout, OptionSet&lt;WaitForOption&gt;);
</ins><span class="cx">     
</span><del>-    std::unique_ptr&lt;Decoder&gt; waitForSyncReply(uint64_t syncRequestID, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt;);
</del><ins>+    std::unique_ptr&lt;Decoder&gt; waitForSyncReply(uint64_t syncRequestID, Seconds timeout, OptionSet&lt;SendSyncOption&gt;);
</ins><span class="cx"> 
</span><span class="cx">     // Called on the connection work queue.
</span><span class="cx">     void processIncomingMessage(std::unique_ptr&lt;Decoder&gt;);
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">     void willSendSyncMessage(OptionSet&lt;SendSyncOption&gt;);
</span><span class="cx">     void didReceiveSyncReply(OptionSet&lt;SendSyncOption&gt;);
</span><span class="cx"> 
</span><del>-    std::chrono::milliseconds timeoutRespectingIgnoreTimeoutsForTesting(std::chrono::milliseconds) const;
</del><ins>+    Seconds timeoutRespectingIgnoreTimeoutsForTesting(Seconds) const;
</ins><span class="cx">     
</span><span class="cx">     Client&amp; m_client;
</span><span class="cx">     bool m_isServer;
</span><span class="lines">@@ -365,7 +365,7 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; bool Connection::sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</del><ins>+template&lt;typename T&gt; bool Connection::sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, Seconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</ins><span class="cx"> {
</span><span class="cx">     COMPILE_ASSERT(T::isSync, SyncMessageExpected);
</span><span class="cx"> 
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx">     return replyDecoder-&gt;decode(reply);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; bool Connection::waitForAndDispatchImmediately(uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions)
</del><ins>+template&lt;typename T&gt; bool Connection::waitForAndDispatchImmediately(uint64_t destinationID, Seconds timeout, OptionSet&lt;WaitForOption&gt; waitForOptions)
</ins><span class="cx"> {
</span><span class="cx">     std::unique_ptr&lt;Decoder&gt; decoder = waitForMessage(T::receiverName(), T::name(), destinationID, timeout, waitForOptions);
</span><span class="cx">     if (!decoder)
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCMessageSenderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/MessageSender.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/MessageSender.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/Platform/IPC/MessageSender.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt;
</span><del>-    bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, std::chrono::milliseconds timeout = std::chrono::milliseconds::max(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { })
</del><ins>+    bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, Seconds timeout = Seconds::infinity(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { })
</ins><span class="cx">     {
</span><span class="cx">         static_assert(T::isSync, &quot;Message is not sync!&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt;
</span><del>-    bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout = std::chrono::milliseconds::max(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { })
</del><ins>+    bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp; reply, uint64_t destinationID, Seconds timeout = Seconds::infinity(), OptionSet&lt;SendSyncOption&gt; sendSyncOptions = { })
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(messageSenderConnection());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAcceleratedDrawingAreaProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     // choose the most recent one, or the one that is closest to our current size.
</span><span class="cx"> 
</span><span class="cx">     // The timeout, in seconds, we use when waiting for a DidUpdateBackingStoreState message when we're asked to paint.
</span><del>-    m_webPageProxy.process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::DrawingAreaProxy::DidUpdateBackingStoreState&gt;(m_webPageProxy.pageID(), std::chrono::milliseconds(500));
</del><ins>+    m_webPageProxy.process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::DrawingAreaProxy::DidUpdateBackingStoreState&gt;(m_webPageProxy.pageID(), Seconds::fromMilliseconds(500));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AcceleratedDrawingAreaProxy::enterAcceleratedCompositingMode(const LayerTreeContext&amp; layerTreeContext)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessChildProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     void terminate();
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt; bool send(T&amp;&amp; message, uint64_t destinationID, OptionSet&lt;IPC::SendOption&gt; sendOptions = { });
</span><del>-    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp;, uint64_t destinationID, std::chrono::milliseconds timeout = std::chrono::seconds(1), OptionSet&lt;IPC::SendSyncOption&gt; sendSyncOptions = { });
</del><ins>+    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp;, uint64_t destinationID, Seconds timeout = Seconds(1), OptionSet&lt;IPC::SendSyncOption&gt; sendSyncOptions = { });
</ins><span class="cx"> 
</span><span class="cx">     IPC::Connection* connection() const
</span><span class="cx">     {
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename U&gt; 
</span><del>-bool ChildProcessProxy::sendSync(U&amp;&amp; message, typename U::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout, OptionSet&lt;IPC::SendSyncOption&gt; sendSyncOptions)
</del><ins>+bool ChildProcessProxy::sendSync(U&amp;&amp; message, typename U::Reply&amp;&amp; reply, uint64_t destinationID, Seconds timeout, OptionSet&lt;IPC::SendSyncOption&gt; sendSyncOptions)
</ins><span class="cx"> {
</span><span class="cx">     COMPILE_ASSERT(U::isSync, SyncMessageExpected);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDrawingAreaProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -71,9 +71,9 @@
</span><span class="cx">     void setSize(const WebCore::IntSize&amp;, const WebCore::IntSize&amp;, const WebCore::IntSize&amp; scrollOffset);
</span><span class="cx"> 
</span><span class="cx">     // The timeout we use when waiting for a DidUpdateGeometry message.
</span><del>-    static constexpr std::chrono::milliseconds didUpdateBackingStoreStateTimeout() { return std::chrono::milliseconds(500); }
</del><ins>+    static constexpr Seconds didUpdateBackingStoreStateTimeout() { return Seconds::fromMilliseconds(500); }
</ins><span class="cx"> 
</span><del>-    virtual void waitForPossibleGeometryUpdate(std::chrono::milliseconds = didUpdateBackingStoreStateTimeout()) { }
</del><ins>+    virtual void waitForPossibleGeometryUpdate(Seconds = didUpdateBackingStoreStateTimeout()) { }
</ins><span class="cx"> 
</span><span class="cx">     virtual void colorSpaceDidChange() { }
</span><span class="cx">     virtual void minimumLayoutSizeDidChange() { }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -369,7 +369,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     bool handled = false;
</span><del>-    sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, std::chrono::seconds(1));
</del><ins>+    sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, Seconds(1));
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void NetworkProcessProxy::sendPrepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessStorageStorageManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -843,7 +843,7 @@
</span><span class="cx"> 
</span><span class="cx">         semaphore.signal();
</span><span class="cx">     });
</span><del>-    semaphore.wait(std::numeric_limits&lt;double&gt;::max());
</del><ins>+    semaphore.wait(WallTime::infinity());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StorageManager::StorageArea* StorageManager::findStorageArea(IPC::Connection&amp; connection, uint64_t storageMapID) const
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -906,7 +906,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     bool handled = false;
</span><del>-    sendSync(Messages::WebProcess::ProcessWillSuspendImminently(), Messages::WebProcess::ProcessWillSuspendImminently::Reply(handled), 0, std::chrono::seconds(1));
</del><ins>+    sendSync(Messages::WebProcess::ProcessWillSuspendImminently(), Messages::WebProcess::ProcessWillSuspendImminently::Reply(handled), 0, Seconds(1));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcessProxy::sendPrepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx">         // Make sure any ongoing work in our queue is finished before we terminate.
</span><span class="cx">         semaphore.signal();
</span><span class="cx">     });
</span><del>-    semaphore.wait(std::numeric_limits&lt;double&gt;::max());
</del><ins>+    semaphore.wait(WallTime::infinity());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WebResourceLoadStatisticsStore::persistentStoragePath(const String&amp; label) const
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -678,7 +678,7 @@
</span><span class="cx"> - (CGPDFDocumentRef)_wk_printedDocument
</span><span class="cx"> {
</span><span class="cx">     if (_isPrintingToPDF) {
</span><del>-        if (!_page-&gt;process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DrawToPDFCallback&gt;(_page-&gt;pageID(), std::chrono::milliseconds::max())) {
</del><ins>+        if (!_page-&gt;process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DrawToPDFCallback&gt;(_page-&gt;pageID(), Seconds::infinity())) {
</ins><span class="cx">             ASSERT_NOT_REACHED();
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -295,7 +295,7 @@
</span><span class="cx">         double newScale;
</span><span class="cx">         FloatPoint newScrollPosition;
</span><span class="cx">         uint64_t nextValidLayerTreeTransactionID;
</span><del>-        if (m_process-&gt;sendSync(Messages::WebPage::SynchronizeDynamicViewportUpdate(), Messages::WebPage::SynchronizeDynamicViewportUpdate::Reply(newScale, newScrollPosition, nextValidLayerTreeTransactionID), m_pageID, std::chrono::seconds(2))) {
</del><ins>+        if (m_process-&gt;sendSync(Messages::WebPage::SynchronizeDynamicViewportUpdate(), Messages::WebPage::SynchronizeDynamicViewportUpdate::Reply(newScale, newScrollPosition, nextValidLayerTreeTransactionID), m_pageID, Seconds(2))) {
</ins><span class="cx">             m_dynamicViewportSizeUpdateWaitingForTarget = false;
</span><span class="cx">             m_dynamicViewportSizeUpdateLayerTreeTransactionID = nextValidLayerTreeTransactionID;
</span><span class="cx">             m_pageClient.dynamicViewportUpdateChangedTarget(newScale, newScrollPosition, nextValidLayerTreeTransactionID);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx">     uint64_t nextLayerTreeTransactionID() const { return m_pendingLayerTreeTransactionID + 1; }
</span><span class="cx">     uint64_t lastCommittedLayerTreeTransactionID() const { return m_transactionIDForPendingCACommit; }
</span><span class="cx"> 
</span><del>-    void didRefreshDisplay(double timestamp);
</del><ins>+    void didRefreshDisplay();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void sizeDidChange() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx"> - (void)displayLinkFired:(CADisplayLink *)sender
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isUIThread());
</span><del>-    _drawingAreaProxy-&gt;didRefreshDisplay(sender.timestamp);
</del><ins>+    _drawingAreaProxy-&gt;didRefreshDisplay();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)invalidate
</span><span class="lines">@@ -228,11 +228,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     if (std::exchange(m_didUpdateMessageState, NeedsDidUpdate) == MissedCommit)
</span><del>-        didRefreshDisplay(monotonicallyIncreasingTime());
</del><ins>+        didRefreshDisplay();
</ins><span class="cx">     [m_displayLinkHandler schedule];
</span><span class="cx"> #else
</span><span class="cx">     m_didUpdateMessageState = NeedsDidUpdate;
</span><del>-    didRefreshDisplay(monotonicallyIncreasingTime());
</del><ins>+    didRefreshDisplay();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (auto milestones = layerTreeTransaction.newlyReachedLayoutMilestones())
</span><span class="lines">@@ -394,7 +394,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay(double)
</del><ins>+void RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_webPageProxy.isValid())
</span><span class="cx">         return;
</span><span class="lines">@@ -426,16 +426,16 @@
</span><span class="cx">     // We must send the didUpdate message before blocking on the next commit, otherwise
</span><span class="cx">     // we can be guaranteed that the next commit won't come until after the waitForAndDispatchImmediately times out.
</span><span class="cx">     if (m_didUpdateMessageState != DoesNotNeedDidUpdate)
</span><del>-        didRefreshDisplay(monotonicallyIncreasingTime());
</del><ins>+        didRefreshDisplay();
</ins><span class="cx"> 
</span><del>-    static std::chrono::milliseconds activityStateUpdateTimeout = [] {
</del><ins>+    static Seconds activityStateUpdateTimeout = [] {
</ins><span class="cx">         if (id value = [[NSUserDefaults standardUserDefaults] objectForKey:@&quot;WebKitOverrideActivityStateUpdateTimeout&quot;])
</span><del>-            return std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;(std::chrono::duration&lt;double&gt;([value doubleValue]));
</del><ins>+            return Seconds([value doubleValue]);
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        return std::chrono::milliseconds(500);
</del><ins>+        return Seconds::fromMilliseconds(500);
</ins><span class="cx"> #else
</span><del>-        return std::chrono::milliseconds(250);
</del><ins>+        return Seconds::fromMilliseconds(250);
</ins><span class="cx"> #endif
</span><span class="cx">     }();
</span><span class="cx">     m_webPageProxy.process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree&gt;(m_webPageProxy.pageID(), activityStateUpdateTimeout, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacTiledCoreAnimationDrawingAreaProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx">     // DrawingAreaProxy
</span><span class="cx">     void deviceScaleFactorDidChange() override;
</span><span class="cx">     void sizeDidChange() override;
</span><del>-    void waitForPossibleGeometryUpdate(std::chrono::milliseconds timeout = didUpdateBackingStoreStateTimeout()) override;
</del><ins>+    void waitForPossibleGeometryUpdate(Seconds timeout = didUpdateBackingStoreStateTimeout()) override;
</ins><span class="cx">     void colorSpaceDidChange() override;
</span><span class="cx">     void minimumLayoutSizeDidChange() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacTiledCoreAnimationDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     sendUpdateGeometry();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TiledCoreAnimationDrawingAreaProxy::waitForPossibleGeometryUpdate(std::chrono::milliseconds timeout)
</del><ins>+void TiledCoreAnimationDrawingAreaProxy::waitForPossibleGeometryUpdate(Seconds timeout)
</ins><span class="cx"> {
</span><span class="cx"> #if !HAVE(COREANIMATION_FENCES)
</span><span class="cx">     if (!m_isWaitingForDidUpdateGeometry)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx"> 
</span><span class="cx"> void TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState()
</span><span class="cx"> {
</span><del>-    auto activityStateUpdateTimeout = std::chrono::milliseconds(250);
</del><ins>+    Seconds activityStateUpdateTimeout = Seconds::fromMilliseconds(250);
</ins><span class="cx">     m_webPageProxy.process().connection()-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DidUpdateActivityState&gt;(m_webPageProxy.pageID(), activityStateUpdateTimeout, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">     // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
</span><span class="cx">     if (_state == ImmediateActionState::Pending) {
</span><span class="cx">         if (auto* connection = _page-&gt;process().connection()) {
</span><del>-            bool receivedReply = connection-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DidPerformImmediateActionHitTest&gt;(_page-&gt;pageID(), std::chrono::milliseconds(500));
</del><ins>+            bool receivedReply = connection-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DidPerformImmediateActionHitTest&gt;(_page-&gt;pageID(), Seconds::fromMilliseconds(500));
</ins><span class="cx">             if (!receivedReply)
</span><span class="cx">                 _state = ImmediateActionState::TimedOut;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2011, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return value;
</span><span class="cx">     
</span><del>-    const auto messageTimeout = std::chrono::seconds(20);
</del><ins>+    const Seconds messageTimeout(20);
</ins><span class="cx">     process().sendSync(Messages::WebPage::GetStringSelectionForPasteboard(), Messages::WebPage::GetStringSelectionForPasteboard::Reply(value), m_pageID, messageTimeout);
</span><span class="cx">     return value;
</span><span class="cx"> }
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     SharedMemory::Handle handle;
</span><span class="cx">     uint64_t size = 0;
</span><del>-    const auto messageTimeout = std::chrono::seconds(20);
</del><ins>+    const Seconds messageTimeout(20);
</ins><span class="cx">     process().sendSync(Messages::WebPage::GetDataSelectionForPasteboard(pasteboardType),
</span><span class="cx">                                                 Messages::WebPage::GetDataSelectionForPasteboard::Reply(handle, size), m_pageID, messageTimeout);
</span><span class="cx">     if (handle.isNull())
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><del>-    const auto messageTimeout = std::chrono::seconds(20);
</del><ins>+    const Seconds messageTimeout(20);
</ins><span class="cx">     process().sendSync(Messages::WebPage::ReadSelectionFromPasteboard(pasteboardName), Messages::WebPage::ReadSelectionFromPasteboard::Reply(result), m_pageID, messageTimeout);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -409,7 +409,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><del>-    const auto messageTimeout = std::chrono::seconds(3);
</del><ins>+    const Seconds messageTimeout(3);
</ins><span class="cx">     process().sendSync(Messages::WebPage::ShouldDelayWindowOrderingEvent(event), Messages::WebPage::ShouldDelayWindowOrderingEvent::Reply(result), m_pageID, messageTimeout);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -420,7 +420,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><del>-    const auto messageTimeout = std::chrono::seconds(3);
</del><ins>+    const Seconds messageTimeout(3);
</ins><span class="cx">     process().sendSync(Messages::WebPage::AcceptsFirstMouse(eventNumber, event), Messages::WebPage::AcceptsFirstMouse::Reply(result), m_pageID, messageTimeout);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -354,7 +354,7 @@
</span><span class="cx"> 
</span><span class="cx">     HangDetectionDisabler hangDetectionDisabler;
</span><span class="cx"> 
</span><del>-    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame-&gt;frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</del><ins>+    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame-&gt;frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return shouldClose;
</span><span class="lines">@@ -400,7 +400,7 @@
</span><span class="cx"> 
</span><span class="cx">     HangDetectionDisabler hangDetectionDisabler;
</span><span class="cx"> 
</span><del>-    WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</del><ins>+    WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String&amp; message)
</span><span class="lines">@@ -417,7 +417,7 @@
</span><span class="cx">     HangDetectionDisabler hangDetectionDisabler;
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><del>-    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</del><ins>+    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx"> 
</span><span class="cx">     HangDetectionDisabler hangDetectionDisabler;
</span><span class="cx"> 
</span><del>-    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</del><ins>+    if (!WebProcess::singleton().parentProcessConnection()-&gt;sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame-&gt;frameID(), SecurityOriginData::fromFrame(frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return !result.isNull();
</span><span class="lines">@@ -668,7 +668,7 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    m_page-&gt;sendSync(Messages::WebPageProxy::PrintFrame(webFrame-&gt;frameID()), Messages::WebPageProxy::PrintFrame::Reply(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</del><ins>+    m_page-&gt;sendSync(Messages::WebPageProxy::PrintFrame(webFrame-&gt;frameID()), Messages::WebPageProxy::PrintFrame::Reply(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String&amp; databaseName, DatabaseDetails details)
</span><span class="lines">@@ -688,7 +688,7 @@
</span><span class="cx">     if (!newQuota) {
</span><span class="cx">         WebProcess::singleton().parentProcessConnection()-&gt;sendSync(
</span><span class="cx">             Messages::WebPageProxy::ExceededDatabaseQuota(webFrame-&gt;frameID(), origin-&gt;databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()),
</span><del>-            Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</del><ins>+            Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     dbManager.setQuota(origin, newQuota);
</span><span class="lines">@@ -713,7 +713,7 @@
</span><span class="cx">     uint64_t newQuota = 0;
</span><span class="cx">     WebProcess::singleton().parentProcessConnection()-&gt;sendSync(
</span><span class="cx">         Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(origin-&gt;databaseIdentifier(), currentQuota, totalBytesNeeded),
</span><del>-        Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::Reply(newQuota), m_page-&gt;pageID(), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</del><ins>+        Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::Reply(newQuota), m_page-&gt;pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
</ins><span class="cx"> 
</span><span class="cx">     cacheStorage.storeUpdatedQuotaForOrigin(origin, newQuota);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -690,7 +690,7 @@
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;WebFrame&gt; protect(*m_frame);
</span><span class="cx">     WebCore::Frame* coreFrame = m_frame-&gt;coreFrame();
</span><del>-    if (!webPage-&gt;sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame-&gt;frameID(), SecurityOriginData::fromFrame(coreFrame), response, request, canShowMIMEType, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), std::chrono::milliseconds::max(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) {
</del><ins>+    if (!webPage-&gt;sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame-&gt;frameID(), SecurityOriginData::fromFrame(coreFrame), response, request, canShowMIMEType, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) {
</ins><span class="cx">         m_frame-&gt;didReceivePolicyDecision(listenerID, PolicyIgnore, 0, { });
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,4 +1,3 @@
</span><del>-
</del><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2012 Intel Corporation. All rights reserved.
</span><span class="lines">@@ -5548,7 +5547,7 @@
</span><span class="cx">     UserData returnUserData;
</span><span class="cx"> 
</span><span class="cx">     auto&amp; webProcess = WebProcess::singleton();
</span><del>-    if (!sendSync(Messages::WebPageProxy::HandleSynchronousMessage(messageName, UserData(webProcess.transformObjectsToHandles(messageBody))), Messages::WebPageProxy::HandleSynchronousMessage::Reply(returnUserData), std::chrono::milliseconds::max(), IPC::SendSyncOption::UseFullySynchronousModeForTesting))
</del><ins>+    if (!sendSync(Messages::WebPageProxy::HandleSynchronousMessage(messageName, UserData(webProcess.transformObjectsToHandles(messageBody))), Messages::WebPageProxy::HandleSynchronousMessage::Reply(returnUserData), Seconds::infinity(), IPC::SendSyncOption::UseFullySynchronousModeForTesting))
</ins><span class="cx">         returnData = nullptr;
</span><span class="cx">     else
</span><span class="cx">         returnData = webProcess.transformHandlesToObjects(returnUserData.object());
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Tools/ChangeLog        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-11-04  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
+        https://bugs.webkit.org/show_bug.cgi?id=152045
+
+        Reviewed by Andy Estes.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/Condition.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
+        (TestWebKitAPI::ToUpperConverter::stopProducing):
+        (TestWebKitAPI::ToUpperConverter::stopConsuming):
+        * TestWebKitAPI/Tests/WTF/Time.cpp: Added.
+        (WTF::operator&lt;&lt;):
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-11-04  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r208293.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPICMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/CMakeLists.txt        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Time.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueRef.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/Variant.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">                 0F139E771A423A5B00F590F5 /* WeakObjCPtr.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */; };
</span><span class="cx">                 0F139E781A423A6B00F590F5 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
</span><span class="cx">                 0F139E791A42457000F590F5 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
</span><ins>+                0F2C20B81DCD545000542D9E /* Time.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F2C20B71DCD544800542D9E /* Time.cpp */; };
</ins><span class="cx">                 0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */; };
</span><span class="cx">                 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
</span><span class="cx">                 1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3524AC1D63A4FB0031729B /* Scope.cpp */; };
</span><span class="lines">@@ -722,6 +723,7 @@
</span><span class="cx">                 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformUtilitiesCocoa.mm; path = cocoa/PlatformUtilitiesCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WeakObjCPtr.mm; path = cocoa/WeakObjCPtr.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F17BBD415AF6C4D007AB753 /* WebCoreStatisticsWithNoWebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreStatisticsWithNoWebProcess.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0F2C20B71DCD544800542D9E /* Time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Time.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEvaluateJavaScript.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RedBlackTree.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MetaAllocator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1825,6 +1827,7 @@
</span><span class="cx">                                 7C74D42D188228F300E5ED57 /* StringView.cpp */,
</span><span class="cx">                                 5597F8341D9596C80066BC21 /* SynchronizedFixedQueue.cpp */,
</span><span class="cx">                                 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */,
</span><ins>+                                0F2C20B71DCD544800542D9E /* Time.cpp */,
</ins><span class="cx">                                 5C5E633D1D0B67940085A025 /* UniqueRef.cpp */,
</span><span class="cx">                                 7CD0D5AA1D5534DE000CC9E1 /* Variant.cpp */,
</span><span class="cx">                                 BC55F5F814AD78EE00484BE1 /* Vector.cpp */,
</span><span class="lines">@@ -2287,6 +2290,7 @@
</span><span class="cx">                                 7C83DEA01D0A590C00FEBCF3 /* CheckedArithmeticOperations.cpp in Sources */,
</span><span class="cx">                                 1A77BAA31D9AFFFC005FC568 /* OptionSet.cpp in Sources */,
</span><span class="cx">                                 7C83DEC31D0A590C00FEBCF3 /* Condition.cpp in Sources */,
</span><ins>+                                0F2C20B81DCD545000542D9E /* Time.cpp in Sources */,
</ins><span class="cx">                                 1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */,
</span><span class="cx">                                 7C83DEA61D0A590C00FEBCF3 /* Counters.cpp in Sources */,
</span><span class="cx">                                 7C83DEA91D0A590C00FEBCF3 /* CString.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFConditioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename Functor&gt;
</span><del>-void wait(Condition&amp; condition, std::unique_lock&lt;Lock&gt;&amp; locker, const Functor&amp; predicate, std::chrono::microseconds timeout)
</del><ins>+void wait(Condition&amp; condition, std::unique_lock&lt;Lock&gt;&amp; locker, const Functor&amp; predicate, Seconds timeout)
</ins><span class="cx"> {
</span><del>-    if (timeout == std::chrono::microseconds::max())
</del><ins>+    if (timeout == Seconds::infinity())
</ins><span class="cx">         condition.wait(locker, predicate);
</span><span class="cx">     else {
</span><span class="cx">         // This tests timeouts in the sense that it verifies that we can call wait() again after a
</span><span class="lines">@@ -80,8 +80,8 @@
</span><span class="cx">     unsigned maxQueueSize,
</span><span class="cx">     unsigned numMessagesPerProducer,
</span><span class="cx">     NotifyStyle notifyStyle,
</span><del>-    std::chrono::microseconds timeout = std::chrono::microseconds::max(),
-    std::chrono::microseconds delay = std::chrono::microseconds::zero())
</del><ins>+    Seconds timeout = Seconds::infinity(),
+    Seconds delay = Seconds(0))
</ins><span class="cx"> {
</span><span class="cx">     Deque&lt;unsigned&gt; queue;
</span><span class="cx">     bool shouldContinue = true;
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">         consumerThreads.append(threadIdentifier);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    std::this_thread::sleep_for(delay);
</del><ins>+    sleep(delay);
</ins><span class="cx"> 
</span><span class="cx">     for (unsigned i = numProducers; i--;) {
</span><span class="cx">         ThreadIdentifier threadIdentifier = createThread(
</span><span class="lines">@@ -186,8 +186,8 @@
</span><span class="cx"> {
</span><span class="cx">     runTest(
</span><span class="cx">         1, 1, 1, 100000, TacticallyNotifyAll,
</span><del>-        std::chrono::microseconds(10000),
-        std::chrono::microseconds(1000000));
</del><ins>+        Seconds::fromMilliseconds(10),
+        Seconds(1));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST(WTF_Condition, OneProducerOneConsumerHundredSlots)
</span><span class="lines">@@ -247,7 +247,7 @@
</span><span class="cx"> 
</span><span class="cx">     lock.lock();
</span><span class="cx">     bool result = condition.waitFor(
</span><del>-        lock, std::chrono::microseconds(10000), [] () -&gt; bool { return false; });
</del><ins>+        lock, Seconds::fromMilliseconds(10), [] () -&gt; bool { return false; });
</ins><span class="cx">     lock.unlock();
</span><span class="cx"> 
</span><span class="cx">     EXPECT_FALSE(result);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFSynchronizedFixedQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp (208414 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp        2016-11-05 02:57:38 UTC (rev 208414)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -116,7 +116,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         m_lowerQueue.close();
</span><del>-        m_produceCloseSemaphore.wait(std::numeric_limits&lt;double&gt;::max());
</del><ins>+        m_produceCloseSemaphore.wait(WallTime::infinity());
</ins><span class="cx">         m_produceQueue = nullptr;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         m_upperQueue.close();
</span><del>-        m_consumeCloseSemaphore.wait(std::numeric_limits&lt;double&gt;::max());
</del><ins>+        m_consumeCloseSemaphore.wait(WallTime::infinity());
</ins><span class="cx">         m_consumeQueue = nullptr;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFTimecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp (0 => 208415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Time.cpp        2016-11-05 03:02:39 UTC (rev 208415)
</span><span class="lines">@@ -0,0 +1,283 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include &quot;config.h&quot;
+#include &lt;wtf/ClockType.h&gt;
+#include &lt;wtf/MonotonicTime.h&gt;
+#include &lt;wtf/Seconds.h&gt;
+#include &lt;wtf/StringPrintStream.h&gt;
+#include &lt;wtf/TimeWithDynamicClockType.h&gt;
+#include &lt;wtf/WallTime.h&gt;
+
+namespace WTF {
+
+std::basic_ostream&lt;char&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;char&gt;&amp; out, Seconds value)
+{
+    out &lt;&lt; toCString(value).data();
+    return out;
+}
+
+std::basic_ostream&lt;char&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;char&gt;&amp; out, WallTime value)
+{
+    out &lt;&lt; toCString(value).data();
+    return out;
+}
+
+std::basic_ostream&lt;char&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;char&gt;&amp; out, MonotonicTime value)
+{
+    out &lt;&lt; toCString(value).data();
+    return out;
+}
+
+std::basic_ostream&lt;char&gt;&amp; operator&lt;&lt;(std::basic_ostream&lt;char&gt;&amp; out, TimeWithDynamicClockType value)
+{
+    out &lt;&lt; toCString(value).data();
+    return out;
+}
+
+} // namespace WTF
+
+using namespace WTF;
+
+namespace TestWebKitAPI {
+
+namespace {
+
+Seconds s(double value)
+{
+    return Seconds(value);
+}
+
+WallTime wt(double value)
+{
+    return WallTime::fromRawSeconds(value);
+}
+
+MonotonicTime mt(double value)
+{
+    return MonotonicTime::fromRawSeconds(value);
+}
+
+TimeWithDynamicClockType dt(double value, ClockType type)
+{
+    return TimeWithDynamicClockType::fromRawSeconds(value, type);
+}
+
+TimeWithDynamicClockType dtw(double value)
+{
+    return dt(value, ClockType::Wall);
+}
+
+TimeWithDynamicClockType dtm(double value)
+{
+    return dt(value, ClockType::Monotonic);
+}
+
+} // anonymous namespace
+
+TEST(WTF_Time, plus)
+{
+    EXPECT_EQ(s(6), s(1) + s(5));
+    EXPECT_EQ(s(6), s(5) + s(1));
+    EXPECT_EQ(wt(6), s(1) + wt(5));
+    EXPECT_EQ(wt(6), s(5) + wt(1));
+    EXPECT_EQ(wt(6), wt(1) + s(5));
+    EXPECT_EQ(wt(6), wt(5) + s(1));
+    EXPECT_EQ(mt(6), s(1) + mt(5));
+    EXPECT_EQ(mt(6), s(5) + mt(1));
+    EXPECT_EQ(mt(6), mt(1) + s(5));
+    EXPECT_EQ(mt(6), mt(5) + s(1));
+    EXPECT_EQ(dtw(6), s(1) + dtw(5));
+    EXPECT_EQ(dtw(6), s(5) + dtw(1));
+    EXPECT_EQ(dtw(6), dtw(1) + s(5));
+    EXPECT_EQ(dtw(6), dtw(5) + s(1));
+    EXPECT_EQ(dtm(6), s(1) + dtm(5));
+    EXPECT_EQ(dtm(6), s(5) + dtm(1));
+    EXPECT_EQ(dtm(6), dtm(1) + s(5));
+    EXPECT_EQ(dtm(6), dtm(5) + s(1));
+}
+
+TEST(WTF_Time, minus)
+{
+    EXPECT_EQ(s(-4), s(1) - s(5));
+    EXPECT_EQ(s(4), s(5) - s(1));
+    EXPECT_EQ(wt(-4), s(1) - wt(5));
+    EXPECT_EQ(wt(4), s(5) - wt(1));
+    EXPECT_EQ(wt(-4), wt(1) - s(5));
+    EXPECT_EQ(wt(4), wt(5) - s(1));
+    EXPECT_EQ(mt(-4), s(1) - mt(5));
+    EXPECT_EQ(mt(4), s(5) - mt(1));
+    EXPECT_EQ(mt(-4), mt(1) - s(5));
+    EXPECT_EQ(mt(4), mt(5) - s(1));
+    EXPECT_EQ(dtw(-4), s(1) - dtw(5));
+    EXPECT_EQ(dtw(4), s(5) - dtw(1));
+    EXPECT_EQ(dtw(-4), dtw(1) - s(5));
+    EXPECT_EQ(dtw(4), dtw(5) - s(1));
+    EXPECT_EQ(dtm(-4), s(1) - dtm(5));
+    EXPECT_EQ(dtm(4), s(5) - dtm(1));
+    EXPECT_EQ(dtm(-4), dtm(1) - s(5));
+    EXPECT_EQ(dtm(4), dtm(5) - s(1));
+}
+
+TEST(WTF_Time, negate)
+{
+    EXPECT_EQ(s(-7), -s(7));
+    EXPECT_EQ(s(7), -s(-7));
+    EXPECT_EQ(wt(-7), -wt(7));
+    EXPECT_EQ(wt(7), -wt(-7));
+    EXPECT_EQ(mt(-7), -mt(7));
+    EXPECT_EQ(mt(7), -mt(-7));
+    EXPECT_EQ(dtw(-7), -dtw(7));
+    EXPECT_EQ(dtw(7), -dtw(-7));
+    EXPECT_EQ(dtm(-7), -dtm(7));
+    EXPECT_EQ(dtm(7), -dtm(-7));
+}
+
+TEST(WTF_Time, times)
+{
+    EXPECT_EQ(s(15), s(3) * 5);
+}
+
+TEST(WTF_Time, divide)
+{
+    EXPECT_EQ(s(3), s(15) / 5);
+}
+
+TEST(WTF_Time, less)
+{
+    EXPECT_EQ(false, s(2) &lt; s(1));
+    EXPECT_EQ(false, s(2) &lt; s(2));
+    EXPECT_EQ(true, s(2) &lt; s(3));
+    EXPECT_EQ(false, wt(2) &lt; wt(1));
+    EXPECT_EQ(false, wt(2) &lt; wt(2));
+    EXPECT_EQ(true, wt(2) &lt; wt(3));
+    EXPECT_EQ(false, mt(2) &lt; mt(1));
+    EXPECT_EQ(false, mt(2) &lt; mt(2));
+    EXPECT_EQ(true, mt(2) &lt; mt(3));
+    EXPECT_EQ(false, dtw(2) &lt; dtw(1));
+    EXPECT_EQ(false, dtw(2) &lt; dtw(2));
+    EXPECT_EQ(true, dtw(2) &lt; dtw(3));
+    EXPECT_EQ(false, dtm(2) &lt; dtm(1));
+    EXPECT_EQ(false, dtm(2) &lt; dtm(2));
+    EXPECT_EQ(true, dtm(2) &lt; dtm(3));
+}
+
+TEST(WTF_Time, lessEqual)
+{
+    EXPECT_EQ(false, s(2) &lt;= s(1));
+    EXPECT_EQ(true, s(2) &lt;= s(2));
+    EXPECT_EQ(true, s(2) &lt;= s(3));
+    EXPECT_EQ(false, wt(2) &lt;= wt(1));
+    EXPECT_EQ(true, wt(2) &lt;= wt(2));
+    EXPECT_EQ(true, wt(2) &lt;= wt(3));
+    EXPECT_EQ(false, mt(2) &lt;= mt(1));
+    EXPECT_EQ(true, mt(2) &lt;= mt(2));
+    EXPECT_EQ(true, mt(2) &lt;= mt(3));
+    EXPECT_EQ(false, dtw(2) &lt;= dtw(1));
+    EXPECT_EQ(true, dtw(2) &lt;= dtw(2));
+    EXPECT_EQ(true, dtw(2) &lt;= dtw(3));
+    EXPECT_EQ(false, dtm(2) &lt;= dtm(1));
+    EXPECT_EQ(true, dtm(2) &lt;= dtm(2));
+    EXPECT_EQ(true, dtm(2) &lt;= dtm(3));
+}
+
+TEST(WTF_Time, greater)
+{
+    EXPECT_EQ(true, s(2) &gt; s(1));
+    EXPECT_EQ(false, s(2) &gt; s(2));
+    EXPECT_EQ(false, s(2) &gt; s(3));
+    EXPECT_EQ(true, wt(2) &gt; wt(1));
+    EXPECT_EQ(false, wt(2) &gt; wt(2));
+    EXPECT_EQ(false, wt(2) &gt; wt(3));
+    EXPECT_EQ(true, mt(2) &gt; mt(1));
+    EXPECT_EQ(false, mt(2) &gt; mt(2));
+    EXPECT_EQ(false, mt(2) &gt; mt(3));
+    EXPECT_EQ(true, dtw(2) &gt; dtw(1));
+    EXPECT_EQ(false, dtw(2) &gt; dtw(2));
+    EXPECT_EQ(false, dtw(2) &gt; dtw(3));
+    EXPECT_EQ(true, dtm(2) &gt; dtm(1));
+    EXPECT_EQ(false, dtm(2) &gt; dtm(2));
+    EXPECT_EQ(false, dtm(2) &gt; dtm(3));
+}
+
+TEST(WTF_Time, greaterEqual)
+{
+    EXPECT_EQ(true, s(2) &gt;= s(1));
+    EXPECT_EQ(true, s(2) &gt;= s(2));
+    EXPECT_EQ(false, s(2) &gt;= s(3));
+    EXPECT_EQ(true, wt(2) &gt;= wt(1));
+    EXPECT_EQ(true, wt(2) &gt;= wt(2));
+    EXPECT_EQ(false, wt(2) &gt;= wt(3));
+    EXPECT_EQ(true, mt(2) &gt;= mt(1));
+    EXPECT_EQ(true, mt(2) &gt;= mt(2));
+    EXPECT_EQ(false, mt(2) &gt;= mt(3));
+    EXPECT_EQ(true, dtw(2) &gt;= dtw(1));
+    EXPECT_EQ(true, dtw(2) &gt;= dtw(2));
+    EXPECT_EQ(false, dtw(2) &gt;= dtw(3));
+    EXPECT_EQ(true, dtm(2) &gt;= dtm(1));
+    EXPECT_EQ(true, dtm(2) &gt;= dtm(2));
+    EXPECT_EQ(false, dtm(2) &gt;= dtm(3));
+}
+
+TEST(WTF_Time, equal)
+{
+    EXPECT_EQ(false, s(2) == s(1));
+    EXPECT_EQ(true, s(2) == s(2));
+    EXPECT_EQ(false, s(2) == s(3));
+    EXPECT_EQ(false, wt(2) == wt(1));
+    EXPECT_EQ(true, wt(2) == wt(2));
+    EXPECT_EQ(false, wt(2) == wt(3));
+    EXPECT_EQ(false, mt(2) == mt(1));
+    EXPECT_EQ(true, mt(2) == mt(2));
+    EXPECT_EQ(false, mt(2) == mt(3));
+    EXPECT_EQ(false, dtw(2) == dtw(1));
+    EXPECT_EQ(true, dtw(2) == dtw(2));
+    EXPECT_EQ(false, dtw(2) == dtw(3));
+    EXPECT_EQ(false, dtm(2) == dtm(1));
+    EXPECT_EQ(true, dtm(2) == dtm(2));
+    EXPECT_EQ(false, dtm(2) == dtm(3));
+}
+
+TEST(WTF_Time, notEqual)
+{
+    EXPECT_EQ(true, s(2) != s(1));
+    EXPECT_EQ(false, s(2) != s(2));
+    EXPECT_EQ(true, s(2) != s(3));
+    EXPECT_EQ(true, wt(2) != wt(1));
+    EXPECT_EQ(false, wt(2) != wt(2));
+    EXPECT_EQ(true, wt(2) != wt(3));
+    EXPECT_EQ(true, mt(2) != mt(1));
+    EXPECT_EQ(false, mt(2) != mt(2));
+    EXPECT_EQ(true, mt(2) != mt(3));
+    EXPECT_EQ(true, dtw(2) != dtw(1));
+    EXPECT_EQ(false, dtw(2) != dtw(2));
+    EXPECT_EQ(true, dtw(2) != dtw(3));
+    EXPECT_EQ(true, dtm(2) != dtm(1));
+    EXPECT_EQ(false, dtm(2) != dtm(2));
+    EXPECT_EQ(true, dtm(2) != dtm(3));
+}
+
+} // namespace TestWebKitAPI
+
</ins></span></pre>
</div>
</div>

</body>
</html>