Remove currentTime() / currentTimeMS()
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Feb 2018 04:18:17 +0000 (04:18 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Feb 2018 04:18:17 +0000 (04:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183052

Reviewed by Mark Lam.

Source/WebCore:

* Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::haveSuitableCachedPosition):
* dom/DOMTimeStamp.h:
(WebCore::convertSecondsToDOMTimeStamp):
* fileapi/File.cpp:
(WebCore::File::File):
(WebCore::File::lastModified const):
* history/HistoryItem.cpp:
(WebCore::generateSequenceNumber):
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const):
* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::defaultValueForStepUp const):
* html/MonthInputType.cpp:
(WebCore::MonthInputType::defaultValueForStepUp const):
* html/TimeInputType.cpp:
(WebCore::TimeInputType::defaultValueForStepUp const):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendRequest):
(WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
* loader/EmptyFrameLoaderClient.h:
* loader/FormSubmission.cpp:
(WebCore::generateFormDataIdentifier):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::clientRedirected):
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* loader/NavigationScheduler.cpp:
* page/History.cpp:
(WebCore::History::stateObjectAdded):
* page/History.h:
* page/PageOverlay.cpp:
(WebCore::PageOverlay::startFadeAnimation):
(WebCore::PageOverlay::fadeAnimationTimerFired):
* page/PageOverlay.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawNativeImage):
* platform/ios/LegacyTileLayerPool.h:
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::LegacyTileLayerPool):
(WebCore::LegacyTileLayerPool::addLayer):
(WebCore::LegacyTileLayerPool::decayedCapacity const):
(WebCore::LegacyTileLayerPool::prune):
* platform/ios/SystemMemoryIOS.cpp:
(WebCore::systemMemoryLevel):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
* platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngineCache.cpp:
* PluginProcess/WebProcessConnection.cpp:
* Shared/WebProcessCreationParameters.h:
* Shared/linux/WebMemorySamplerLinux.cpp:
(WebKit::WebMemorySampler::sampleWebKit const):
* Shared/mac/WebMemorySampler.mac.mm:
(WebKit::WebMemorySampler::sampleWebKit const):
* UIProcess/API/C/WKContext.cpp:
(WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::setIconDataForIconURL):
(WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
(WebKit::IconDatabase::performURLImport):
* UIProcess/DrawingAreaProxyImpl.cpp:
* UIProcess/Plugins/PlugInAutoStartProvider.cpp:
(WebKit::expirationTimeFromNow):
(WebKit::PlugInAutoStartProvider::addAutoStartOriginHash):
(WebKit::PlugInAutoStartProvider::autoStartOriginsTableCopy const):
(WebKit::PlugInAutoStartProvider::setAutoStartOriginsTable):
(WebKit::PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime):
(WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest):
(WebKit::PlugInAutoStartProvider::didReceiveUserInteraction):
* UIProcess/Plugins/PlugInAutoStartProvider.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processDidFinishLaunching):
(WebKit::WebProcessPool::startMemorySampler):
(WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
* UIProcess/WebProcessPool.h:
* WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
(API::InjectedBundle::PageLoaderClient::willPerformClientRedirectForFrame):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebProcess.cpp:
(WebKit::m_webSQLiteDatabaseTracker):
(WebKit::WebProcess::isPlugInAutoStartOriginHash):
(WebKit::WebProcess::plugInDidStartFromOrigin):
(WebKit::WebProcess::didAddPlugInAutoStartOriginHash):
(WebKit::WebProcess::resetPlugInAutoStartOriginDefaultHashes):
(WebKit::WebProcess::resetPlugInAutoStartOriginHashes):
(WebKit::WebProcess::plugInDidReceiveUserInteraction):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
* WebProcess/wpe/WebProcessMainWPE.cpp:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchWillPerformClientRedirect):

Source/WebKitLegacy/win:

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchWillPerformClientRedirect):
* WebCoreSupport/WebFrameLoaderClient.h:
* WebDownload.h:
* WebDownloadCFNet.cpp:
(WebDownload::didStart):
(WebDownload::didReceiveData):
(WebDownload::didFinish):

Source/WTF:

This patch removes WTF::currentTime() and WTF::currentTimeMS().
We have fancy WallTime APIs. It has strong types like WallTime and Seconds,
and this reduces the chance of bugs mixing doubles which represent milliseconds
and seconds.

* wtf/Condition.h:
* wtf/CurrentTime.cpp:
(WTF::currentTime):
(WTF::WallTime::now):
* wtf/CurrentTime.h:
(WTF::currentTimeMS): Deleted.
* wtf/DateMath.h:
(WTF::jsCurrentTime):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingWin.cpp:
(WTF::ThreadCondition::timedWait):
(WTF::absoluteTimeToWaitTimeoutInterval):
* wtf/WallTime.cpp:
(WTF::WallTime::now): Deleted.
* wtf/WallTime.h:

Tools:

* DumpRenderTree/TestRunner.cpp:
(preciseTimeCallback):
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setMockGeolocationPosition):
* TestWebKitAPI/Tests/WTF/Condition.cpp:
* TestWebKitAPI/Tests/WTF/ThreadGroup.cpp:
* TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::setPosition):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::preciseTime):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

76 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Condition.h
Source/WTF/wtf/CurrentTime.cpp
Source/WTF/wtf/CurrentTime.h
Source/WTF/wtf/DateMath.h
Source/WTF/wtf/ParkingLot.cpp
Source/WTF/wtf/ThreadingPrimitives.h
Source/WTF/wtf/ThreadingPthreads.cpp
Source/WTF/wtf/ThreadingWin.cpp
Source/WTF/wtf/WallTime.cpp
Source/WTF/wtf/WallTime.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/geolocation/Geolocation.cpp
Source/WebCore/dom/DOMTimeStamp.h
Source/WebCore/fileapi/File.cpp
Source/WebCore/history/HistoryItem.cpp
Source/WebCore/html/BaseDateAndTimeInputType.cpp
Source/WebCore/html/DateTimeInputType.cpp
Source/WebCore/html/MonthInputType.cpp
Source/WebCore/html/TimeInputType.cpp
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
Source/WebCore/loader/EmptyFrameLoaderClient.h
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/loader/NavigationScheduler.cpp
Source/WebCore/page/History.cpp
Source/WebCore/page/History.h
Source/WebCore/page/PageOverlay.cpp
Source/WebCore/page/PageOverlay.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/ios/LegacyTileLayerPool.h
Source/WebCore/platform/ios/LegacyTileLayerPool.mm
Source/WebCore/platform/ios/SystemMemoryIOS.cpp
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp
Source/WebKit/PluginProcess/WebProcessConnection.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/Shared/linux/WebMemorySamplerLinux.cpp
Source/WebKit/Shared/mac/WebMemorySampler.mac.mm
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/glib/IconDatabase.cpp
Source/WebKit/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit/UIProcess/Plugins/PlugInAutoStartProvider.cpp
Source/WebKit/UIProcess/Plugins/PlugInAutoStartProvider.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKitLegacy/win/WebDownload.h
Source/WebKitLegacy/win/WebDownloadCFNet.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/TestWebKitAPI/Tests/WTF/Condition.cpp
Tools/TestWebKitAPI/Tests/WTF/ThreadGroup.cpp
Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp
Tools/WebKitTestRunner/GeolocationProviderMock.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

index 4d49db4..2ce2f5d 100644 (file)
@@ -1,5 +1,37 @@
 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        This patch removes WTF::currentTime() and WTF::currentTimeMS().
+        We have fancy WallTime APIs. It has strong types like WallTime and Seconds,
+        and this reduces the chance of bugs mixing doubles which represent milliseconds
+        and seconds.
+
+        * wtf/Condition.h:
+        * wtf/CurrentTime.cpp:
+        (WTF::currentTime):
+        (WTF::WallTime::now):
+        * wtf/CurrentTime.h:
+        (WTF::currentTimeMS): Deleted.
+        * wtf/DateMath.h:
+        (WTF::jsCurrentTime):
+        * wtf/ParkingLot.cpp:
+        (WTF::ParkingLot::parkConditionallyImpl):
+        * wtf/ThreadingPrimitives.h:
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::ThreadCondition::timedWait):
+        * wtf/ThreadingWin.cpp:
+        (WTF::ThreadCondition::timedWait):
+        (WTF::absoluteTimeToWaitTimeoutInterval):
+        * wtf/WallTime.cpp:
+        (WTF::WallTime::now): Deleted.
+        * wtf/WallTime.h:
+
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         Remove sleep(double) and sleepMS(double) interfaces
         https://bugs.webkit.org/show_bug.cgi?id=183038
 
index f533689..512f10f 100644 (file)
@@ -26,7 +26,6 @@
 #ifndef WTF_Condition_h
 #define WTF_Condition_h
 
-#include <wtf/CurrentTime.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/ParkingLot.h>
 #include <wtf/TimeWithDynamicClockType.h>
@@ -36,11 +35,11 @@ namespace WTF {
 // This is a condition variable that is suitable for use with any lock-like object, including
 // our own WTF::Lock. It features standard wait()/notifyOne()/notifyAll() methods in addition to
 // a variety of wait-with-timeout methods. This includes methods that use WTF's own notion of
-// time, like wall-clock time (i.e. currentTime()) and monotonic time (i.e.
-// monotonicallyIncreasingTime()). This is a very efficient condition variable. It only requires
-// one byte of memory. notifyOne() and notifyAll() require just a load and branch for the fast
-// case where no thread is waiting. This condition variable, when used with WTF::Lock, can
-// outperform a system condition variable and lock by up to 58x.
+// time, like wall-clock time (i.e. WallTime) and monotonic time (i.e. MonotonicTime). This is
+// a very efficient condition variable. It only requires one byte of memory. notifyOne() and
+// notifyAll() require just a load and branch for the fast case where no thread is waiting.
+// This condition variable, when used with WTF::Lock, can outperform a system condition variable
+// and lock by up to 58x.
 class Condition {
     WTF_MAKE_NONCOPYABLE(Condition);
 public:
index b898cbd..8abc2ff 100644 (file)
@@ -34,6 +34,7 @@
 #include "config.h"
 #include "CurrentTime.h"
 #include "MonotonicTime.h"
+#include "WallTime.h"
 
 #include "Condition.h"
 #include "Lock.h"
@@ -151,7 +152,7 @@ static bool qpcAvailable()
     return available;
 }
 
-double currentTime()
+static inline double currentTime()
 {
     // Use a combination of ftime and QueryPerformanceCounter.
     // ftime returns the information we want, but doesn't have sufficient resolution.
@@ -196,7 +197,7 @@ double currentTime()
 
 #else
 
-double currentTime()
+static inline double currentTime()
 {
     static bool init = false;
     static double lastTime;
@@ -226,7 +227,7 @@ double currentTime()
 // better accuracy compared with Windows implementation of g_get_current_time:
 // (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time).
 // Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function.
-double currentTime()
+static inline double currentTime()
 {
     GTimeVal now;
     g_get_current_time(&now);
@@ -235,7 +236,7 @@ double currentTime()
 
 #else
 
-double currentTime()
+static inline double currentTime()
 {
     struct timeval now;
     gettimeofday(&now, 0);
@@ -244,6 +245,11 @@ double currentTime()
 
 #endif
 
+WallTime WallTime::now()
+{
+    return fromRawSeconds(currentTime());
+}
+
 #if USE(GLIB)
 
 double monotonicallyIncreasingTime()
index aeea70f..b3e6c14 100644 (file)
 
 namespace WTF {
 
-// Returns the current UTC time in seconds, counted from January 1, 1970.
-// Precision varies depending on platform but is usually as good or better
-// than a millisecond.
-// Use this function only if wall clock time is needed. For elapsed time
-// measurement use monotonicallyIncreasingTime() instead.
-WTF_EXPORT_PRIVATE double currentTime();
-
-// Same thing, in milliseconds.
-inline double currentTimeMS()
-{
-    return currentTime() * 1000.0;
-}
-
 // Provides a monotonically increasing time in seconds since an arbitrary point in the past.
 // On unsupported platforms, this function only guarantees the result will be non-decreasing.
 // Result of this function increases monotonically even when clock time goes back due to
@@ -71,8 +58,6 @@ WTF_EXPORT_PRIVATE void sleep(Seconds);
 } // namespace WTF
 
 using WTF::currentCPUTime;
-using WTF::currentTime;
-using WTF::currentTimeMS;
 using WTF::monotonicallyIncreasingTime;
 using WTF::monotonicallyIncreasingTimeMS;
 using WTF::sleep;
index affb558..3e29166 100644 (file)
@@ -47,7 +47,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <time.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WTF {
@@ -98,7 +98,7 @@ String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u
 inline double jsCurrentTime()
 {
     // JavaScript doesn't recognize fractions of a millisecond.
-    return floor(WTF::currentTimeMS());
+    return floor(WallTime::now().secondsSinceEpoch().milliseconds());
 }
 
 const char* const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
index b14d7a2..8a5ec8d 100644 (file)
@@ -595,7 +595,7 @@ NEVER_INLINE ParkingLot::ParkResult ParkingLot::parkConditionallyImpl(
         MutexLocker locker(me->parkingLock);
         while (me->address && timeout.nowWithSameClock() < timeout) {
             me->parkingCondition.timedWait(
-                me->parkingLock, timeout.approximateWallTime().secondsSinceEpoch().value());
+                me->parkingLock, timeout.approximateWallTime());
             
             // 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
index 4ace28f..28f479b 100644 (file)
@@ -34,6 +34,7 @@
 #include <wtf/FastMalloc.h>
 #include <wtf/Locker.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/WallTime.h>
 
 #if OS(WINDOWS)
 #include <windows.h>
@@ -100,8 +101,7 @@ public:
     
     WTF_EXPORT_PRIVATE void wait(Mutex& mutex);
     // Returns true if the condition was signaled before absoluteTime, false if the absoluteTime was reached or is in the past.
-    // The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
-    WTF_EXPORT_PRIVATE bool timedWait(Mutex&, double absoluteTime);
+    WTF_EXPORT_PRIVATE bool timedWait(Mutex&, WallTime absoluteTime);
     WTF_EXPORT_PRIVATE void signal();
     WTF_EXPORT_PRIVATE void broadcast();
     
@@ -110,9 +110,8 @@ private:
 };
 
 #if OS(WINDOWS)
-// The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
 // Returns an interval in milliseconds suitable for passing to one of the Win32 wait functions (e.g., ::WaitForSingleObject).
-WTF_EXPORT_PRIVATE DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime);
+WTF_EXPORT_PRIVATE DWORD absoluteTimeToWaitTimeoutInterval(WallTime absoluteTime);
 #endif
 
 } // namespace WTF
index b2ca77d..a10594b 100644 (file)
@@ -549,18 +549,20 @@ void ThreadCondition::wait(Mutex& mutex)
     ASSERT_UNUSED(result, !result);
 }
 
-bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+bool ThreadCondition::timedWait(Mutex& mutex, WallTime absoluteTime)
 {
-    if (absoluteTime < currentTime())
+    if (absoluteTime < WallTime::now())
         return false;
 
-    if (absoluteTime > INT_MAX) {
+    if (absoluteTime > WallTime::fromRawSeconds(INT_MAX)) {
         wait(mutex);
         return true;
     }
 
-    int timeSeconds = static_cast<int>(absoluteTime);
-    int timeNanoseconds = static_cast<int>((absoluteTime - timeSeconds) * 1E9);
+    double rawSeconds = absoluteTime.secondsSinceEpoch().value();
+
+    int timeSeconds = static_cast<int>(rawSeconds);
+    int timeNanoseconds = static_cast<int>((rawSeconds - timeSeconds) * 1E9);
 
     timespec targetTime;
     targetTime.tv_sec = timeSeconds;
index a5dbbde..4a55443 100644 (file)
@@ -552,7 +552,7 @@ void ThreadCondition::wait(Mutex& mutex)
     m_condition.timedWait(mutex.impl(), INFINITE);
 }
 
-bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+bool ThreadCondition::timedWait(Mutex& mutex, WallTime absoluteTime)
 {
     DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime);
 
@@ -575,19 +575,19 @@ void ThreadCondition::broadcast()
     m_condition.signal(true); // Unblock all threads.
 }
 
-DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime)
+DWORD absoluteTimeToWaitTimeoutInterval(WallTime absoluteTime)
 {
-    double currentTime = WTF::currentTime();
+    WallTime currentTime = WallTime::now();
 
     // Time is in the past - return immediately.
     if (absoluteTime < currentTime)
         return 0;
 
     // Time is too far in the future (and would overflow unsigned long) - wait forever.
-    if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0)
+    if ((absoluteTime - currentTime) > Seconds::fromMilliseconds(INT_MAX))
         return INFINITE;
 
-    return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0);
+    return static_cast<DWORD>((absoluteTime - currentTime).milliseconds());
 }
 
 // Remove this workaround code when <rdar://problem/31793213> is fixed.
index 1622ab3..b7bc9db 100644 (file)
 #include "config.h"
 #include "WallTime.h"
 
-#include "CurrentTime.h"
 #include "MonotonicTime.h"
 #include "PrintStream.h"
 #include "TimeWithDynamicClockType.h"
 
 namespace WTF {
 
-WallTime WallTime::now()
-{
-    return fromRawSeconds(currentTime());
-}
-
 MonotonicTime WallTime::approximateMonotonicTime() const
 {
     return *this - now() + MonotonicTime::now();
index 90aa091..bf66201 100644 (file)
@@ -37,8 +37,8 @@ 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().
+// are relative to the same clock. Use this only if wall clock time is needed. For elapsed time
+// measurement use MonotonicTime instead.
 class WallTime {
 public:
     static const ClockType clockType = ClockType::Wall;
index eb9f73d..7fded12 100644 (file)
@@ -1,3 +1,58 @@
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::Geolocation::haveSuitableCachedPosition):
+        * dom/DOMTimeStamp.h:
+        (WebCore::convertSecondsToDOMTimeStamp):
+        * fileapi/File.cpp:
+        (WebCore::File::File):
+        (WebCore::File::lastModified const):
+        * history/HistoryItem.cpp:
+        (WebCore::generateSequenceNumber):
+        * html/BaseDateAndTimeInputType.cpp:
+        (WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const):
+        * html/DateTimeInputType.cpp:
+        (WebCore::DateTimeInputType::defaultValueForStepUp const):
+        * html/MonthInputType.cpp:
+        (WebCore::MonthInputType::defaultValueForStepUp const):
+        * html/TimeInputType.cpp:
+        (WebCore::TimeInputType::defaultValueForStepUp const):
+        * inspector/agents/InspectorNetworkAgent.cpp:
+        (WebCore::InspectorNetworkAgent::willSendRequest):
+        (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
+        * loader/EmptyFrameLoaderClient.h:
+        * loader/FormSubmission.cpp:
+        (WebCore::generateFormDataIdentifier):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::clientRedirected):
+        * loader/FrameLoader.h:
+        * loader/FrameLoaderClient.h:
+        * loader/NavigationScheduler.cpp:
+        * page/History.cpp:
+        (WebCore::History::stateObjectAdded):
+        * page/History.h:
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::startFadeAnimation):
+        (WebCore::PageOverlay::fadeAnimationTimerFired):
+        * page/PageOverlay.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawNativeImage):
+        * platform/ios/LegacyTileLayerPool.h:
+        * platform/ios/LegacyTileLayerPool.mm:
+        (WebCore::LegacyTileLayerPool::LegacyTileLayerPool):
+        (WebCore::LegacyTileLayerPool::addLayer):
+        (WebCore::LegacyTileLayerPool::decayedCapacity const):
+        (WebCore::LegacyTileLayerPool::prune):
+        * platform/ios/SystemMemoryIOS.cpp:
+        (WebCore::systemMemoryLevel):
+        * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
+        * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
+
 2018-02-22  Per Arne Vollan  <pvollan@apple.com>
 
         The WebContent process should not use NSScreen in the screenDepth implementation.
index dbeedf1..68f5a81 100644 (file)
@@ -468,7 +468,7 @@ bool Geolocation::haveSuitableCachedPosition(const PositionOptions& options)
         return false;
     if (!options.maximumAge)
         return false;
-    DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime());
+    DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(WallTime::now().secondsSinceEpoch());
     return cachedPosition->timestamp() > currentTimeMillis - options.maximumAge;
 }
 
index ee21875..89f4cbf 100644 (file)
@@ -30,6 +30,8 @@
 
 #pragma once
 
+#include <wtf/Seconds.h>
+
 namespace WebCore {
 
 typedef unsigned long long DOMTimeStamp;
@@ -39,6 +41,11 @@ inline DOMTimeStamp convertSecondsToDOMTimeStamp(double seconds)
     return static_cast<DOMTimeStamp>(seconds * 1000.0);
 }
 
+inline DOMTimeStamp convertSecondsToDOMTimeStamp(Seconds seconds)
+{
+    return static_cast<DOMTimeStamp>(seconds.milliseconds());
+}
+
 inline double convertDOMTimeStampToSeconds(DOMTimeStamp milliseconds)
 {
     return milliseconds / 1000.0;
index 0261a0f..ad10bdc 100644 (file)
@@ -81,7 +81,7 @@ static BlobPropertyBag convertPropertyBag(const File::PropertyBag& initialBag)
 File::File(Vector<BlobPartVariant>&& blobPartVariants, const String& filename, const PropertyBag& propertyBag)
     : Blob(WTFMove(blobPartVariants), convertPropertyBag(propertyBag))
     , m_name(filename)
-    , m_overrideLastModifiedDate(propertyBag.lastModified.value_or(currentTimeMS()))
+    , m_overrideLastModifiedDate(propertyBag.lastModified.value_or(WallTime::now().secondsSinceEpoch().milliseconds()))
 {
 }
 
@@ -116,7 +116,7 @@ double File::lastModified() const
     if (FileSystem::getFileModificationTime(m_path, modificationTime) && FileSystem::isValidFileTime(modificationTime))
         result = modificationTime * msPerSecond;
     else
-        result = currentTime() * msPerSecond;
+        result = WallTime::now().secondsSinceEpoch().milliseconds();
 
     return WTF::timeClip(result);
 }
index a866185..6c3034c 100644 (file)
@@ -34,8 +34,8 @@
 #include "SerializedScriptValue.h"
 #include "SharedBuffer.h"
 #include <stdio.h>
-#include <wtf/CurrentTime.h>
 #include <wtf/DateMath.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/CString.h>
 
 namespace WebCore {
@@ -44,7 +44,7 @@ static long long generateSequenceNumber()
 {
     // Initialize to the current time to reduce the likelihood of generating
     // identifiers that overlap with those from past/future browser sessions.
-    static long long next = static_cast<long long>(currentTime() * 1000000.0);
+    static long long next = static_cast<long long>(WallTime::now().secondsSinceEpoch().microseconds());
     return ++next;
 }
 
index 3bc9d5c..da0cb04 100644 (file)
@@ -86,7 +86,7 @@ bool BaseDateAndTimeInputType::typeMismatch() const
 
 Decimal BaseDateAndTimeInputType::defaultValueForStepUp() const
 {
-    double ms = currentTimeMS();
+    double ms = WallTime::now().secondsSinceEpoch().milliseconds();
     int offset = calculateLocalTimeOffset(ms).offset / msPerMinute;
     return Decimal::fromDouble(ms + (offset * msPerMinute));
 }
index 47ed8ea..b2fc016 100644 (file)
@@ -58,7 +58,7 @@ DateComponents::Type DateTimeInputType::dateType() const
 
 Decimal DateTimeInputType::defaultValueForStepUp() const
 {
-    return Decimal::fromDouble(currentTimeMS());
+    return Decimal::fromDouble(WallTime::now().secondsSinceEpoch().milliseconds());
 }
 
 StepRange DateTimeInputType::createStepRange(AnyStepHandling anyStepHandling) const
index 986d468..57f668c 100644 (file)
@@ -78,7 +78,7 @@ String MonthInputType::serializeWithMilliseconds(double value) const
 
 Decimal MonthInputType::defaultValueForStepUp() const
 {
-    double current = currentTimeMS();
+    double current = WallTime::now().secondsSinceEpoch().milliseconds();
     int offset = calculateLocalTimeOffset(current).offset / msPerMinute;
     current += offset * msPerMinute;
 
index 580ef23..8db942d 100644 (file)
@@ -65,7 +65,7 @@ DateComponents::Type TimeInputType::dateType() const
 
 Decimal TimeInputType::defaultValueForStepUp() const
 {
-    double current = currentTimeMS();
+    double current = WallTime::now().secondsSinceEpoch().milliseconds();
     int offset = calculateLocalTimeOffset(current).offset / msPerMinute;
     current += offset * msPerMinute;
 
index 16e8255..bbf3511 100644 (file)
@@ -351,7 +351,7 @@ void InspectorNetworkAgent::willSendRequest(unsigned long identifier, DocumentLo
     }
 
     double sendTimestamp = timestamp();
-    double walltime = currentTime();
+    WallTime walltime = WallTime::now();
 
     String requestId = IdentifiersFactory::requestId(identifier);
     String frameId = frameIdentifier(loader);
@@ -384,7 +384,7 @@ void InspectorNetworkAgent::willSendRequest(unsigned long identifier, DocumentLo
     auto initiatorObject = buildInitiatorObject(document);
 
     String url = loader ? loader->url().string() : request.url();
-    m_frontendDispatcher->requestWillBeSent(requestId, frameId, loaderId, url, buildObjectForResourceRequest(request), sendTimestamp, walltime, initiatorObject, buildObjectForResourceResponse(redirectResponse, nullptr), type != InspectorPageAgent::OtherResource ? &protocolResourceType : nullptr, targetId.isEmpty() ? nullptr : &targetId);
+    m_frontendDispatcher->requestWillBeSent(requestId, frameId, loaderId, url, buildObjectForResourceRequest(request), sendTimestamp, walltime.secondsSinceEpoch().seconds(), initiatorObject, buildObjectForResourceResponse(redirectResponse, nullptr), type != InspectorPageAgent::OtherResource ? &protocolResourceType : nullptr, targetId.isEmpty() ? nullptr : &targetId);
 }
 
 static InspectorPageAgent::ResourceType resourceTypeForCachedResource(CachedResource* resource)
@@ -655,7 +655,7 @@ void InspectorNetworkAgent::willSendWebSocketHandshakeRequest(unsigned long iden
     auto requestObject = Inspector::Protocol::Network::WebSocketRequest::create()
         .setHeaders(buildObjectForHeaders(request.httpHeaderFields()))
         .release();
-    m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), timestamp(), currentTime(), WTFMove(requestObject));
+    m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), timestamp(), WallTime::now().secondsSinceEpoch().seconds(), WTFMove(requestObject));
 }
 
 void InspectorNetworkAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const ResourceResponse& response)
index e8d3390..ef38fa4 100644 (file)
@@ -75,7 +75,7 @@ class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient {
     void dispatchDidDispatchOnloadEvents() final { }
     void dispatchDidReceiveServerRedirectForProvisionalLoad() final { }
     void dispatchDidCancelClientRedirect() final { }
-    void dispatchWillPerformClientRedirect(const URL&, double, double) final { }
+    void dispatchWillPerformClientRedirect(const URL&, double, WallTime) final { }
     void dispatchDidChangeLocationWithinPage() final { }
     void dispatchDidPushStateWithinPage() final { }
     void dispatchDidReplaceStateWithinPage() final { }
index abb385f..c70389a 100644 (file)
@@ -49,7 +49,7 @@
 #include "HTMLParserIdioms.h"
 #include "ScriptDisallowedScope.h"
 #include "TextEncoding.h"
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 
 namespace WebCore {
 
@@ -59,7 +59,7 @@ static int64_t generateFormDataIdentifier()
 {
     // Initialize to the current time to reduce the likelihood of generating
     // identifiers that overlap with those from past/future browser sessions.
-    static int64_t nextIdentifier = static_cast<int64_t>(currentTime() * 1000000.0);
+    static int64_t nextIdentifier = static_cast<int64_t>(WallTime::now().secondsSinceEpoch().microseconds());
     return ++nextIdentifier;
 }
 
index 4b984c7..65db90b 100644 (file)
@@ -2075,7 +2075,7 @@ void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgres
     m_sentRedirectNotification = false;
 }
 
-void FrameLoader::clientRedirected(const URL& url, double seconds, double fireDate, LockBackForwardList lockBackForwardList)
+void FrameLoader::clientRedirected(const URL& url, double seconds, WallTime fireDate, LockBackForwardList lockBackForwardList)
 {
     m_client.dispatchWillPerformClientRedirect(url, seconds, fireDate);
     
index 9265cb1..f3ec8af 100644 (file)
@@ -47,6 +47,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/OptionSet.h>
 #include <wtf/Optional.h>
+#include <wtf/WallTime.h>
 
 namespace WebCore {
 
@@ -268,7 +269,7 @@ public:
 
     void completed();
     bool allAncestorsAreComplete() const; // including this
-    void clientRedirected(const URL&, double delay, double fireDate, LockBackForwardList);
+    void clientRedirected(const URL&, double delay, WallTime fireDate, LockBackForwardList);
     void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
 
     WEBCORE_EXPORT void setOriginalURLForDownloadRequest(ResourceRequest&);
index 7dd25e3..dcaf377 100644 (file)
@@ -34,6 +34,7 @@
 #include "LinkIcon.h"
 #include <functional>
 #include <wtf/Forward.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(APPLICATION_MANIFEST)
@@ -159,7 +160,7 @@ public:
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
     virtual void dispatchDidChangeProvisionalURL() { }
     virtual void dispatchDidCancelClientRedirect() = 0;
-    virtual void dispatchWillPerformClientRedirect(const URL&, double interval, double fireDate) = 0;
+    virtual void dispatchWillPerformClientRedirect(const URL&, double interval, WallTime fireDate) = 0;
     virtual void dispatchDidChangeMainDocument() { }
     virtual void dispatchWillChangeDocument() { }
     virtual void dispatchDidNavigateWithinPage() { }
index 752b809..d284a91 100644 (file)
@@ -135,7 +135,7 @@ protected:
         m_haveToldClient = true;
 
         UserGestureIndicator gestureIndicator(userGestureToForward());
-        frame.loader().clientRedirected(m_url, delay(), currentTime() + timer.nextFireInterval().value(), lockBackForwardList());
+        frame.loader().clientRedirected(m_url, delay(), WallTime::now() + timer.nextFireInterval(), lockBackForwardList());
     }
 
     void didStopTimer(Frame& frame, bool newLoadInProgress) override
@@ -283,7 +283,7 @@ public:
         m_haveToldClient = true;
 
         UserGestureIndicator gestureIndicator(userGestureToForward());
-        frame.loader().clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer.nextFireInterval().value(), lockBackForwardList());
+        frame.loader().clientRedirected(m_submission->requestURL(), delay(), WallTime::now() + timer.nextFireInterval(), lockBackForwardList());
     }
 
     void didStopTimer(Frame& frame, bool newLoadInProgress) override
index 09c7d8b..8d0b959 100644 (file)
@@ -167,7 +167,7 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data
 {
     // Each unique main-frame document is only allowed to send 64MB of state object payload to the UI client/process.
     static uint32_t totalStateObjectPayloadLimit = 0x4000000;
-    static double stateObjectTimeSpan = 30.0;
+    static Seconds stateObjectTimeSpan { 30_s };
     static unsigned perStateObjectTimeSpanLimit = 100;
 
     if (!m_frame || !m_frame->page())
@@ -198,7 +198,7 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data
     if (!mainHistory)
         return { };
 
-    double currentTimestamp = currentTime();
+    WallTime currentTimestamp = WallTime::now();
     if (currentTimestamp - mainHistory->m_currentStateObjectTimeSpanStart > stateObjectTimeSpan) {
         mainHistory->m_currentStateObjectTimeSpanStart = currentTimestamp;
         mainHistory->m_currentStateObjectTimeSpanObjectsAdded = 0;
@@ -206,8 +206,8 @@ ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data
     
     if (mainHistory->m_currentStateObjectTimeSpanObjectsAdded >= perStateObjectTimeSpanLimit) {
         if (stateObjectType == StateObjectType::Replace)
-            return Exception { SecurityError, String::format("Attempt to use history.replaceState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan) };
-        return Exception { SecurityError, String::format("Attempt to use history.pushState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan) };
+            return Exception { SecurityError, String::format("Attempt to use history.replaceState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan.seconds()) };
+        return Exception { SecurityError, String::format("Attempt to use history.pushState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan.seconds()) };
     }
 
     Checked<unsigned> titleSize = title.length();
index 6dbb2ff..8d83275 100644 (file)
@@ -29,6 +29,7 @@
 #include "ExceptionOr.h"
 #include "ScriptWrappable.h"
 #include "SerializedScriptValue.h"
+#include <wtf/WallTime.h>
 
 namespace WebCore {
 
@@ -75,7 +76,7 @@ private:
     RefPtr<SerializedScriptValue> m_lastStateObjectRequested;
 
     unsigned m_currentStateObjectTimeSpanObjectsAdded { 0 };
-    double m_currentStateObjectTimeSpanStart { 0.0 };
+    WallTime m_currentStateObjectTimeSpanStart;
 
     // For the main frame's History object to keep track of all state object usage.
     uint64_t m_totalStateObjectUsage { 0 };
index 932a11e..6607002 100644 (file)
 #include "PageOverlayController.h"
 #include "PlatformMouseEvent.h"
 #include "ScrollbarTheme.h"
-#include <wtf/CurrentTime.h>
 
 namespace WebCore {
 
-static const double fadeAnimationDuration = 0.2;
+static const Seconds fadeAnimationDuration { 200_ms };
 static const double fadeAnimationFrameRate = 30;
 
 static PageOverlay::PageOverlayID generatePageOverlayID()
@@ -253,13 +252,13 @@ void PageOverlay::stopFadeOutAnimation()
 
 void PageOverlay::startFadeAnimation()
 {
-    m_fadeAnimationStartTime = currentTime();
+    m_fadeAnimationStartTime = WallTime::now();
     m_fadeAnimationTimer.startRepeating(1_s / fadeAnimationFrameRate);
 }
 
 void PageOverlay::fadeAnimationTimerFired()
 {
-    float animationProgress = (currentTime() - m_fadeAnimationStartTime) / m_fadeAnimationDuration;
+    float animationProgress = (WallTime::now() - m_fadeAnimationStartTime) / m_fadeAnimationDuration;
 
     if (animationProgress >= 1.0)
         animationProgress = 1.0;
index a47f6f0..6633037 100644 (file)
@@ -30,6 +30,7 @@
 #include "IntRect.h"
 #include "Timer.h"
 #include <wtf/RefCounted.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -126,8 +127,8 @@ private:
     Page* m_page { nullptr };
 
     Timer m_fadeAnimationTimer;
-    double m_fadeAnimationStartTime { 0 };
-    double m_fadeAnimationDuration;
+    WallTime m_fadeAnimationStartTime;
+    Seconds m_fadeAnimationDuration;
 
     enum FadeAnimationType {
         NoAnimation,
index dbfb6d2..2cb2300 100644 (file)
@@ -289,7 +289,7 @@ void GraphicsContext::drawNativeImage(const RetainPtr<CGImageRef>& image, const
     }
 
 #if !LOG_DISABLED
-    double startTime = currentTime();
+    MonotonicTime startTime = MonotonicTime::now();
 #endif
     RetainPtr<CGImageRef> subImage(image);
 
@@ -392,7 +392,7 @@ void GraphicsContext::drawNativeImage(const RetainPtr<CGImageRef>& image, const
 #endif
     }
 
-    LOG_WITH_STREAM(Images, stream << "GraphicsContext::drawNativeImage " << image.get() << " size " << imageSize << " into " << destRect << " took " << 1000.0 * (currentTime() - startTime) << "ms");
+    LOG_WITH_STREAM(Images, stream << "GraphicsContext::drawNativeImage " << image.get() << " size " << imageSize << " into " << destRect << " took " << (MonotonicTime::now() - startTime).milliseconds() << "ms");
 }
 
 static void drawPatternCallback(void* info, CGContextRef context)
index 537c9ed..0563625 100644 (file)
@@ -77,7 +77,7 @@ private:
     unsigned m_capacity;
     Lock m_layerPoolMutex;
 
-    double m_lastAddTime;
+    WallTime m_lastAddTime;
     bool m_needsPrune;
 
     friend NeverDestroyed<LegacyTileLayerPool>;
index fc9c246..250028f 100644 (file)
 
 namespace WebCore {
 
-static const double capacityDecayTime = 5;
+static const Seconds capacityDecayTime { 5_s };
 
 LegacyTileLayerPool::LegacyTileLayerPool()
     : m_totalBytes(0)
     , m_capacity(0)
-    , m_lastAddTime(0)
     , m_needsPrune(false)
 {
 }
@@ -88,7 +87,7 @@ void LegacyTileLayerPool::addLayer(const RetainPtr<LegacyTileLayer>& layer)
     listOfLayersWithSize(layerSize).prepend(layer);
     m_totalBytes += bytesBackingLayerWithPixelSize(layerSize);
 
-    m_lastAddTime = currentTime();
+    m_lastAddTime = WallTime::now();
     schedulePrune();
 }
 
@@ -115,7 +114,7 @@ void LegacyTileLayerPool::setCapacity(unsigned capacity)
 unsigned LegacyTileLayerPool::decayedCapacity() const
 {
     // Decay to one quarter over capacityDecayTime
-    double timeSinceLastAdd = currentTime() - m_lastAddTime;
+    Seconds timeSinceLastAdd = WallTime::now() - m_lastAddTime;
     if (timeSinceLastAdd > capacityDecayTime)
         return m_capacity / 4;
     float decayProgess = float(timeSinceLastAdd / capacityDecayTime);
@@ -157,7 +156,7 @@ void LegacyTileLayerPool::prune()
         // still have a backing store.
         oldestReuseList.removeLast();
     }
-    if (currentTime() - m_lastAddTime <= capacityDecayTime)
+    if (WallTime::now() - m_lastAddTime <= capacityDecayTime)
         schedulePrune();
 }
 
index 6ea41de..1ad12a4 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <sys/sysctl.h>
 #include <wtf/Assertions.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 
 namespace WebCore {
 
@@ -43,9 +43,9 @@ int systemMemoryLevel()
     return 35;
 #else
     static int memoryFreeLevel = -1;
-    static double previousCheckTime; 
-    double time = currentTime();
-    if (time - previousCheckTime < 0.1)
+    static WallTime previousCheckTime;
+    WallTime time = WallTime::now();
+    if (time - previousCheckTime < 100_ms)
         return memoryFreeLevel;
     previousCheckTime = time;
     size_t size = sizeof(memoryFreeLevel);
index 261cba7..cb4368a 100644 (file)
@@ -39,6 +39,7 @@
 #include <pal/cf/CoreMediaSoftLink.h>
 #include <pal/spi/cf/CoreAudioSPI.h>
 #include <sys/time.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 
index ce9bcf8..fed6ee5 100644 (file)
@@ -36,6 +36,7 @@
 #include "NotImplemented.h"
 #include "PlatformLayer.h"
 #include "RealtimeMediaSourceSettings.h"
+#include <wtf/CurrentTime.h>
 
 #include "CoreVideoSoftLink.h"
 
index e35170e..ca6f0c5 100644 (file)
@@ -1,3 +1,59 @@
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        * NetworkProcess/cache/CacheStorageEngineCache.cpp:
+        * PluginProcess/WebProcessConnection.cpp:
+        * Shared/WebProcessCreationParameters.h:
+        * Shared/linux/WebMemorySamplerLinux.cpp:
+        (WebKit::WebMemorySampler::sampleWebKit const):
+        * Shared/mac/WebMemorySampler.mac.mm:
+        (WebKit::WebMemorySampler::sampleWebKit const):
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
+        * UIProcess/API/glib/IconDatabase.cpp:
+        (WebKit::IconDatabase::setIconDataForIconURL):
+        (WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
+        (WebKit::IconDatabase::performURLImport):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
+        (WebKit::expirationTimeFromNow):
+        (WebKit::PlugInAutoStartProvider::addAutoStartOriginHash):
+        (WebKit::PlugInAutoStartProvider::autoStartOriginsTableCopy const):
+        (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTable):
+        (WebKit::PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime):
+        (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest):
+        (WebKit::PlugInAutoStartProvider::didReceiveUserInteraction):
+        * UIProcess/Plugins/PlugInAutoStartProvider.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::processDidFinishLaunching):
+        (WebKit::WebProcessPool::startMemorySampler):
+        (WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
+        * UIProcess/WebProcessPool.h:
+        * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
+        (API::InjectedBundle::PageLoaderClient::willPerformClientRedirectForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::m_webSQLiteDatabaseTracker):
+        (WebKit::WebProcess::isPlugInAutoStartOriginHash):
+        (WebKit::WebProcess::plugInDidStartFromOrigin):
+        (WebKit::WebProcess::didAddPlugInAutoStartOriginHash):
+        (WebKit::WebProcess::resetPlugInAutoStartOriginDefaultHashes):
+        (WebKit::WebProcess::resetPlugInAutoStartOriginHashes):
+        (WebKit::WebProcess::plugInDidReceiveUserInteraction):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        * WebProcess/wpe/WebProcessMainWPE.cpp:
+
 2018-02-22  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: REGRESSION (r228349): ImageBitmap builtin is now runtime guarded
index 69f7704..7aaf577 100644 (file)
@@ -34,6 +34,7 @@
 #include <WebCore/CacheQueryOptions.h>
 #include <WebCore/HTTPParsers.h>
 #include <pal/SessionID.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/UUID.h>
index a0a2c24..9b9df29 100644 (file)
@@ -38,6 +38,7 @@
 #include "PluginProcessConnectionMessages.h"
 #include "PluginProxyMessages.h"
 #include "WebProcessConnectionMessages.h"
+#include <wtf/CurrentTime.h>
 #include <wtf/SetForScope.h>
 
 #if !OS(WINDOWS)
index 3d0813f..db93760 100644 (file)
@@ -161,7 +161,7 @@ struct WebProcessCreationParameters {
     HashMap<String, bool> notificationPermissions;
 #endif
 
-    HashMap<PAL::SessionID, HashMap<unsigned, double>> plugInAutoStartOriginHashes;
+    HashMap<PAL::SessionID, HashMap<unsigned, WallTime>> plugInAutoStartOriginHashes;
     Vector<String> plugInAutoStartOrigins;
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
index 47e3190..aa84001 100644 (file)
@@ -36,7 +36,7 @@
 #include <WebCore/NotImplemented.h>
 #include <string.h>
 #include <sys/sysinfo.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 #include <wtf/linux/CurrentProcessMemoryStatus.h>
 #include <wtf/text/WTFString.h>
 
@@ -95,9 +95,9 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const
 {
     WebMemoryStatistics webKitMemoryStats;
 
-    double now = currentTime();
+    WallTime now = WallTime::now();
 
-    appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Timestamp"), now);
+    appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Timestamp"), now.secondsSinceEpoch().seconds());
 
     ProcessMemoryStatus processMemoryStatus;
     currentProcessMemoryStatus(processMemoryStatus);
index 607d50e..59a98af 100644 (file)
@@ -37,7 +37,7 @@
 #import <mach/task.h>
 #import <malloc/malloc.h>
 #import <notify.h>
-#import <wtf/CurrentTime.h>
+#import <wtf/WallTime.h>
 
 using namespace WebCore;
 using namespace JSC;
@@ -140,10 +140,10 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const
     
     size_t residentSize = sampleProcessCommittedBytes();
 
-    double now = currentTime();
+    WallTime now = WallTime::now();
         
     webKitMemoryStats.keys.append(String("Timestamp"));
-    webKitMemoryStats.values.append(now);
+    webKitMemoryStats.values.append(now.secondsSinceEpoch().seconds());
     webKitMemoryStats.keys.append(String("Total Bytes of Memory In Use"));
     webKitMemoryStats.values.append(totalBytesInUse);
     webKitMemoryStats.keys.append(String("Fast Malloc Zone Bytes"));
index 405486c..dee0a09 100644 (file)
@@ -576,7 +576,7 @@ void WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(WKConte
 {
     if (!dictionaryRef)
         return;
-    toImpl(contextRef)->setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(*toImpl(dictionaryRef), time);
+    toImpl(contextRef)->setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(*toImpl(dictionaryRef), WallTime::fromRawSeconds(time));
 }
 
 void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arrayRef)
index 56b1fe5..a600f9a 100644 (file)
@@ -67,7 +67,7 @@ static bool checkIntegrityOnOpen = false;
 
 // We are not interested in icons that have been unused for more than
 // 30 days, delete them even if they have not been explicitly released.
-static const int notUsedIconExpirationTime = 60*60*24*30;
+static const Seconds notUsedIconExpirationTime { 60*60*24*30 };
 
 #if !LOG_DISABLED || !ERROR_DISABLED
 static String urlForLogging(const String& url)
@@ -546,7 +546,7 @@ void IconDatabase::setIconDataForIconURL(RefPtr<SharedBuffer>&& data, const Stri
 
         // Update the data and set the time stamp
         icon->setImageData(WTFMove(data));
-        icon->setTimestamp((int)currentTime());
+        icon->setTimestamp((int)WallTime::now().secondsSinceEpoch().seconds());
 
         // Copy the current retaining pageURLs - if any - to notify them of the change
         pageURLs.appendRange(icon->retainingPageURLs().begin(), icon->retainingPageURLs().end());
@@ -657,7 +657,7 @@ IconDatabase::IconLoadDecision IconDatabase::synchronousLoadDecisionForIconURL(c
         LockHolder locker(m_urlAndIconLock);
         if (IconRecord* icon = m_iconURLToRecordMap.get(iconURL)) {
             LOG(IconDatabase, "Found expiration time on a present icon based on existing IconRecord");
-            return static_cast<int>(currentTime()) - static_cast<int>(icon->getTimestamp()) > iconExpirationTime ? IconLoadDecision::Yes : IconLoadDecision::No;
+            return static_cast<int>(WallTime::now().secondsSinceEpoch().seconds()) - static_cast<int>(icon->getTimestamp()) > iconExpirationTime ? IconLoadDecision::Yes : IconLoadDecision::No;
         }
     }
 
@@ -1079,7 +1079,7 @@ void IconDatabase::performURLImport()
     // Note that IconInfo.stamp is only set when the icon data is retrieved from the server (and thus is not updated whether
     // we use it or not). This code works anyway because the IconDatabase downloads icons again if they are older than 4 days,
     // so if the timestamp goes back in time more than those 30 days we can be sure that the icon was not used at all.
-    String importQuery = String::format("SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID WHERE IconInfo.stamp > %.0f;", floor(currentTime() - notUsedIconExpirationTime));
+    String importQuery = String::format("SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID WHERE IconInfo.stamp > %.0f;", floor((WallTime::now() - notUsedIconExpirationTime).secondsSinceEpoch().seconds()));
 
     SQLiteStatement query(m_syncDB, importQuery);
 
index a532386..e542239 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebPreferences.h"
 #include "WebProcessProxy.h"
 #include <WebCore/Region.h>
+#include <wtf/CurrentTime.h>
 
 #if PLATFORM(GTK)
 #include <gtk/gtk.h>
index 2225e33..062e87c 100644 (file)
 #include "WebContextClient.h"
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 
 using namespace WebCore;
 
-static const double plugInAutoStartExpirationTimeThreshold = 30 * 24 * 60 * 60;
+static const Seconds plugInAutoStartExpirationTimeThreshold { 30 * 24 * 60 * 60 };
 
 namespace WebKit {
 
@@ -46,9 +46,9 @@ PlugInAutoStartProvider::PlugInAutoStartProvider(WebProcessPool* processPool)
     m_autoStartTable.add(PAL::SessionID::defaultSessionID(), AutoStartTable());
 }
 
-static double expirationTimeFromNow()
+static WallTime expirationTimeFromNow()
 {
-    return currentTime() + plugInAutoStartExpirationTimeThreshold;
+    return WallTime::now() + plugInAutoStartExpirationTimeThreshold;
 }
 
 void PlugInAutoStartProvider::addAutoStartOriginHash(const String& pageOrigin, unsigned plugInOriginHash, PAL::SessionID sessionID)
@@ -63,7 +63,7 @@ void PlugInAutoStartProvider::addAutoStartOriginHash(const String& pageOrigin, u
 
     AutoStartTable::iterator it = m_autoStartTable.add(sessionID, AutoStartTable()).iterator->value.add(pageOrigin, PlugInAutoStartOriginMap()).iterator;
 
-    double expirationTime = expirationTimeFromNow();
+    WallTime expirationTime = expirationTimeFromNow();
     it->value.set(plugInOriginHash, expirationTime);
     sessionIterator->value.set(plugInOriginHash, pageOrigin);
 
@@ -91,12 +91,12 @@ Ref<API::Dictionary> PlugInAutoStartProvider::autoStartOriginsTableCopy() const
 {
     API::Dictionary::MapType map;
 
-    double now = currentTime();
+    WallTime now = WallTime::now();
     for (const auto& stringOriginHash : m_autoStartTable.get(PAL::SessionID::defaultSessionID())) {
         API::Dictionary::MapType hashMap;
         for (const auto& originHash : stringOriginHash.value) {
             if (now <= originHash.value)
-                hashMap.set(String::number(originHash.key), API::Double::create(originHash.value));
+                hashMap.set(String::number(originHash.key), API::Double::create(originHash.value.secondsSinceEpoch().seconds()));
         }
         if (hashMap.size())
             map.set(stringOriginHash.key, API::Dictionary::create(WTFMove(hashMap)));
@@ -107,26 +107,26 @@ Ref<API::Dictionary> PlugInAutoStartProvider::autoStartOriginsTableCopy() const
 
 void PlugInAutoStartProvider::setAutoStartOriginsTable(API::Dictionary& table)
 {
-    setAutoStartOriginsTableWithItemsPassingTest(table, [](double) {
+    setAutoStartOriginsTableWithItemsPassingTest(table, [](WallTime) {
         return true;
     });
 }
 
-void PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary& table, double time)
+void PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary& table, WallTime time)
 {
-    double adjustedTimestamp = time + plugInAutoStartExpirationTimeThreshold;
-    setAutoStartOriginsTableWithItemsPassingTest(table, [adjustedTimestamp](double expirationTimestamp) {
+    WallTime adjustedTimestamp = time + plugInAutoStartExpirationTimeThreshold;
+    setAutoStartOriginsTableWithItemsPassingTest(table, [adjustedTimestamp](WallTime expirationTimestamp) {
         return adjustedTimestamp > expirationTimestamp;
     });
 }
 
-void PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary& table, WTF::Function<bool(double expirationTimestamp)>&& isExpirationTimeAcceptable)
+void PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary& table, WTF::Function<bool(WallTime expirationTimestamp)>&& isExpirationTimeAcceptable)
 {
     ASSERT(isExpirationTimeAcceptable);
 
     m_hashToOriginMap.clear();
     m_autoStartTable.clear();
-    HashMap<unsigned, double> hashMap;
+    HashMap<unsigned, WallTime> hashMap;
     HashMap<unsigned, String>& hashToOriginMap = m_hashToOriginMap.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, String>()).iterator->value;
     AutoStartTable& ast = m_autoStartTable.add(PAL::SessionID::defaultSessionID(), AutoStartTable()).iterator->value;
 
@@ -141,7 +141,7 @@ void PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest(API::
             if (hashTime.value->type() != API::Double::APIType)
                 continue;
 
-            double expirationTime = static_cast<API::Double*>(hashTime.value.get())->value();
+            WallTime expirationTime = WallTime::fromRawSeconds(static_cast<API::Double*>(hashTime.value.get())->value());
             if (!isExpirationTimeAcceptable(expirationTime))
                 continue;
 
@@ -182,7 +182,7 @@ void PlugInAutoStartProvider::didReceiveUserInteraction(unsigned plugInOriginHas
         }
     }
 
-    double newExpirationTime = expirationTimeFromNow();
+    WallTime newExpirationTime = expirationTimeFromNow();
     m_autoStartTable.add(sessionID, AutoStartTable()).iterator->value.add(it->value, PlugInAutoStartOriginMap()).iterator->value.set(plugInOriginHash, newExpirationTime);
     m_processPool->sendToAllProcesses(Messages::WebProcess::DidAddPlugInAutoStartOriginHash(plugInOriginHash, newExpirationTime, sessionID));
     m_processPool->client().plugInAutoStartOriginHashesChanged(m_processPool);
index 98bf067..c8d710e 100644 (file)
@@ -31,6 +31,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
@@ -43,7 +44,7 @@ namespace WebKit {
 
 class WebProcessPool;
 
-typedef HashMap<unsigned, double> PlugInAutoStartOriginMap;
+typedef HashMap<unsigned, WallTime> PlugInAutoStartOriginMap;
 typedef HashMap<PAL::SessionID, PlugInAutoStartOriginMap> SessionPlugInAutoStartOriginMap;
 typedef Vector<String> PlugInAutoStartOrigins;
 
@@ -57,7 +58,7 @@ public:
 
     Ref<API::Dictionary> autoStartOriginsTableCopy() const;
     void setAutoStartOriginsTable(API::Dictionary&);
-    void setAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary&, double time);
+    void setAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary&, WallTime);
     void setAutoStartOriginsArray(API::Array&);
 
     SessionPlugInAutoStartOriginMap autoStartOriginHashesCopy() const;
@@ -66,7 +67,7 @@ public:
 private:
     WebProcessPool* m_processPool;
 
-    void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, WTF::Function<bool(double expirationTimestamp)>&&);
+    void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, WTF::Function<bool(WallTime expirationTimestamp)>&&);
 
     typedef HashMap<String, PlugInAutoStartOriginMap, ASCIICaseInsensitiveHash> AutoStartTable;
     typedef HashMap<PAL::SessionID, AutoStartTable> SessionAutoStartTable;
index b6f90a5..3fcaf5a 100644 (file)
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/URLParser.h>
 #include <pal/SessionID.h>
-#include <wtf/CurrentTime.h>
 #include <wtf/Language.h>
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/RunLoop.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringBuilder.h>
 
 #if ENABLE(SERVICE_CONTROLS)
@@ -942,8 +942,8 @@ void WebProcessPool::processDidFinishLaunching(WebProcessProxy* process)
     // so check if it needs to be started here
     if (m_memorySamplerEnabled) {
         SandboxExtension::Handle sampleLogSandboxHandle;        
-        double now = WTF::currentTime();
-        String sampleLogFilePath = String::format("WebProcess%llupid%d", static_cast<unsigned long long>(now), process->processIdentifier());
+        WallTime now = WallTime::now();
+        String sampleLogFilePath = String::format("WebProcess%llupid%d", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds()), process->processIdentifier());
         sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::Type::ReadWrite, sampleLogSandboxHandle);
         
         process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0);
@@ -1425,8 +1425,8 @@ void WebProcessPool::startMemorySampler(const double interval)
     
     // For WebProcess
     SandboxExtension::Handle sampleLogSandboxHandle;    
-    double now = WTF::currentTime();
-    String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now));
+    WallTime now = WallTime::now();
+    String sampleLogFilePath = String::format("WebProcess%llu", static_cast<unsigned long long>(now.secondsSinceEpoch().seconds()));
     sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::Type::ReadWrite, sampleLogSandboxHandle);
     
     sendToAllProcesses(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, interval));
@@ -1748,7 +1748,7 @@ void WebProcessPool::setPlugInAutoStartOrigins(API::Array& array)
     m_plugInAutoStartProvider.setAutoStartOriginsArray(array);
 }
 
-void WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary& dictionary, double time)
+void WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary& dictionary, WallTime time)
 {
     m_plugInAutoStartProvider.setAutoStartOriginsFilteringOutEntriesAddedAfterTime(dictionary, time);
 }
index 4125819..1b31754 100644 (file)
@@ -314,7 +314,7 @@ public:
     Ref<API::Dictionary> plugInAutoStartOriginHashes() const;
     void setPlugInAutoStartOriginHashes(API::Dictionary&);
     void setPlugInAutoStartOrigins(API::Array&);
-    void setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary&, double time);
+    void setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary&, WallTime);
 
     // Network Process Management
     NetworkProcessProxy& ensureNetworkProcess(WebsiteDataStore* withWebsiteDataStore = nullptr);
index fe739b2..58c64d2 100644 (file)
@@ -28,6 +28,7 @@
 #include "SameDocumentNavigationType.h"
 #include <WebCore/LayoutMilestones.h>
 #include <wtf/Forward.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -80,7 +81,7 @@ public:
 
     virtual void didClearWindowObjectForFrame(WebKit::WebPage&, WebKit::WebFrame&, WebCore::DOMWrapperWorld&) { }
     virtual void didCancelClientRedirectForFrame(WebKit::WebPage&, WebKit::WebFrame&) { }
-    virtual void willPerformClientRedirectForFrame(WebKit::WebPage&, WebKit::WebFrame&, const WTF::String&, double /*delay*/, double /*date*/) { }
+    virtual void willPerformClientRedirectForFrame(WebKit::WebPage&, WebKit::WebFrame&, const WTF::String&, double /*delay*/, WallTime /*date*/) { }
     virtual void didHandleOnloadEventsForFrame(WebKit::WebPage&, WebKit::WebFrame&) { }
 
     virtual void globalObjectIsAvailableForFrame(WebKit::WebPage&, WebKit::WebFrame&, WebCore::DOMWrapperWorld&) { }
index 48fd1ba..e41e831 100644 (file)
@@ -283,12 +283,12 @@ void InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame(WebPage& pa
     m_client.didCancelClientRedirectForFrame(toAPI(&page), toAPI(&frame), m_client.base.clientInfo);
 }
 
-void InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame(WebPage& page, WebFrame& frame, const String& url, double delay, double date)
+void InjectedBundlePageLoaderClient::willPerformClientRedirectForFrame(WebPage& page, WebFrame& frame, const String& url, double delay, WallTime date)
 {
     if (!m_client.willPerformClientRedirectForFrame)
         return;
 
-    m_client.willPerformClientRedirectForFrame(toAPI(&page), toAPI(&frame), toURLRef(url.impl()), delay, date, m_client.base.clientInfo);
+    m_client.willPerformClientRedirectForFrame(toAPI(&page), toAPI(&frame), toURLRef(url.impl()), delay, date.secondsSinceEpoch().seconds(), m_client.base.clientInfo);
 }
 
 void InjectedBundlePageLoaderClient::didHandleOnloadEventsForFrame(WebPage& page, WebFrame& frame)
index dcb0cfc..a90ed60 100644 (file)
@@ -73,7 +73,7 @@ public:
 
     void didClearWindowObjectForFrame(WebPage&, WebFrame&, WebCore::DOMWrapperWorld&) override;
     void didCancelClientRedirectForFrame(WebPage&, WebFrame&) override;
-    void willPerformClientRedirectForFrame(WebPage&, WebFrame&, const WTF::String&, double /*delay*/, double /*date*/) override;
+    void willPerformClientRedirectForFrame(WebPage&, WebFrame&, const WTF::String&, double /*delay*/, WallTime /*date*/) override;
     void didHandleOnloadEventsForFrame(WebPage&, WebFrame&) override;
 
     void globalObjectIsAvailableForFrame(WebPage&, WebFrame&, WebCore::DOMWrapperWorld&) override;
index 1e98b48..239c440 100644 (file)
@@ -335,7 +335,7 @@ void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
     webPage->send(Messages::WebPageProxy::DidCancelClientRedirectForFrame(m_frame->frameID()));
 }
 
-void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double interval, double fireDate)
+void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double interval, WallTime fireDate)
 {
     WebPage* webPage = m_frame->page();
     if (!webPage)
index b68032e..efbf287 100644 (file)
@@ -103,7 +103,7 @@ private:
     void dispatchDidReceiveServerRedirectForProvisionalLoad() final;
     void dispatchDidChangeProvisionalURL() final;
     void dispatchDidCancelClientRedirect() final;
-    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) final;
+    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, WallTime fireDate) final;
     void dispatchDidChangeLocationWithinPage() final;
     void dispatchDidPushStateWithinPage() final;
     void dispatchDidReplaceStateWithinPage() final;
index 85ef3f9..fa51924 100644 (file)
@@ -151,7 +151,7 @@ using namespace JSC;
 using namespace WebCore;
 
 // This should be less than plugInAutoStartExpirationTimeThreshold in PlugInAutoStartProvider.
-static const double plugInAutoStartExpirationTimeUpdateThreshold = 29 * 24 * 60 * 60;
+static const Seconds plugInAutoStartExpirationTimeUpdateThreshold { 29 * 24 * 60 * 60 };
 
 // This should be greater than tileRevalidationTimeout in TileController.
 static const Seconds nonVisibleProcessCleanupDelay { 10_s };
@@ -202,7 +202,7 @@ WebProcess::WebProcess()
     addSupplement<UserMediaCaptureManager>();
 #endif
 
-    m_plugInAutoStartOriginHashes.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, double>());
+    m_plugInAutoStartOriginHashes.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, WallTime>());
 
     ResourceLoadObserver::shared().setNotificationCallback([this] (Vector<ResourceLoadStatistics>&& statistics) {
         ASSERT(!statistics.isEmpty());
@@ -800,8 +800,8 @@ static unsigned hashForPlugInOrigin(const String& pageOrigin, const String& plug
 
 bool WebProcess::isPlugInAutoStartOriginHash(unsigned plugInOriginHash, PAL::SessionID sessionID)
 {
-    HashMap<PAL::SessionID, HashMap<unsigned, double>>::const_iterator sessionIterator = m_plugInAutoStartOriginHashes.find(sessionID);
-    HashMap<unsigned, double>::const_iterator it;
+    HashMap<PAL::SessionID, HashMap<unsigned, WallTime>>::const_iterator sessionIterator = m_plugInAutoStartOriginHashes.find(sessionID);
+    HashMap<unsigned, WallTime>::const_iterator it;
     bool contains = false;
 
     if (sessionIterator != m_plugInAutoStartOriginHashes.end()) {
@@ -814,7 +814,7 @@ bool WebProcess::isPlugInAutoStartOriginHash(unsigned plugInOriginHash, PAL::Ses
         if (it == sessionIterator->value.end())
             return false;
     }
-    return currentTime() < it->value;
+    return WallTime::now() < it->value;
 }
 
 bool WebProcess::shouldPlugInAutoStartFromOrigin(WebPage& webPage, const String& pageOrigin, const String& pluginOrigin, const String& mimeType)
@@ -851,28 +851,28 @@ void WebProcess::plugInDidStartFromOrigin(const String& pageOrigin, const String
     // comes back from the parent process. Temporarily add this hash to the list with a thirty
     // second timeout. That way, even if the parent decides not to add it, we'll only be
     // incorrect for a little while.
-    m_plugInAutoStartOriginHashes.add(sessionID, HashMap<unsigned, double>()).iterator->value.set(plugInOriginHash, currentTime() + 30 * 1000);
+    m_plugInAutoStartOriginHashes.add(sessionID, HashMap<unsigned, WallTime>()).iterator->value.set(plugInOriginHash, WallTime::now() + 30_s * 1000);
 
     parentProcessConnection()->send(Messages::WebProcessPool::AddPlugInAutoStartOriginHash(pageOrigin, plugInOriginHash, sessionID), 0);
 }
 
-void WebProcess::didAddPlugInAutoStartOriginHash(unsigned plugInOriginHash, double expirationTime, PAL::SessionID sessionID)
+void WebProcess::didAddPlugInAutoStartOriginHash(unsigned plugInOriginHash, WallTime expirationTime, PAL::SessionID sessionID)
 {
     // When called, some web process (which also might be this one) added the origin for auto-starting,
     // or received user interaction.
     // Set the bit to avoid having redundantly call into the UI process upon user interaction.
-    m_plugInAutoStartOriginHashes.add(sessionID, HashMap<unsigned, double>()).iterator->value.set(plugInOriginHash, expirationTime);
+    m_plugInAutoStartOriginHashes.add(sessionID, HashMap<unsigned, WallTime>()).iterator->value.set(plugInOriginHash, expirationTime);
 }
 
-void WebProcess::resetPlugInAutoStartOriginDefaultHashes(const HashMap<unsigned, double>& hashes)
+void WebProcess::resetPlugInAutoStartOriginDefaultHashes(const HashMap<unsigned, WallTime>& hashes)
 {
     m_plugInAutoStartOriginHashes.clear();
-    m_plugInAutoStartOriginHashes.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, double>()).iterator->value.swap(const_cast<HashMap<unsigned, double>&>(hashes));
+    m_plugInAutoStartOriginHashes.add(PAL::SessionID::defaultSessionID(), HashMap<unsigned, WallTime>()).iterator->value.swap(const_cast<HashMap<unsigned, WallTime>&>(hashes));
 }
 
-void WebProcess::resetPlugInAutoStartOriginHashes(const HashMap<PAL::SessionID, HashMap<unsigned, double>>& hashes)
+void WebProcess::resetPlugInAutoStartOriginHashes(const HashMap<PAL::SessionID, HashMap<unsigned, WallTime>>& hashes)
 {
-    m_plugInAutoStartOriginHashes.swap(const_cast<HashMap<PAL::SessionID, HashMap<unsigned, double>>&>(hashes));
+    m_plugInAutoStartOriginHashes.swap(const_cast<HashMap<PAL::SessionID, HashMap<unsigned, WallTime>>&>(hashes));
 }
 
 void WebProcess::plugInDidReceiveUserInteraction(const String& pageOrigin, const String& pluginOrigin, const String& mimeType, PAL::SessionID sessionID)
@@ -884,8 +884,8 @@ void WebProcess::plugInDidReceiveUserInteraction(const String& pageOrigin, const
     if (!plugInOriginHash)
         return;
 
-    HashMap<PAL::SessionID, HashMap<unsigned, double>>::const_iterator sessionIterator = m_plugInAutoStartOriginHashes.find(sessionID);
-    HashMap<unsigned, double>::const_iterator it;
+    HashMap<PAL::SessionID, HashMap<unsigned, WallTime>>::const_iterator sessionIterator = m_plugInAutoStartOriginHashes.find(sessionID);
+    HashMap<unsigned, WallTime>::const_iterator it;
     bool contains = false;
     if (sessionIterator != m_plugInAutoStartOriginHashes.end()) {
         it = sessionIterator->value.find(plugInOriginHash);
@@ -898,7 +898,7 @@ void WebProcess::plugInDidReceiveUserInteraction(const String& pageOrigin, const
             return;
     }
 
-    if (it->value - currentTime() > plugInAutoStartExpirationTimeUpdateThreshold)
+    if (it->value - WallTime::now() > plugInAutoStartExpirationTimeUpdateThreshold)
         return;
 
     parentProcessConnection()->send(Messages::WebProcessPool::PlugInDidReceiveUserInteraction(plugInOriginHash, sessionID), 0);
index 52b9d3f..9e79feb 100644 (file)
@@ -280,9 +280,9 @@ private:
     void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
 
     bool isPlugInAutoStartOriginHash(unsigned plugInOriginHash, PAL::SessionID);
-    void didAddPlugInAutoStartOriginHash(unsigned plugInOriginHash, double expirationTime, PAL::SessionID);
-    void resetPlugInAutoStartOriginDefaultHashes(const HashMap<unsigned, double>& hashes);
-    void resetPlugInAutoStartOriginHashes(const HashMap<PAL::SessionID, HashMap<unsigned, double>>& hashes);
+    void didAddPlugInAutoStartOriginHash(unsigned plugInOriginHash, WallTime expirationTime, PAL::SessionID);
+    void resetPlugInAutoStartOriginDefaultHashes(const HashMap<unsigned, WallTime>& hashes);
+    void resetPlugInAutoStartOriginHashes(const HashMap<PAL::SessionID, HashMap<unsigned, WallTime>>& hashes);
 
     void platformSetCacheModel(CacheModel);
 
@@ -386,7 +386,7 @@ private:
 #endif
     RefPtr<WebInspectorInterruptDispatcher> m_webInspectorInterruptDispatcher;
 
-    HashMap<PAL::SessionID, HashMap<unsigned, double>> m_plugInAutoStartOriginHashes;
+    HashMap<PAL::SessionID, HashMap<unsigned, WallTime>> m_plugInAutoStartOriginHashes;
     HashSet<String> m_plugInAutoStartOrigins;
 
     bool m_hasSetCacheModel { false };
index 5798d7d..553de46 100644 (file)
@@ -51,9 +51,9 @@ messages -> WebProcess LegacyReceiver {
     DestroySession(PAL::SessionID sessionID)
 
     # Plug-ins.
-    DidAddPlugInAutoStartOriginHash(uint32_t hash, double expirationTime, PAL::SessionID sessionID)
-    ResetPlugInAutoStartOriginDefaultHashes(HashMap<uint32_t,double> hashes)
-    ResetPlugInAutoStartOriginHashes(HashMap<PAL::SessionID, HashMap<uint32_t,double>> hashes)
+    DidAddPlugInAutoStartOriginHash(uint32_t hash, WallTime expirationTime, PAL::SessionID sessionID)
+    ResetPlugInAutoStartOriginDefaultHashes(HashMap<uint32_t,WallTime> hashes)
+    ResetPlugInAutoStartOriginHashes(HashMap<PAL::SessionID, HashMap<uint32_t,WallTime>> hashes)
     SetPluginLoadClientPolicy(uint8_t policy, String host, String bundleIdentifier, String versionString)
     ResetPluginLoadClientPolicies(HashMap<String, HashMap<String, HashMap<String, uint8_t>>> pluginLoadClientPolicies)
     ClearPluginClientPolicies()
index 8df61c7..06f4339 100644 (file)
@@ -70,6 +70,7 @@
 #import <pal/spi/mac/NSAccessibilitySPI.h>
 #import <pal/spi/mac/NSApplicationSPI.h>
 #import <stdio.h>
+#import <wtf/CurrentTime.h>
 
 #if PLATFORM(IOS)
 #import <UIKit/UIAccessibility.h>
index d653859..02354c6 100644 (file)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include <iostream>
 #include <libsoup/soup.h>
+#include <wtf/CurrentTime.h>
 
 using namespace WebCore;
 
index 8cb4ac5..603c703 100644 (file)
@@ -1,3 +1,14 @@
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchWillPerformClientRedirect):
+
 2018-02-16  Youenn Fablet  <youenn@apple.com>
 
         Allow specifying which plug-ins are supported
index 7649ea3..34c46ff 100644 (file)
@@ -106,7 +106,7 @@ private:
     void dispatchDidDispatchOnloadEvents() final;
     void dispatchDidReceiveServerRedirectForProvisionalLoad() final;
     void dispatchDidCancelClientRedirect() final;
-    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) final;
+    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, WallTime fireDate) final;
     void dispatchDidChangeLocationWithinPage() final;
     void dispatchDidPushStateWithinPage() final;
     void dispatchDidReplaceStateWithinPage() final;
index 627b3e4..7f8564a 100644 (file)
@@ -598,13 +598,13 @@ void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
         CallFrameLoadDelegate(implementations->didCancelClientRedirectForFrameFunc, webView, @selector(webView:didCancelClientRedirectForFrame:), m_webFrame.get());
 }
 
-void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double delay, double fireDate)
+void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double delay, WallTime fireDate)
 {
     WebView *webView = getWebView(m_webFrame.get());
     WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     if (implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc) {
         NSURL *cocoaURL = url;
-        CallFrameLoadDelegate(implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc, webView, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:), cocoaURL, delay, [NSDate dateWithTimeIntervalSince1970:fireDate], m_webFrame.get());
+        CallFrameLoadDelegate(implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc, webView, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:), cocoaURL, delay, [NSDate dateWithTimeIntervalSince1970:fireDate.secondsSinceEpoch().seconds()], m_webFrame.get());
     }
 }
 
index 8dedbb6..c5ceb30 100644 (file)
@@ -1,3 +1,19 @@
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::dispatchWillPerformClientRedirect):
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebDownload.h:
+        * WebDownloadCFNet.cpp:
+        (WebDownload::didStart):
+        (WebDownload::didReceiveData):
+        (WebDownload::didFinish):
+
 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
index c593356..fd84c1c 100644 (file)
@@ -354,12 +354,12 @@ void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
         frameLoadDelegate->didCancelClientRedirectForFrame(webView, m_webFrame);
 }
 
-void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double delay, double fireDate)
+void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const URL& url, double delay, WallTime fireDate)
 {
     WebView* webView = m_webFrame->webView();
     COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
     if (SUCCEEDED(webView->frameLoadDelegate(&frameLoadDelegate)))
-        frameLoadDelegate->willPerformClientRedirectToURL(webView, BString(url.string()), delay, MarshallingHelpers::CFAbsoluteTimeToDATE(fireDate), m_webFrame);
+        frameLoadDelegate->willPerformClientRedirectToURL(webView, BString(url.string()), delay, MarshallingHelpers::CFAbsoluteTimeToDATE(fireDate.secondsSinceEpoch().seconds()), m_webFrame);
 }
 
 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
index 01a0eef..9b8333b 100644 (file)
@@ -85,7 +85,7 @@ public:
     void dispatchDidDispatchOnloadEvents() override;
     void dispatchDidReceiveServerRedirectForProvisionalLoad() override;
     void dispatchDidCancelClientRedirect() override;
-    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) override;
+    void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, WallTime fireDate) override;
     void dispatchDidChangeLocationWithinPage() override;
     void dispatchDidPushStateWithinPage() override;
     void dispatchDidReplaceStateWithinPage() override;
index 6ad7346..84885f2 100644 (file)
@@ -28,6 +28,7 @@
 #include "WebKit.h"
 #include <WebCore/COMPtr.h>
 #include <wtf/RetainPtr.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 #if USE(CFURLCONNECTION)
@@ -117,8 +118,8 @@ protected:
     COMPtr<IWebDownloadDelegate> m_delegate;
 
 #ifndef NDEBUG
-    double m_startTime;
-    double m_dataTime;
+    WallTime m_startTime;
+    WallTime m_dataTime;
     int m_received;
 #endif
 };
index 26ef5d9..8e71979 100644 (file)
@@ -345,9 +345,9 @@ HRESULT WebDownload::useCredential(_In_opt_ IWebURLCredential* credential, _In_o
 void WebDownload::didStart()
 {
 #ifndef NDEBUG
-    m_startTime = m_dataTime = currentTime();
+    m_startTime = m_dataTime = WallTime::now();
     m_received = 0;
-    LOG(Download, "DOWNLOAD - Started %p at %.3f seconds", this, m_startTime);
+    LOG(Download, "DOWNLOAD - Started %p at %.3f seconds", this, m_startTime.secondsSinceEpoch().seconds());
 #endif
     if (FAILED(m_delegate->didBegin(this)))
         LOG_ERROR("DownloadDelegate->didBegin failed");
@@ -411,9 +411,9 @@ void WebDownload::didReceiveData(CFIndex length)
 {
 #ifndef NDEBUG
     m_received += length;
-    double current = currentTime();
-    if (current - m_dataTime > 2.0)
-        LOG(Download, "DOWNLOAD - %p hanged for %.3f seconds - Received %i bytes for a total of %i", this, current - m_dataTime, length, m_received);
+    WallTime current = WallTime::now();
+    if ((current - m_dataTime) > 2_s)
+        LOG(Download, "DOWNLOAD - %p hanged for %.3f seconds - Received %i bytes for a total of %i", this, (current - m_dataTime).seconds(), length, m_received);
     m_dataTime = current;
 #endif
     if (FAILED(m_delegate->didReceiveDataOfLength(this, length)))
@@ -458,7 +458,7 @@ void WebDownload::didCreateDestination(CFURLRef destination)
 void WebDownload::didFinish()
 {
 #ifndef NDEBUG
-    LOG(Download, "DOWNLOAD - Finished %p after %i bytes and %.3f seconds", this, m_received, currentTime() - m_startTime);
+    LOG(Download, "DOWNLOAD - Finished %p after %i bytes and %.3f seconds", this, m_received, (WallTime::now() - m_startTime).seconds());
 #endif
 
     ASSERT(!m_bundlePath.isEmpty() && !m_destination.isEmpty());
index 0c97b3c..8063e3f 100644 (file)
@@ -1,5 +1,24 @@
 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        Remove currentTime() / currentTimeMS()
+        https://bugs.webkit.org/show_bug.cgi?id=183052
+
+        Reviewed by Mark Lam.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (preciseTimeCallback):
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::setMockGeolocationPosition):
+        * TestWebKitAPI/Tests/WTF/Condition.cpp:
+        * TestWebKitAPI/Tests/WTF/ThreadGroup.cpp:
+        * TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
+        * WebKitTestRunner/GeolocationProviderMock.cpp:
+        (WTR::GeolocationProviderMock::setPosition):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::preciseTime):
+
+2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         Remove sleep(double) and sleepMS(double) interfaces
         https://bugs.webkit.org/show_bug.cgi?id=183038
 
index 40afd10..72c645c 100644 (file)
 #include <locale.h>
 #include <stdio.h>
 #include <wtf/Assertions.h>
-#include <wtf/CurrentTime.h>
 #include <wtf/LoggingAccumulator.h>
 #include <wtf/MathExtras.h>
 #include <wtf/RefPtr.h>
 #include <wtf/RunLoop.h>
 #include <wtf/StdLibExtras.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 #if PLATFORM(IOS)
@@ -1768,7 +1768,7 @@ static JSValueRef setBackingScaleFactorCallback(JSContextRef context, JSObjectRe
 
 static JSValueRef preciseTimeCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    return JSValueMakeNumber(context, WTF::currentTime());
+    return JSValueMakeNumber(context, WallTime::now().secondsSinceEpoch().seconds());
 }
 
 static JSValueRef imageCountInGeneralPasteboardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
index 948aba0..1e9d627 100644 (file)
@@ -74,9 +74,9 @@
 #import <WebKit/WebStorageManagerPrivate.h>
 #import <WebKit/WebView.h>
 #import <WebKit/WebViewPrivate.h>
-#import <wtf/CurrentTime.h>
 #import <wtf/HashMap.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/WallTime.h>
 
 #if !PLATFORM(IOS)
 #import <wtf/SoftLinking.h>
@@ -447,9 +447,9 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d
     WebGeolocationPosition *position = nil;
     if (!providesAltitude && !providesAltitudeAccuracy && !providesHeading && !providesSpeed) {
         // Test the exposed API.
-        position = [[WebGeolocationPosition alloc] initWithTimestamp:currentTime() latitude:latitude longitude:longitude accuracy:accuracy];
+        position = [[WebGeolocationPosition alloc] initWithTimestamp:WallTime::now().secondsSinceEpoch().seconds() latitude:latitude longitude:longitude accuracy:accuracy];
     } else {
-        WebCore::GeolocationPosition geolocationPosition { currentTime(), latitude, longitude, accuracy };
+        WebCore::GeolocationPosition geolocationPosition { WallTime::now().secondsSinceEpoch().seconds(), latitude, longitude, accuracy };
         if (providesAltitude)
             geolocationPosition.altitude = altitude;
         if (providesAltitudeAccuracy)
index 0a329c2..4e8d680 100644 (file)
@@ -27,6 +27,7 @@
 #include <mutex>
 #include <thread>
 #include <wtf/Condition.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/DataLog.h>
 #include <wtf/Deque.h>
 #include <wtf/Lock.h>
index 291a3f0..dae8ec2 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 
 #include <wtf/Condition.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/ThreadGroup.h>
 #include <wtf/Vector.h>
 
index 5cf1671..fae5a83 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "Test.h"
 #include <wtf/Condition.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/Lock.h>
 #include <wtf/Vector.h>
 #include <wtf/WorkQueue.h>
index c0a9370..6f93ca2 100644 (file)
@@ -29,7 +29,7 @@
 #include <WebKit/WKGeolocationManager.h>
 #include <string.h>
 #include <wtf/Assertions.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
 
 namespace WTR {
 
@@ -65,7 +65,7 @@ GeolocationProviderMock::~GeolocationProviderMock()
 
 void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
-    m_position.adopt(WKGeolocationPositionCreate_c(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel));
+    m_position.adopt(WKGeolocationPositionCreate_c(WallTime::now().secondsSinceEpoch().seconds(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel));
 
     m_hasError = false;
     m_errorMessage.clear();
index 0c8c040..470dda7 100644 (file)
@@ -788,7 +788,7 @@ void TestRunner::setCookieStoragePartitioningEnabled(bool enabled)
 
 double TestRunner::preciseTime()
 {
-    return currentTime();
+    return WallTime::now().secondsSinceEpoch().seconds();
 }
 
 void TestRunner::setUserStyleSheetEnabled(bool enabled)