Remove std::chrono completely
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jan 2018 03:39:57 +0000 (03:39 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jan 2018 03:39:57 +0000 (03:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181186

Reviewed by Alex Christensen.

Source/WebCore:

Use MonotonicTime, WallTime, and Seconds instead.
Changes are mechanical ones. But persistent network cache data is changed.
So we bump the version number of the cache storage.

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
(WebCore::IDBServer::removeAllDatabasesForOriginPath):
(WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
(WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
* Modules/indexeddb/server/IDBServer.h:
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
* Modules/webdatabase/DatabaseTracker.h:
* dom/Document.cpp:
(WebCore::Document::lastModified):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::clearMediaCache):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::clearMediaCache):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::parseAccessControlMaxAge):
(WebCore::CrossOriginPreflightResultCacheItem::parse):
(WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
* loader/CrossOriginPreflightResultCache.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
(WebCore::CachedResource::freshnessLifetime const):
(WebCore::CachedResource::responseReceived):
(WebCore::CachedResource::updateResponseAfterRevalidation):
* loader/cache/CachedResource.h:
* platform/FileSystem.cpp:
(WebCore::FileSystem::getFileModificationTime):
* platform/FileSystem.h:
* platform/SearchPopupMenu.h:
* platform/cocoa/SearchPopupMenuCocoa.h:
* platform/cocoa/SearchPopupMenuCocoa.mm:
(WebCore::toSystemClockTime):
(WebCore::toNSDateFromSystemClock):
(WebCore::removeRecentlyModifiedRecentSearches):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::clearMediaCache):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::clearMediaCache):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::toSystemClockTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
* platform/network/CacheValidation.cpp:
(WebCore::computeCurrentAge):
(WebCore::computeFreshnessLifetimeForHTTPFamily):
(WebCore::updateRedirectChainStatus):
(WebCore::redirectChainAllowsReuse):
(WebCore::parseCacheControlDirectives):
* platform/network/CacheValidation.h:
(WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
* platform/network/HTTPParsers.cpp:
(WebCore::parseHTTPDate):
* platform/network/HTTPParsers.h:
* platform/network/PlatformCookieJar.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::cacheControlMaxAge const):
(WebCore::parseDateValueInHeader):
(WebCore::ResourceResponseBase::date const):
(WebCore::ResourceResponseBase::age const):
(WebCore::ResourceResponseBase::expires const):
(WebCore::ResourceResponseBase::lastModified const):
* platform/network/ResourceResponseBase.h:
* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::deleteAllCookiesModifiedSince):
* platform/network/curl/CookieJarCurl.cpp:
(WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
(WebCore::deleteAllCookiesModifiedSince):
* platform/network/curl/CookieJarCurl.h:
* platform/network/curl/CurlCacheEntry.cpp:
(WebCore::CurlCacheEntry::CurlCacheEntry):
(WebCore::CurlCacheEntry::isCached):
(WebCore::CurlCacheEntry::parseResponseHeaders):
* platform/network/curl/CurlCacheEntry.h:
* platform/network/mac/CookieJarMac.mm:
(WebCore::deleteAllCookiesModifiedSince):
* platform/network/soup/CookieJarSoup.cpp:
(WebCore::deleteAllCookiesModifiedSince):
* platform/win/SearchPopupMenuWin.cpp:
(WebCore::SearchPopupMenuWin::loadRecentSearches):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::addSearchResult):

Source/WebKit:

Use MonotonicTime, WallTime, and Seconds instead.
Changes are mechanical ones.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteData):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::clear):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::responseHasExpired):
(WebKit::NetworkCache::responseNeedsRevalidation):
(WebKit::NetworkCache::makeStoreDecision):
(WebKit::NetworkCache::Cache::clear):
(WebKit::NetworkCache::Cache::storeData):
* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::Entry):
(WebKit::NetworkCache::Entry::asJSON const):
* NetworkProcess/cache/NetworkCacheEntry.h:
(WebKit::NetworkCache::Entry::timeStamp const):
* NetworkProcess/cache/NetworkCacheFileSystem.cpp:
(WebKit::NetworkCache::fileTimes):
(WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
* NetworkProcess/cache/NetworkCacheFileSystem.h:
* NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
(WebKit::NetworkCache::IOChannel::IOChannel):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::responseNeedsRevalidation):
(WebKit::NetworkCache::canRevalidate):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::readRecord):
(WebKit::NetworkCache::Storage::clear):
(WebKit::NetworkCache::computeRecordWorth):
* NetworkProcess/cache/NetworkCacheStorage.h:
Bump the cache version. We now change the data in persistent cache.
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::lastSeen const):
(WebKit::NetworkCache::SubresourceInfo::firstSeen const):
(WebKit::NetworkCache::SubresourcesEntry::timeStamp const):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::clearHSTSCache):
(WebKit::clearNSURLCache):
(WebKit::NetworkProcess::clearDiskCache):
* NetworkProcess/curl/NetworkProcessCurl.cpp:
(WebKit::NetworkProcess::clearDiskCache):
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::clearCacheForAllOrigins):
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::clearCacheForAllOrigins):
(WebKit::NetworkProcess::clearDiskCache):
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<WallTime>::encode):
(IPC::ArgumentCoder<WallTime>::decode):
(IPC::ArgumentCoder<std::chrono::system_clock::time_point>::encode): Deleted.
(IPC::ArgumentCoder<std::chrono::system_clock::time_point>::decode): Deleted.
* Platform/IPC/ArgumentCoders.h:
* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::deleteWebsiteData):
* PluginProcess/PluginProcess.h:
* PluginProcess/PluginProcess.messages.in:
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
(WebKit::RemoteLayerBackingStore::lastDisplayTime const):
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore):
(WebKit::RemoteLayerBackingStore::display):
* Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm:
(WebKit::RemoteLayerBackingStoreCollection::markBackingStoreVolatile):
(WebKit::RemoteLayerBackingStoreCollection::volatilityTimerFired):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RecentSearch>::decode):
(IPC::ArgumentCoder<WallTime>::encode): Deleted.
(IPC::ArgumentCoder<WallTime>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::deleteWebsiteData):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:
* UIProcess/API/C/WKApplicationCacheManager.cpp:
(WKApplicationCacheManagerDeleteAllEntries):
* UIProcess/API/C/WKCookieManager.cpp:
(WKCookieManagerDeleteAllCookiesModifiedAfterDate):
* UIProcess/API/C/WKKeyValueStorageManager.cpp:
(WKKeyValueStorageManagerDeleteAllEntries):
* UIProcess/API/C/WKResourceCacheManager.cpp:
(WKResourceCacheManagerClearCacheForAllOrigins):
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
(WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
(WKWebsiteDataStoreRemoveAllFetchCaches):
(WKWebsiteDataStoreRemoveAllIndexedDatabases):
(WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(toSystemClockTime):
(-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_clear_cache):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_clear):
* UIProcess/DrawingAreaProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::deleteWebsiteData):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Plugins/PluginProcessManager.cpp:
(WebKit::PluginProcessManager::deleteWebsiteData):
* UIProcess/Plugins/PluginProcessManager.h:
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::deleteWebsiteData):
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::deleteWebsiteData):
* UIProcess/Storage/StorageProcessProxy.h:
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::deleteWebsiteData):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
* UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
* UIProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
* UIProcess/WebStorage/StorageManager.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformRemoveRecentSearches):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::removeMediaKeys):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebsiteDataStore::platformRemoveRecentSearches):
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebsiteDataStore::platformRemoveRecentSearches):
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Cookies/WebCookieManager.messages.in:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::lastModifiedDateMS):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::deleteWebsiteData):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Source/WebKitLegacy:

* Storage/WebDatabaseProvider.cpp:
(WebDatabaseProvider::deleteAllDatabases):

Source/WebKitLegacy/win:

* Plugins/PluginStream.cpp:
(WebCore::lastModifiedDateMS):

Source/WTF:

std::chrono's overflow unaware design is dangerous[1]. Even small code like
`condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
due to overflow of std::chrono::time_point. So we intentionally avoid using
std::chrono, and use WallTime, MonotonicTime, Seconds instead.

This patch removes all the remaining use of std::chrono from WebKit tree.

[1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html

* wtf/CrossThreadCopier.h:
Remove std::chrono support from cross thread copiers.
* wtf/Forward.h:
* wtf/MonotonicTime.h:
(WTF::MonotonicTime::isolatedCopy const):
Add isolatedCopy function.
* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startRepeating):
(WTF::RunLoop::TimerBase::startOneShot):
Just remove these helpers.
* wtf/Seconds.h:
(WTF::Seconds::isolatedCopy const):
Add isolatedCopy function.
* wtf/WallTime.h:
(WTF::WallTime::isolatedCopy const):
Add isolatedCopy function.
* wtf/persistence/PersistentCoders.h:
(WTF::Persistence::Coder<Seconds>::encode):
(WTF::Persistence::Coder<Seconds>::decode):
(WTF::Persistence::Coder<WallTime>::encode):
(WTF::Persistence::Coder<WallTime>::decode):
Add persistent coder support for Seconds and WallTime.
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
Remove std::chrono support from persistent coders.

Tools:

* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::TestController::platformRunUntil):

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

129 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/CrossThreadCopier.h
Source/WTF/wtf/Forward.h
Source/WTF/wtf/MonotonicTime.h
Source/WTF/wtf/RunLoop.h
Source/WTF/wtf/Seconds.h
Source/WTF/wtf/WallTime.h
Source/WTF/wtf/persistence/PersistentCoders.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.h
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
Source/WebCore/loader/CrossOriginPreflightResultCache.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/platform/FileSystem.cpp
Source/WebCore/platform/FileSystem.h
Source/WebCore/platform/SearchPopupMenu.h
Source/WebCore/platform/cocoa/SearchPopupMenuCocoa.h
Source/WebCore/platform/cocoa/SearchPopupMenuCocoa.mm
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/platform/network/CacheValidation.h
Source/WebCore/platform/network/HTTPParsers.cpp
Source/WebCore/platform/network/HTTPParsers.h
Source/WebCore/platform/network/PlatformCookieJar.h
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
Source/WebCore/platform/network/curl/CookieJarCurl.cpp
Source/WebCore/platform/network/curl/CookieJarCurl.h
Source/WebCore/platform/network/curl/CurlCacheEntry.cpp
Source/WebCore/platform/network/curl/CurlCacheEntry.h
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/network/soup/CookieJarSoup.cpp
Source/WebCore/platform/win/SearchPopupMenuWin.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp
Source/WebKit/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit/NetworkProcess/cache/NetworkCache.h
Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.h
Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheFileSystem.h
Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h
Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp
Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
Source/WebKit/NetworkProcess/mac/NetworkProcessMac.mm
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/Platform/IPC/ArgumentCoders.cpp
Source/WebKit/Platform/IPC/ArgumentCoders.h
Source/WebKit/PluginProcess/PluginProcess.cpp
Source/WebKit/PluginProcess/PluginProcess.h
Source/WebKit/PluginProcess/PluginProcess.messages.in
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/StorageProcess/StorageProcess.cpp
Source/WebKit/StorageProcess/StorageProcess.h
Source/WebKit/StorageProcess/StorageProcess.messages.in
Source/WebKit/UIProcess/API/C/WKApplicationCacheManager.cpp
Source/WebKit/UIProcess/API/C/WKCookieManager.cpp
Source/WebKit/UIProcess/API/C/WKKeyValueStorageManager.cpp
Source/WebKit/UIProcess/API/C/WKResourceCacheManager.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp
Source/WebKit/UIProcess/DrawingAreaProxy.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp
Source/WebKit/UIProcess/Plugins/PluginProcessManager.h
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/UIProcess/Storage/StorageProcessProxy.h
Source/WebKit/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp
Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h
Source/WebKit/UIProcess/WebStorage/StorageManager.cpp
Source/WebKit/UIProcess/WebStorage/StorageManager.h
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp
Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp
Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp
Source/WebKit/WebProcess/Cookies/WebCookieManager.h
Source/WebKit/WebProcess/Cookies/WebCookieManager.messages.in
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/Storage/WebDatabaseProvider.cpp
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Plugins/PluginStream.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

index 54e07d9..b78506a 100644 (file)
@@ -1,3 +1,45 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        std::chrono's overflow unaware design is dangerous[1]. Even small code like
+        `condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
+        due to overflow of std::chrono::time_point. So we intentionally avoid using
+        std::chrono, and use WallTime, MonotonicTime, Seconds instead.
+
+        This patch removes all the remaining use of std::chrono from WebKit tree.
+
+        [1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html
+
+        * wtf/CrossThreadCopier.h:
+        Remove std::chrono support from cross thread copiers.
+        * wtf/Forward.h:
+        * wtf/MonotonicTime.h:
+        (WTF::MonotonicTime::isolatedCopy const):
+        Add isolatedCopy function.
+        * wtf/RunLoop.h:
+        (WTF::RunLoop::TimerBase::startRepeating):
+        (WTF::RunLoop::TimerBase::startOneShot):
+        Just remove these helpers.
+        * wtf/Seconds.h:
+        (WTF::Seconds::isolatedCopy const):
+        Add isolatedCopy function.
+        * wtf/WallTime.h:
+        (WTF::WallTime::isolatedCopy const):
+        Add isolatedCopy function.
+        * wtf/persistence/PersistentCoders.h:
+        (WTF::Persistence::Coder<Seconds>::encode):
+        (WTF::Persistence::Coder<Seconds>::decode):
+        (WTF::Persistence::Coder<WallTime>::encode):
+        (WTF::Persistence::Coder<WallTime>::decode):
+        Add persistent coder support for Seconds and WallTime.
+        (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
+        (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
+        Remove std::chrono support from persistent coders.
+
 2018-01-02  Mark Lam  <mark.lam@apple.com>
 
         Refactoring: Rename DummyClass to DummyStruct because it's a struct.
 2018-01-02  Mark Lam  <mark.lam@apple.com>
 
         Refactoring: Rename DummyClass to DummyStruct because it's a struct.
index cb1a915..693e2fa 100644 (file)
@@ -95,14 +95,6 @@ template<typename T> struct CrossThreadCopierBase<false, true, T> {
     }
 };
 
     }
 };
 
-template<> struct CrossThreadCopierBase<false, false, std::chrono::system_clock::time_point> {
-    typedef std::chrono::system_clock::time_point Type;
-    static Type copy(const Type& source)
-    {
-        return source;
-    }
-};
-
 template<> struct CrossThreadCopierBase<false, false, WTF::ASCIILiteral> {
     typedef WTF::ASCIILiteral Type;
     static Type copy(const Type& source)
 template<> struct CrossThreadCopierBase<false, false, WTF::ASCIILiteral> {
     typedef WTF::ASCIILiteral Type;
     static Type copy(const Type& source)
index fd94789..3c26d70 100644 (file)
@@ -35,15 +35,18 @@ class CString;
 class CrashOnOverflow;
 class FunctionDispatcher;
 class Hasher;
 class CrashOnOverflow;
 class FunctionDispatcher;
 class Hasher;
+class MonotonicTime;
 class OrdinalNumber;
 class PrintStream;
 class SHA1;
 class OrdinalNumber;
 class PrintStream;
 class SHA1;
+class Seconds;
 class String;
 class StringBuilder;
 class StringImpl;
 class StringView;
 class TextPosition;
 class TextStream;
 class String;
 class StringBuilder;
 class StringImpl;
 class StringView;
 class TextPosition;
 class TextStream;
+class WallTime;
 
 struct FastMalloc;
 
 
 struct FastMalloc;
 
index 2dc47ed..91b1c88 100644 (file)
@@ -137,6 +137,10 @@ public:
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
 
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
 
+    MonotonicTime isolatedCopy() const
+    {
+        return *this;
+    }
 private:
     constexpr MonotonicTime(double rawValue)
         : m_value(rawValue)
 private:
     constexpr MonotonicTime(double rawValue)
         : m_value(rawValue)
index de2daf4..7eb299a 100644 (file)
@@ -85,10 +85,8 @@ public:
         WTF_EXPORT_PRIVATE virtual ~TimerBase();
 
         void startRepeating(double repeatInterval) { startInternal(repeatInterval, true); }
         WTF_EXPORT_PRIVATE virtual ~TimerBase();
 
         void startRepeating(double repeatInterval) { startInternal(repeatInterval, true); }
-        void startRepeating(std::chrono::milliseconds repeatInterval) { startRepeating(repeatInterval.count() * 0.001); }
         void startRepeating(Seconds repeatInterval) { startRepeating(repeatInterval.value()); }
         void startOneShot(double interval) { startInternal(interval, false); }
         void startRepeating(Seconds repeatInterval) { startRepeating(repeatInterval.value()); }
         void startOneShot(double interval) { startInternal(interval, false); }
-        void startOneShot(std::chrono::milliseconds interval) { startOneShot(interval.count() * 0.001); }
         void startOneShot(Seconds interval) { startOneShot(interval.value()); }
 
         WTF_EXPORT_PRIVATE void stop();
         void startOneShot(Seconds interval) { startOneShot(interval.value()); }
 
         WTF_EXPORT_PRIVATE void stop();
index 48483f2..9a4798f 100644 (file)
@@ -209,6 +209,11 @@ public:
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
     
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
     
+    Seconds isolatedCopy() const
+    {
+        return *this;
+    }
+
 private:
     double m_value { 0 };
 };
 private:
     double m_value { 0 };
 };
index d2df136..90aa091 100644 (file)
@@ -128,6 +128,10 @@ public:
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
     
     
     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
     
+    WallTime isolatedCopy() const
+    {
+        return *this;
+    }
 private:
     constexpr WallTime(double rawValue)
         : m_value(rawValue)
 private:
     constexpr WallTime(double rawValue)
         : m_value(rawValue)
index a5dc0d2..741e21d 100644 (file)
@@ -32,6 +32,7 @@
 #include <wtf/SHA1.h>
 #include <wtf/Seconds.h>
 #include <wtf/Vector.h>
 #include <wtf/SHA1.h>
 #include <wtf/Seconds.h>
 #include <wtf/Vector.h>
+#include <wtf/WallTime.h>
 #include <wtf/persistence/PersistentDecoder.h>
 #include <wtf/persistence/PersistentEncoder.h>
 
 #include <wtf/persistence/PersistentDecoder.h>
 #include <wtf/persistence/PersistentEncoder.h>
 
@@ -60,23 +61,6 @@ template<typename T, typename U> struct Coder<std::pair<T, U>> {
     }
 };
 
     }
 };
 
-template<typename Rep, typename Period> struct Coder<std::chrono::duration<Rep, Period>> {
-    static void encode(Encoder& encoder, const std::chrono::duration<Rep, Period>& duration)
-    {
-        static_assert(std::is_integral<Rep>::value && std::is_signed<Rep>::value && sizeof(Rep) <= sizeof(int64_t), "Serialization of this Rep type is not supported yet. Only signed integer type which can be fit in an int64_t is currently supported.");
-        encoder << static_cast<int64_t>(duration.count());
-    }
-
-    static bool decode(Decoder& decoder, std::chrono::duration<Rep, Period>& result)
-    {
-        int64_t count;
-        if (!decoder.decode(count))
-            return false;
-        result = std::chrono::duration<Rep, Period>(static_cast<Rep>(count));
-        return true;
-    }
-};
-
 template<typename T> struct Coder<std::optional<T>> {
     static void encode(Encoder& encoder, const std::optional<T>& optional)
     {
 template<typename T> struct Coder<std::optional<T>> {
     static void encode(Encoder& encoder, const std::optional<T>& optional)
     {
@@ -262,36 +246,36 @@ template<typename KeyArg, typename HashArg, typename KeyTraitsArg> struct Coder<
     }
 };
 
     }
 };
 
-template<> struct Coder<std::chrono::system_clock::time_point> {
-    static void encode(Encoder& encoder, const std::chrono::system_clock::time_point& timePoint)
+template<> struct Coder<Seconds> {
+    static void encode(Encoder& encoder, const Seconds& seconds)
     {
     {
-        encoder << static_cast<int64_t>(timePoint.time_since_epoch().count());
+        encoder << seconds.value();
     }
     }
-    
-    static bool decode(Decoder& decoder, std::chrono::system_clock::time_point& result)
+
+    static bool decode(Decoder& decoder, Seconds& result)
     {
     {
-        int64_t time;
-        if (!decoder.decode(time))
+        double value;
+        if (!decoder.decode(value))
             return false;
 
             return false;
 
-        result = std::chrono::system_clock::time_point(std::chrono::system_clock::duration(static_cast<std::chrono::system_clock::rep>(time)));
+        result = Seconds(value);
         return true;
     }
 };
 
         return true;
     }
 };
 
-template<> struct Coder<Seconds> {
-    static void encode(Encoder& encoder, const Seconds& seconds)
+template<> struct Coder<WallTime> {
+    static void encode(Encoder& encoder, const WallTime& time)
     {
     {
-        encoder << seconds.value();
+        encoder << time.secondsSinceEpoch().value();
     }
 
     }
 
-    static bool decode(Decoder& decoder, Seconds& result)
+    static bool decode(Decoder& decoder, WallTime& result)
     {
         double value;
         if (!decoder.decode(value))
             return false;
 
     {
         double value;
         if (!decoder.decode(value))
             return false;
 
-        result = Seconds(value);
+        result = WallTime::fromRawSeconds(value);
         return true;
     }
 };
         return true;
     }
 };
index 8506324..9293735 100644 (file)
@@ -1,3 +1,101 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        Use MonotonicTime, WallTime, and Seconds instead.
+        Changes are mechanical ones. But persistent network cache data is changed.
+        So we bump the version number of the cache storage.
+
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
+        (WebCore::IDBServer::removeAllDatabasesForOriginPath):
+        (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
+        (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
+        * Modules/indexeddb/server/IDBServer.h:
+        * Modules/webdatabase/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
+        * Modules/webdatabase/DatabaseTracker.h:
+        * dom/Document.cpp:
+        (WebCore::Document::lastModified):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::clearMediaCache):
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::clearMediaCache):
+        * loader/CrossOriginPreflightResultCache.cpp:
+        (WebCore::parseAccessControlMaxAge):
+        (WebCore::CrossOriginPreflightResultCacheItem::parse):
+        (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
+        * loader/CrossOriginPreflightResultCache.h:
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::CachedResource):
+        (WebCore::CachedResource::freshnessLifetime const):
+        (WebCore::CachedResource::responseReceived):
+        (WebCore::CachedResource::updateResponseAfterRevalidation):
+        * loader/cache/CachedResource.h:
+        * platform/FileSystem.cpp:
+        (WebCore::FileSystem::getFileModificationTime):
+        * platform/FileSystem.h:
+        * platform/SearchPopupMenu.h:
+        * platform/cocoa/SearchPopupMenuCocoa.h:
+        * platform/cocoa/SearchPopupMenuCocoa.mm:
+        (WebCore::toSystemClockTime):
+        (WebCore::toNSDateFromSystemClock):
+        (WebCore::removeRecentlyModifiedRecentSearches):
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::clearMediaCache):
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::clearMediaCache):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::toSystemClockTime):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
+        * platform/network/CacheValidation.cpp:
+        (WebCore::computeCurrentAge):
+        (WebCore::computeFreshnessLifetimeForHTTPFamily):
+        (WebCore::updateRedirectChainStatus):
+        (WebCore::redirectChainAllowsReuse):
+        (WebCore::parseCacheControlDirectives):
+        * platform/network/CacheValidation.h:
+        (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
+        * platform/network/HTTPParsers.cpp:
+        (WebCore::parseHTTPDate):
+        * platform/network/HTTPParsers.h:
+        * platform/network/PlatformCookieJar.h:
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::cacheControlMaxAge const):
+        (WebCore::parseDateValueInHeader):
+        (WebCore::ResourceResponseBase::date const):
+        (WebCore::ResourceResponseBase::age const):
+        (WebCore::ResourceResponseBase::expires const):
+        (WebCore::ResourceResponseBase::lastModified const):
+        * platform/network/ResourceResponseBase.h:
+        * platform/network/cf/CookieJarCFNet.cpp:
+        (WebCore::deleteAllCookiesModifiedSince):
+        * platform/network/curl/CookieJarCurl.cpp:
+        (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
+        (WebCore::deleteAllCookiesModifiedSince):
+        * platform/network/curl/CookieJarCurl.h:
+        * platform/network/curl/CurlCacheEntry.cpp:
+        (WebCore::CurlCacheEntry::CurlCacheEntry):
+        (WebCore::CurlCacheEntry::isCached):
+        (WebCore::CurlCacheEntry::parseResponseHeaders):
+        * platform/network/curl/CurlCacheEntry.h:
+        * platform/network/mac/CookieJarMac.mm:
+        (WebCore::deleteAllCookiesModifiedSince):
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::deleteAllCookiesModifiedSince):
+        * platform/win/SearchPopupMenuWin.cpp:
+        (WebCore::SearchPopupMenuWin::loadRecentSearches):
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::addSearchResult):
+
 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
index c62d821..c8912c1 100644 (file)
@@ -496,14 +496,14 @@ static uint64_t generateDeleteCallbackID()
     return ++currentID;
 }
 
     return ++currentID;
 }
 
-void IDBServer::closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point modificationTime, Function<void ()>&& completionHandler)
+void IDBServer::closeAndDeleteDatabasesModifiedSince(WallTime modificationTime, Function<void ()>&& completionHandler)
 {
     uint64_t callbackID = generateDeleteCallbackID();
     auto addResult = m_deleteDatabaseCompletionHandlers.add(callbackID, WTFMove(completionHandler));
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 
     // If the modification time is in the future, don't both doing anything.
 {
     uint64_t callbackID = generateDeleteCallbackID();
     auto addResult = m_deleteDatabaseCompletionHandlers.add(callbackID, WTFMove(completionHandler));
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 
     // If the modification time is in the future, don't both doing anything.
-    if (modificationTime > std::chrono::system_clock::now()) {
+    if (modificationTime > WallTime::now()) {
         postDatabaseTaskReply(createCrossThreadTask(*this, &IDBServer::didPerformCloseAndDeleteDatabases, callbackID));
         return;
     }
         postDatabaseTaskReply(createCrossThreadTask(*this, &IDBServer::didPerformCloseAndDeleteDatabases, callbackID));
         return;
     }
@@ -541,19 +541,19 @@ void IDBServer::closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginDat
     postDatabaseTask(createCrossThreadTask(*this, &IDBServer::performCloseAndDeleteDatabasesForOrigins, origins, callbackID));
 }
 
     postDatabaseTask(createCrossThreadTask(*this, &IDBServer::performCloseAndDeleteDatabasesForOrigins, origins, callbackID));
 }
 
-static void removeAllDatabasesForOriginPath(const String& originPath, std::chrono::system_clock::time_point modifiedSince)
+static void removeAllDatabasesForOriginPath(const String& originPath, WallTime modifiedSince)
 {
     Vector<String> databasePaths = FileSystem::listDirectory(originPath, "*");
 
     for (auto& databasePath : databasePaths) {
         String databaseFile = FileSystem::pathByAppendingComponent(databasePath, "IndexedDB.sqlite3");
 
 {
     Vector<String> databasePaths = FileSystem::listDirectory(originPath, "*");
 
     for (auto& databasePath : databasePaths) {
         String databaseFile = FileSystem::pathByAppendingComponent(databasePath, "IndexedDB.sqlite3");
 
-        if (modifiedSince > std::chrono::system_clock::time_point::min() && FileSystem::fileExists(databaseFile)) {
-            time_t modificationTime;
-            if (!FileSystem::getFileModificationTime(databaseFile, modificationTime))
+        if (modifiedSince > -WallTime::infinity() && FileSystem::fileExists(databaseFile)) {
+            auto modificationTime = FileSystem::getFileModificationTime(databaseFile);
+            if (!modificationTime)
                 continue;
 
                 continue;
 
-            if (std::chrono::system_clock::from_time_t(modificationTime) < modifiedSince)
+            if (modificationTime.value() < modifiedSince)
                 continue;
         }
 
                 continue;
         }
 
@@ -606,7 +606,7 @@ static void removeAllDatabasesForOriginPath(const String& originPath, std::chron
     FileSystem::deleteEmptyDirectory(originPath);
 }
 
     FileSystem::deleteEmptyDirectory(originPath);
 }
 
-void IDBServer::performCloseAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+void IDBServer::performCloseAndDeleteDatabasesModifiedSince(WallTime modifiedSince, uint64_t callbackID)
 {
     if (!m_databaseDirectoryPath.isEmpty()) {
         Vector<String> originPaths = FileSystem::listDirectory(m_databaseDirectoryPath, "*");
 {
     if (!m_databaseDirectoryPath.isEmpty()) {
         Vector<String> originPaths = FileSystem::listDirectory(m_databaseDirectoryPath, "*");
@@ -622,7 +622,7 @@ void IDBServer::performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOr
     if (!m_databaseDirectoryPath.isEmpty()) {
         for (const auto& origin : origins) {
             String originPath = FileSystem::pathByAppendingComponent(m_databaseDirectoryPath, origin.databaseIdentifier());
     if (!m_databaseDirectoryPath.isEmpty()) {
         for (const auto& origin : origins) {
             String originPath = FileSystem::pathByAppendingComponent(m_databaseDirectoryPath, origin.databaseIdentifier());
-            removeAllDatabasesForOriginPath(originPath, std::chrono::system_clock::time_point::min());
+            removeAllDatabasesForOriginPath(originPath, -WallTime::infinity());
         }
     }
 
         }
     }
 
index 3507421..265f4db 100644 (file)
@@ -101,7 +101,7 @@ public:
 
     std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&);
 
 
     std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&);
 
-    WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, Function<void ()>&& completionHandler);
+    WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(WallTime, Function<void ()>&& completionHandler);
     WEBCORE_EXPORT void closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, Function<void ()>&& completionHandler);
 
 private:
     WEBCORE_EXPORT void closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, Function<void ()>&& completionHandler);
 
 private:
@@ -113,7 +113,7 @@ private:
     void performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
     void didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
 
     void performGetAllDatabaseNames(uint64_t serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
     void didGetAllDatabaseNames(uint64_t serverConnectionIdentifier, uint64_t callbackID, const Vector<String>& databaseNames);
 
-    void performCloseAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, uint64_t callbackID);
+    void performCloseAndDeleteDatabasesModifiedSince(WallTime, uint64_t callbackID);
     void performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
     void didPerformCloseAndDeleteDatabases(uint64_t callbackID);
 
     void performCloseAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
     void didPerformCloseAndDeleteDatabases(uint64_t callbackID);
 
index 4279038..a0828a3 100644 (file)
@@ -773,7 +773,7 @@ void DatabaseTracker::deleteAllDatabasesImmediately()
         deleteOrigin(origin, DeletionMode::Immediate);
 }
 
         deleteOrigin(origin, DeletionMode::Immediate);
 }
 
-void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::time_point time)
+void DatabaseTracker::deleteDatabasesModifiedSince(WallTime time)
 {
     for (auto& origin : origins()) {
         Vector<String> databaseNames = this->databaseNames(origin);
 {
     for (auto& origin : origins()) {
         Vector<String> databaseNames = this->databaseNames(origin);
@@ -786,11 +786,11 @@ void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::ti
             // from the tracker database. We want to delete all of the information associated with this
             // database from the tracker database, so still add its name to databaseNamesToDelete.
             if (FileSystem::fileExists(fullPath)) {
             // from the tracker database. We want to delete all of the information associated with this
             // database from the tracker database, so still add its name to databaseNamesToDelete.
             if (FileSystem::fileExists(fullPath)) {
-                time_t modificationTime;
-                if (!FileSystem::getFileModificationTime(fullPath, modificationTime))
+                auto modificationTime = FileSystem::getFileModificationTime(fullPath);
+                if (!modificationTime)
                     continue;
 
                     continue;
 
-                if (modificationTime < std::chrono::system_clock::to_time_t(time))
+                if (modificationTime.value() < time)
                     continue;
             }
 
                     continue;
             }
 
index d5802a1..2bd1147 100644 (file)
@@ -36,6 +36,7 @@
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
@@ -89,7 +90,7 @@ public:
     RefPtr<OriginLock> originLockFor(const SecurityOriginData&);
 
     WEBCORE_EXPORT void deleteAllDatabasesImmediately();
     RefPtr<OriginLock> originLockFor(const SecurityOriginData&);
 
     WEBCORE_EXPORT void deleteAllDatabasesImmediately();
-    WEBCORE_EXPORT void deleteDatabasesModifiedSince(std::chrono::system_clock::time_point);
+    WEBCORE_EXPORT void deleteDatabasesModifiedSince(WallTime);
     WEBCORE_EXPORT bool deleteOrigin(const SecurityOriginData&);
     WEBCORE_EXPORT bool deleteDatabase(const SecurityOriginData&, const String& name);
 
     WEBCORE_EXPORT bool deleteOrigin(const SecurityOriginData&);
     WEBCORE_EXPORT bool deleteDatabase(const SecurityOriginData&, const String& name);
 
index a570f2c..8430a6d 100644 (file)
@@ -4625,8 +4625,7 @@ ExceptionOr<void> Document::setDomain(const String& newDomain)
 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
 String Document::lastModified()
 {
 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
 String Document::lastModified()
 {
-    using namespace std::chrono;
-    std::optional<system_clock::time_point> dateTime;
+    std::optional<WallTime> dateTime;
     if (m_frame && loader())
         dateTime = loader()->response().lastModified();
 
     if (m_frame && loader())
         dateTime = loader()->response().lastModified();
 
@@ -4634,9 +4633,9 @@ String Document::lastModified()
     // specification tells us to read the last modification date from the file
     // system.
     if (!dateTime)
     // specification tells us to read the last modification date from the file
     // system.
     if (!dateTime)
-        dateTime = system_clock::now();
+        dateTime = WallTime::now();
 
 
-    auto ctime = system_clock::to_time_t(dateTime.value());
+    auto ctime = dateTime.value().secondsSinceEpoch().secondsAs<time_t>();
     auto localDateTime = std::localtime(&ctime);
     return String::format("%02d/%02d/%04d %02d:%02d:%02d", localDateTime->tm_mon + 1, localDateTime->tm_mday, 1900 + localDateTime->tm_year, localDateTime->tm_hour, localDateTime->tm_min, localDateTime->tm_sec);
 }
     auto localDateTime = std::localtime(&ctime);
     return String::format("%02d/%02d/%04d %02d:%02d:%02d", localDateTime->tm_mon + 1, localDateTime->tm_mday, 1900 + localDateTime->tm_year, localDateTime->tm_hour, localDateTime->tm_min, localDateTime->tm_sec);
 }
index c02aefe..6c72044 100644 (file)
@@ -6188,7 +6188,7 @@ HashSet<RefPtr<SecurityOrigin>> HTMLMediaElement::originsInMediaCache(const Stri
     return MediaPlayer::originsInMediaCache(path);
 }
 
     return MediaPlayer::originsInMediaCache(path);
 }
 
-void HTMLMediaElement::clearMediaCache(const String& path, std::chrono::system_clock::time_point modifiedSince)
+void HTMLMediaElement::clearMediaCache(const String& path, WallTime modifiedSince)
 {
     MediaPlayer::clearMediaCache(path, modifiedSince);
 }
 {
     MediaPlayer::clearMediaCache(path, modifiedSince);
 }
index b4cbd91..8f30d6b 100644 (file)
@@ -439,7 +439,7 @@ public:
     WEBCORE_EXPORT static void setMediaCacheDirectory(const String&);
     WEBCORE_EXPORT static const String& mediaCacheDirectory();
     WEBCORE_EXPORT static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
     WEBCORE_EXPORT static void setMediaCacheDirectory(const String&);
     WEBCORE_EXPORT static const String& mediaCacheDirectory();
     WEBCORE_EXPORT static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
-    WEBCORE_EXPORT static void clearMediaCache(const String&, std::chrono::system_clock::time_point modifiedSince = { });
+    WEBCORE_EXPORT static void clearMediaCache(const String&, WallTime modifiedSince = { });
     WEBCORE_EXPORT static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
     static void resetMediaEngines();
 
     WEBCORE_EXPORT static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
     static void resetMediaEngines();
 
index 9066888..6d40213 100644 (file)
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-using namespace std::literals::chrono_literals;
-
 // These values are at the discretion of the user agent.
 // These values are at the discretion of the user agent.
-static const auto defaultPreflightCacheTimeout = 5s;
-static const auto maxPreflightCacheTimeout = 600s; // Should be short enough to minimize the risk of using a poisoned cache after switching to a secure network.
+static const auto defaultPreflightCacheTimeout = 5_s;
+static const auto maxPreflightCacheTimeout = 600_s; // Should be short enough to minimize the risk of using a poisoned cache after switching to a secure network.
 
 CrossOriginPreflightResultCache::CrossOriginPreflightResultCache()
 {
 }
 
 
 CrossOriginPreflightResultCache::CrossOriginPreflightResultCache()
 {
 }
 
-static bool parseAccessControlMaxAge(const String& string, std::chrono::seconds& expiryDelta)
+static bool parseAccessControlMaxAge(const String& string, Seconds& expiryDelta)
 {
     // FIXME: this will not do the correct thing for a number starting with a '+'
     bool ok = false;
 {
     // FIXME: this will not do the correct thing for a number starting with a '+'
     bool ok = false;
-    expiryDelta = std::chrono::seconds(string.toUIntStrict(&ok));
+    expiryDelta = Seconds(static_cast<double>(string.toUIntStrict(&ok)));
     return ok;
 }
 
     return ok;
 }
 
@@ -106,14 +104,14 @@ bool CrossOriginPreflightResultCacheItem::parse(const ResourceResponse& response
         return false;
     }
 
         return false;
     }
 
-    std::chrono::seconds expiryDelta;
+    Seconds expiryDelta = 0_s;
     if (parseAccessControlMaxAge(response.httpHeaderField(HTTPHeaderName::AccessControlMaxAge), expiryDelta)) {
         if (expiryDelta > maxPreflightCacheTimeout)
             expiryDelta = maxPreflightCacheTimeout;
     } else
         expiryDelta = defaultPreflightCacheTimeout;
 
     if (parseAccessControlMaxAge(response.httpHeaderField(HTTPHeaderName::AccessControlMaxAge), expiryDelta)) {
         if (expiryDelta > maxPreflightCacheTimeout)
             expiryDelta = maxPreflightCacheTimeout;
     } else
         expiryDelta = defaultPreflightCacheTimeout;
 
-    m_absoluteExpiryTime = std::chrono::steady_clock::now() + expiryDelta;
+    m_absoluteExpiryTime = MonotonicTime::now() + expiryDelta;
     return true;
 }
 
     return true;
 }
 
@@ -142,7 +140,7 @@ bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHea
 bool CrossOriginPreflightResultCacheItem::allowsRequest(StoredCredentialsPolicy storedCredentialsPolicy, const String& method, const HTTPHeaderMap& requestHeaders) const
 {
     String ignoredExplanation;
 bool CrossOriginPreflightResultCacheItem::allowsRequest(StoredCredentialsPolicy storedCredentialsPolicy, const String& method, const HTTPHeaderMap& requestHeaders) const
 {
     String ignoredExplanation;
-    if (m_absoluteExpiryTime < std::chrono::steady_clock::now())
+    if (m_absoluteExpiryTime < MonotonicTime::now())
         return false;
     if (storedCredentialsPolicy == StoredCredentialsPolicy::Use && m_storedCredentialsPolicy == StoredCredentialsPolicy::DoNotUse)
         return false;
         return false;
     if (storedCredentialsPolicy == StoredCredentialsPolicy::Use && m_storedCredentialsPolicy == StoredCredentialsPolicy::DoNotUse)
         return false;
index e9420f1..af2a5f1 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "StoredCredentialsPolicy.h"
 #include "URLHash.h"
 
 #include "StoredCredentialsPolicy.h"
 #include "URLHash.h"
-#include <chrono>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/text/StringHash.h>
@@ -55,7 +54,7 @@ private:
     // FIXME: A better solution to holding onto the absolute expiration time might be
     // to start a timer for the expiration delta that removes this from the cache when
     // it fires.
     // FIXME: A better solution to holding onto the absolute expiration time might be
     // to start a timer for the expiration delta that removes this from the cache when
     // it fires.
-    std::chrono::steady_clock::time_point m_absoluteExpiryTime;
+    MonotonicTime m_absoluteExpiryTime;
     StoredCredentialsPolicy m_storedCredentialsPolicy;
     HashSet<String> m_methods;
     HashSet<String, ASCIICaseInsensitiveHash> m_headers;
     StoredCredentialsPolicy m_storedCredentialsPolicy;
     HashSet<String> m_methods;
     HashSet<String, ASCIICaseInsensitiveHash> m_headers;
index eaefae7..c23c3be 100644 (file)
@@ -127,7 +127,7 @@ CachedResource::CachedResource(CachedResourceRequest&& request, Type type, PAL::
     , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type))
     , m_sessionID(sessionID)
     , m_loadPriority(defaultPriorityForResourceType(type))
     , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type))
     , m_sessionID(sessionID)
     , m_loadPriority(defaultPriorityForResourceType(type))
-    , m_responseTimestamp(std::chrono::system_clock::now())
+    , m_responseTimestamp(WallTime::now())
     , m_fragmentIdentifierForRequest(request.releaseFragmentIdentifier())
     , m_origin(request.releaseOrigin())
     , m_initiatorName(request.initiatorName())
     , m_fragmentIdentifierForRequest(request.releaseFragmentIdentifier())
     , m_origin(request.releaseOrigin())
     , m_initiatorName(request.initiatorName())
@@ -155,7 +155,7 @@ CachedResource::CachedResource(const URL& url, Type type, PAL::SessionID session
     : m_resourceRequest(url)
     , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type))
     , m_sessionID(sessionID)
     : m_resourceRequest(url)
     , m_decodedDataDeletionTimer(*this, &CachedResource::destroyDecodedData, deadDecodedDataDeletionIntervalForResourceType(type))
     , m_sessionID(sessionID)
-    , m_responseTimestamp(std::chrono::system_clock::now())
+    , m_responseTimestamp(WallTime::now())
     , m_fragmentIdentifierForRequest(CachedResourceRequest::splitFragmentIdentifierFromRequestURL(m_resourceRequest))
     , m_type(type)
     , m_status(Cached)
     , m_fragmentIdentifierForRequest(CachedResourceRequest::splitFragmentIdentifierFromRequestURL(m_resourceRequest))
     , m_type(type)
     , m_status(Cached)
@@ -437,10 +437,8 @@ static inline bool shouldCacheSchemeIndefinitely(StringView scheme)
     return equalLettersIgnoringASCIICase(scheme, "data");
 }
 
     return equalLettersIgnoringASCIICase(scheme, "data");
 }
 
-std::chrono::microseconds CachedResource::freshnessLifetime(const ResourceResponse& response) const
+Seconds CachedResource::freshnessLifetime(const ResourceResponse& response) const
 {
 {
-    using namespace std::literals::chrono_literals;
-
     if (!response.url().protocolIsInHTTPFamily()) {
         StringView protocol = response.url().protocol();
         if (!shouldCacheSchemeIndefinitely(protocol)) {
     if (!response.url().protocolIsInHTTPFamily()) {
         StringView protocol = response.url().protocol();
         if (!shouldCacheSchemeIndefinitely(protocol)) {
@@ -448,10 +446,10 @@ std::chrono::microseconds CachedResource::freshnessLifetime(const ResourceRespon
             // FIXME: We should not cache subresources either, but when we tried this
             // it caused performance and flakiness issues in our test infrastructure.
             if (m_type == MainResource || SchemeRegistry::shouldAlwaysRevalidateURLScheme(protocol.toStringWithoutCopying()))
             // FIXME: We should not cache subresources either, but when we tried this
             // it caused performance and flakiness issues in our test infrastructure.
             if (m_type == MainResource || SchemeRegistry::shouldAlwaysRevalidateURLScheme(protocol.toStringWithoutCopying()))
-                return 0us;
+                return 0_us;
         }
 
         }
 
-        return std::chrono::microseconds::max();
+        return Seconds::infinity();
     }
 
     return computeFreshnessLifetimeForHTTPFamily(response, m_responseTimestamp);
     }
 
     return computeFreshnessLifetimeForHTTPFamily(response, m_responseTimestamp);
@@ -487,7 +485,7 @@ void CachedResource::setResponse(const ResourceResponse& response)
 void CachedResource::responseReceived(const ResourceResponse& response)
 {
     setResponse(response);
 void CachedResource::responseReceived(const ResourceResponse& response)
 {
     setResponse(response);
-    m_responseTimestamp = std::chrono::system_clock::now();
+    m_responseTimestamp = WallTime::now();
     String encoding = response.textEncodingName();
     if (!encoding.isNull())
         setEncoding(encoding);
     String encoding = response.textEncodingName();
     if (!encoding.isNull())
         setEncoding(encoding);
@@ -765,7 +763,7 @@ void CachedResource::switchClientsToRevalidatedResource()
 
 void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& validatingResponse)
 {
 
 void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& validatingResponse)
 {
-    m_responseTimestamp = std::chrono::system_clock::now();
+    m_responseTimestamp = WallTime::now();
 
     updateResponseHeadersAfterRevalidation(m_response, validatingResponse);
 }
 
     updateResponseHeadersAfterRevalidation(m_response, validatingResponse);
 }
index 7b5fea4..c4aebf1 100644 (file)
@@ -322,7 +322,7 @@ private:
     virtual void checkNotify();
     virtual bool mayTryReplaceEncodedData() const { return false; }
 
     virtual void checkNotify();
     virtual bool mayTryReplaceEncodedData() const { return false; }
 
-    std::chrono::microseconds freshnessLifetime(const ResourceResponse&) const;
+    Seconds freshnessLifetime(const ResourceResponse&) const;
 
     void addAdditionalRequestHeaders(CachedResourceLoader&);
     void failBeforeStarting();
 
     void addAdditionalRequestHeaders(CachedResourceLoader&);
     void failBeforeStarting();
@@ -330,7 +330,7 @@ private:
     HashMap<CachedResourceClient*, std::unique_ptr<Callback>> m_clientsAwaitingCallback;
     PAL::SessionID m_sessionID;
     ResourceLoadPriority m_loadPriority;
     HashMap<CachedResourceClient*, std::unique_ptr<Callback>> m_clientsAwaitingCallback;
     PAL::SessionID m_sessionID;
     ResourceLoadPriority m_loadPriority;
-    std::chrono::system_clock::time_point m_responseTimestamp;
+    WallTime m_responseTimestamp;
 
     String m_fragmentIdentifierForRequest;
 
 
     String m_fragmentIdentifierForRequest;
 
index a77998c..2fdb260 100644 (file)
@@ -361,5 +361,13 @@ bool fileIsDirectory(const String& path, ShouldFollowSymbolicLinks shouldFollowS
     return metadata.value().type == FileMetadata::Type::Directory;
 }
 
     return metadata.value().type == FileMetadata::Type::Directory;
 }
 
+std::optional<WallTime> getFileModificationTime(const String& path)
+{
+    time_t modificationTime = 0;
+    if (!getFileModificationTime(path, modificationTime))
+        return std::nullopt;
+    return WallTime::fromRawSeconds(modificationTime);
+}
+
 } // namespace FileSystem
 } // namespace WebCore
 } // namespace FileSystem
 } // namespace WebCore
index 37ce23d..c30efa3 100644 (file)
@@ -35,6 +35,7 @@
 #include <wtf/Forward.h>
 #include <wtf/OptionSet.h>
 #include <wtf/Vector.h>
 #include <wtf/Forward.h>
 #include <wtf/OptionSet.h>
 #include <wtf/Vector.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 #if USE(CF)
 #include <wtf/text/WTFString.h>
 
 #if USE(CF)
@@ -104,6 +105,7 @@ WEBCORE_EXPORT bool moveFile(const String& oldPath, const String& newPath);
 WEBCORE_EXPORT bool getFileSize(const String&, long long& result);
 WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result);
 WEBCORE_EXPORT bool getFileModificationTime(const String&, time_t& result);
 WEBCORE_EXPORT bool getFileSize(const String&, long long& result);
 WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result);
 WEBCORE_EXPORT bool getFileModificationTime(const String&, time_t& result);
+WEBCORE_EXPORT std::optional<WallTime> getFileModificationTime(const String&);
 WEBCORE_EXPORT bool getFileCreationTime(const String&, time_t& result); // Not all platforms store file creation time.
 WEBCORE_EXPORT std::optional<FileMetadata> fileMetadata(const String& path);
 WEBCORE_EXPORT std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path);
 WEBCORE_EXPORT bool getFileCreationTime(const String&, time_t& result); // Not all platforms store file creation time.
 WEBCORE_EXPORT std::optional<FileMetadata> fileMetadata(const String& path);
 WEBCORE_EXPORT std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path);
index f7cb983..61583ee 100644 (file)
@@ -20,9 +20,9 @@
 
 #pragma once
 
 
 #pragma once
 
-#include <chrono>
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -31,7 +31,7 @@ class PopupMenu;
 
 struct RecentSearch {
     String string;
 
 struct RecentSearch {
     String string;
-    std::chrono::system_clock::time_point time;
+    WallTime time;
 };
 
 class SearchPopupMenu : public RefCounted<SearchPopupMenu> {
 };
 
 class SearchPopupMenu : public RefCounted<SearchPopupMenu> {
index 6777dde..045cc33 100644 (file)
@@ -32,7 +32,7 @@ namespace WebCore {
 
 WEBCORE_EXPORT void saveRecentSearches(const String& name, const Vector<RecentSearch>&);
 WEBCORE_EXPORT Vector<RecentSearch> loadRecentSearches(const String& name);
 
 WEBCORE_EXPORT void saveRecentSearches(const String& name, const Vector<RecentSearch>&);
 WEBCORE_EXPORT Vector<RecentSearch> loadRecentSearches(const String& name);
-WEBCORE_EXPORT void removeRecentlyModifiedRecentSearches(std::chrono::system_clock::time_point);
+WEBCORE_EXPORT void removeRecentlyModifiedRecentSearches(WallTime);
 
 }
 
 
 }
 
index b83408f..5293749 100644 (file)
@@ -26,8 +26,6 @@
 #import "config.h"
 #import "SearchPopupMenuCocoa.h"
 
 #import "config.h"
 #import "SearchPopupMenuCocoa.h"
 
-using namespace std::chrono;
-
 namespace WebCore {
 
 static NSString * const dateKey = @"date";
 namespace WebCore {
 
 static NSString * const dateKey = @"date";
@@ -54,16 +52,15 @@ static RetainPtr<NSMutableDictionary> readSearchFieldRecentSearchesPlist()
     return adoptNS([[NSMutableDictionary alloc] initWithContentsOfFile:searchFieldRecentSearchesPlistPath()]);
 }
 
     return adoptNS([[NSMutableDictionary alloc] initWithContentsOfFile:searchFieldRecentSearchesPlistPath()]);
 }
 
-static system_clock::time_point toSystemClockTime(NSDate *date)
+static WallTime toSystemClockTime(NSDate *date)
 {
     ASSERT(date);
 {
     ASSERT(date);
-
-    return system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date.timeIntervalSince1970)));
+    return WallTime::fromRawSeconds(date.timeIntervalSince1970);
 }
 
 }
 
-static NSDate *toNSDateFromSystemClock(system_clock::time_point time)
+static NSDate *toNSDateFromSystemClock(WallTime time)
 {
 {
-    return [NSDate dateWithTimeIntervalSince1970:duration_cast<duration<double>>(time.time_since_epoch()).count()];
+    return [NSDate dateWithTimeIntervalSince1970:time.secondsSinceEpoch().seconds()];
 }
 
 static NSMutableArray *typeCheckedRecentSearchesArray(NSMutableDictionary *itemsDictionary, NSString *name)
 }
 
 static NSMutableArray *typeCheckedRecentSearchesArray(NSMutableDictionary *itemsDictionary, NSString *name)
@@ -200,7 +197,7 @@ Vector<RecentSearch> loadRecentSearches(const String& name)
     return searchItems;
 }
 
     return searchItems;
 }
 
-void removeRecentlyModifiedRecentSearches(std::chrono::system_clock::time_point oldestTimeToRemove)
+void removeRecentlyModifiedRecentSearches(WallTime oldestTimeToRemove)
 {
     NSDate *date = toNSDateFromSystemClock(oldestTimeToRemove);
     auto recentSearchesPlist = typeCheckedRecentSearchesRemovingRecentSearchesAddedAfterDate(date);
 {
     NSDate *date = toNSDateFromSystemClock(oldestTimeToRemove);
     auto recentSearchesPlist = typeCheckedRecentSearchesRemovingRecentSearchesAddedAfterDate(date);
index 2ef212f..8594b65 100644 (file)
@@ -1130,7 +1130,7 @@ HashSet<RefPtr<SecurityOrigin>> MediaPlayer::originsInMediaCache(const String& p
     return origins;
 }
 
     return origins;
 }
 
-void MediaPlayer::clearMediaCache(const String& path, std::chrono::system_clock::time_point modifiedSince)
+void MediaPlayer::clearMediaCache(const String& path, WallTime modifiedSince)
 {
     for (auto& engine : installedMediaEngines()) {
         if (engine.clearMediaCache)
 {
     for (auto& engine : installedMediaEngines()) {
         if (engine.clearMediaCache)
index e27f16d..51762f8 100644 (file)
@@ -53,6 +53,7 @@
 #include <wtf/Noncopyable.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringHash.h>
 
 #if ENABLE(AVF_CAPTIONS)
 #include <wtf/text/StringHash.h>
 
 #if ENABLE(AVF_CAPTIONS)
@@ -329,7 +330,7 @@ public:
     static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&);
     static bool isAvailable();
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String& path);
     static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&);
     static bool isAvailable();
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String& path);
-    static void clearMediaCache(const String& path, std::chrono::system_clock::time_point modifiedSince);
+    static void clearMediaCache(const String& path, WallTime modifiedSince);
     static void clearMediaCacheForOrigins(const String& path, const HashSet<RefPtr<SecurityOrigin>>&);
     static bool supportsKeySystem(const String& keySystem, const String& mimeType);
 
     static void clearMediaCacheForOrigins(const String& path, const HashSet<RefPtr<SecurityOrigin>>&);
     static bool supportsKeySystem(const String& keySystem, const String& mimeType);
 
@@ -674,7 +675,7 @@ using CreateMediaEnginePlayer = WTF::Function<std::unique_ptr<MediaPlayerPrivate
 typedef void (*MediaEngineSupportedTypes)(HashSet<String, ASCIICaseInsensitiveHash>& types);
 typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const MediaEngineSupportParameters& parameters);
 typedef HashSet<RefPtr<SecurityOrigin>> (*MediaEngineOriginsInMediaCache)(const String& path);
 typedef void (*MediaEngineSupportedTypes)(HashSet<String, ASCIICaseInsensitiveHash>& types);
 typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const MediaEngineSupportParameters& parameters);
 typedef HashSet<RefPtr<SecurityOrigin>> (*MediaEngineOriginsInMediaCache)(const String& path);
-typedef void (*MediaEngineClearMediaCache)(const String& path, std::chrono::system_clock::time_point modifiedSince);
+typedef void (*MediaEngineClearMediaCache)(const String& path, WallTime modifiedSince);
 typedef void (*MediaEngineClearMediaCacheForOrigins)(const String& path, const HashSet<RefPtr<SecurityOrigin>>&);
 typedef bool (*MediaEngineSupportsKeySystem)(const String& keySystem, const String& mimeType);
 
 typedef void (*MediaEngineClearMediaCacheForOrigins)(const String& path, const HashSet<RefPtr<SecurityOrigin>>&);
 typedef bool (*MediaEngineSupportsKeySystem)(const String& keySystem, const String& mimeType);
 
index f386953..68b0430 100644 (file)
@@ -219,7 +219,7 @@ public:
     virtual unsigned videoDecodedByteCount() const { return 0; }
 
     HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&) { return { }; }
     virtual unsigned videoDecodedByteCount() const { return 0; }
 
     HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&) { return { }; }
-    void clearMediaCache(const String&, std::chrono::system_clock::time_point) { }
+    void clearMediaCache(const String&, WallTime) { }
     void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&) { }
 
     virtual void setPrivateBrowsingMode(bool) { }
     void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&) { }
 
     virtual void setPrivateBrowsingMode(bool) { }
index 2222c94..493444a 100644 (file)
@@ -86,7 +86,7 @@ public:
     static void registerMediaEngine(MediaEngineRegistrar);
 
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
     static void registerMediaEngine(MediaEngineRegistrar);
 
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
-    static void clearMediaCache(const String&, std::chrono::system_clock::time_point modifiedSince);
+    static void clearMediaCache(const String&, WallTime modifiedSince);
     static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
 
     void setAsset(RetainPtr<id>);
     static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
 
     void setAsset(RetainPtr<id>);
index 37811a8..4bff5b9 100644 (file)
@@ -423,15 +423,13 @@ HashSet<RefPtr<SecurityOrigin>> MediaPlayerPrivateAVFoundationObjC::originsInMed
     return origins;
 }
 
     return origins;
 }
 
-static std::chrono::system_clock::time_point toSystemClockTime(NSDate *date)
+static WallTime toSystemClockTime(NSDate *date)
 {
     ASSERT(date);
 {
     ASSERT(date);
-    using namespace std::chrono;
-
-    return system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date.timeIntervalSince1970)));
+    return WallTime::fromRawSeconds(date.timeIntervalSince1970);
 }
 
 }
 
-void MediaPlayerPrivateAVFoundationObjC::clearMediaCache(const String& path, std::chrono::system_clock::time_point modifiedSince)
+void MediaPlayerPrivateAVFoundationObjC::clearMediaCache(const String& path, WallTime modifiedSince)
 {
     AVAssetCacheType* assetCache = assetCacheForPath(path);
     
 {
     AVAssetCacheType* assetCache = assetCacheForPath(path);
     
@@ -443,7 +441,7 @@ void MediaPlayerPrivateAVFoundationObjC::clearMediaCache(const String& path, std
     NSFileManager *fileManager = [NSFileManager defaultManager];
     NSURL *baseURL = [assetCache URL];
 
     NSFileManager *fileManager = [NSFileManager defaultManager];
     NSURL *baseURL = [assetCache URL];
 
-    if (modifiedSince <= std::chrono::system_clock::time_point { }) {
+    if (modifiedSince <= WallTime::fromRawSeconds(0)) {
         [fileManager removeItemAtURL:baseURL error:nil];
         return;
     }
         [fileManager removeItemAtURL:baseURL error:nil];
         return;
     }
index 2565196..8520e07 100644 (file)
@@ -69,7 +69,7 @@ private:
     static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
 
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
     static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
 
     static HashSet<RefPtr<SecurityOrigin>> originsInMediaCache(const String&);
-    static void clearMediaCache(const String&, std::chrono::system_clock::time_point modifiedSince);
+    static void clearMediaCache(const String&, WallTime modifiedSince);
     static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
     static bool isAvailable();
 
     static void clearMediaCacheForOrigins(const String&, const HashSet<RefPtr<SecurityOrigin>>&);
     static bool isAvailable();
 
index f3de27f..d2817d9 100644 (file)
@@ -1399,7 +1399,7 @@ HashSet<RefPtr<SecurityOrigin>> MediaPlayerPrivateQTKit::originsInMediaCache(con
     return origins;
 }
 
     return origins;
 }
 
-void MediaPlayerPrivateQTKit::clearMediaCache(const String&, std::chrono::system_clock::time_point)
+void MediaPlayerPrivateQTKit::clearMediaCache(const String&, WallTime)
 {
     LOG(Media, "MediaPlayerPrivateQTKit::clearMediaCache()");
     [[QTUtilities qtUtilities] clearDownloadCache];
 {
     LOG(Media, "MediaPlayerPrivateQTKit::clearMediaCache()");
     [[QTUtilities qtUtilities] clearDownloadCache];
index 13a3d0f..dc2a57a 100644 (file)
@@ -38,8 +38,6 @@
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-using namespace std::literals::chrono_literals;
-
 // These response headers are not copied from a revalidated response to the
 // cached response headers. For compatibility, this list is based on Chromium's
 // net/http/http_response_headers.cc.
 // These response headers are not copied from a revalidated response to the
 // cached response headers. For compatibility, this list is based on Chromium's
 // net/http/http_response_headers.cc.
@@ -99,27 +97,23 @@ void updateResponseHeadersAfterRevalidation(ResourceResponse& response, const Re
     }
 }
 
     }
 }
 
-std::chrono::microseconds computeCurrentAge(const ResourceResponse& response, std::chrono::system_clock::time_point responseTime)
+Seconds computeCurrentAge(const ResourceResponse& response, WallTime responseTime)
 {
 {
-    using namespace std::chrono;
-
     // Age calculation:
     // http://tools.ietf.org/html/rfc7234#section-4.2.3
     // No compensation for latency as that is not terribly important in practice.
     auto dateValue = response.date();
     // Age calculation:
     // http://tools.ietf.org/html/rfc7234#section-4.2.3
     // No compensation for latency as that is not terribly important in practice.
     auto dateValue = response.date();
-    auto apparentAge = dateValue ? std::max(0us, duration_cast<microseconds>(responseTime - *dateValue)) : 0us;
-    auto ageValue = response.age().value_or(0us);
+    auto apparentAge = dateValue ? std::max(0_us, responseTime - *dateValue) : 0_us;
+    auto ageValue = response.age().value_or(0_us);
     auto correctedInitialAge = std::max(apparentAge, ageValue);
     auto correctedInitialAge = std::max(apparentAge, ageValue);
-    auto residentTime = duration_cast<microseconds>(system_clock::now() - responseTime);
+    auto residentTime = WallTime::now() - responseTime;
     return correctedInitialAge + residentTime;
 }
 
     return correctedInitialAge + residentTime;
 }
 
-std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, std::chrono::system_clock::time_point responseTime)
+Seconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, WallTime responseTime)
 {
 {
-    using namespace std::chrono;
-
     if (!response.url().protocolIsInHTTPFamily())
     if (!response.url().protocolIsInHTTPFamily())
-        return 0us;
+        return 0_us;
 
     // Freshness Lifetime:
     // http://tools.ietf.org/html/rfc7234#section-4.2.1
 
     // Freshness Lifetime:
     // http://tools.ietf.org/html/rfc7234#section-4.2.1
@@ -130,27 +124,25 @@ std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceRe
     auto date = response.date();
     auto effectiveDate = date.value_or(responseTime);
     if (auto expires = response.expires())
     auto date = response.date();
     auto effectiveDate = date.value_or(responseTime);
     if (auto expires = response.expires())
-        return duration_cast<microseconds>(*expires - effectiveDate);
+        return *expires - effectiveDate;
 
     // Implicit lifetime.
     switch (response.httpStatusCode()) {
     case 301: // Moved Permanently
     case 410: // Gone
         // These are semantically permanent and so get long implicit lifetime.
 
     // Implicit lifetime.
     switch (response.httpStatusCode()) {
     case 301: // Moved Permanently
     case 410: // Gone
         // These are semantically permanent and so get long implicit lifetime.
-        return 365 * 24h;
+        return 24_h * 365;
     default:
         // Heuristic Freshness:
         // http://tools.ietf.org/html/rfc7234#section-4.2.2
         if (auto lastModified = response.lastModified())
     default:
         // Heuristic Freshness:
         // http://tools.ietf.org/html/rfc7234#section-4.2.2
         if (auto lastModified = response.lastModified())
-            return duration_cast<microseconds>((effectiveDate - *lastModified) * 0.1);
-        return 0us;
+            return (effectiveDate - *lastModified) * 0.1;
+        return 0_us;
     }
 }
 
 void updateRedirectChainStatus(RedirectChainCacheStatus& redirectChainCacheStatus, const ResourceResponse& response)
 {
     }
 }
 
 void updateRedirectChainStatus(RedirectChainCacheStatus& redirectChainCacheStatus, const ResourceResponse& response)
 {
-    using namespace std::chrono;
-
     if (redirectChainCacheStatus.status == RedirectChainCacheStatus::NotCachedRedirection)
         return;
     if (response.cacheControlContainsNoStore() || response.cacheControlContainsNoCache() || response.cacheControlContainsMustRevalidate()) {
     if (redirectChainCacheStatus.status == RedirectChainCacheStatus::NotCachedRedirection)
         return;
     if (response.cacheControlContainsNoStore() || response.cacheControlContainsNoCache() || response.cacheControlContainsMustRevalidate()) {
@@ -159,7 +151,7 @@ void updateRedirectChainStatus(RedirectChainCacheStatus& redirectChainCacheStatu
     }
 
     redirectChainCacheStatus.status = RedirectChainCacheStatus::CachedRedirection;
     }
 
     redirectChainCacheStatus.status = RedirectChainCacheStatus::CachedRedirection;
-    auto responseTimestamp = system_clock::now();
+    auto responseTimestamp = WallTime::now();
     // Store the nearest end of cache validity date
     auto endOfValidity = responseTimestamp + computeFreshnessLifetimeForHTTPFamily(response, responseTimestamp) - computeCurrentAge(response, responseTimestamp);
     redirectChainCacheStatus.endOfValidity = std::min(redirectChainCacheStatus.endOfValidity, endOfValidity);
     // Store the nearest end of cache validity date
     auto endOfValidity = responseTimestamp + computeFreshnessLifetimeForHTTPFamily(response, responseTimestamp) - computeCurrentAge(response, responseTimestamp);
     redirectChainCacheStatus.endOfValidity = std::min(redirectChainCacheStatus.endOfValidity, endOfValidity);
@@ -173,7 +165,7 @@ bool redirectChainAllowsReuse(RedirectChainCacheStatus redirectChainCacheStatus,
     case RedirectChainCacheStatus::NotCachedRedirection:
         return false;
     case RedirectChainCacheStatus::CachedRedirection:
     case RedirectChainCacheStatus::NotCachedRedirection:
         return false;
     case RedirectChainCacheStatus::CachedRedirection:
-        return reuseExpiredRedirection || std::chrono::system_clock::now() <= redirectChainCacheStatus.endOfValidity;
+        return reuseExpiredRedirection || WallTime::now() <= redirectChainCacheStatus.endOfValidity;
     }
     ASSERT_NOT_REACHED();
     return false;
     }
     ASSERT_NOT_REACHED();
     return false;
@@ -279,8 +271,6 @@ static Vector<std::pair<String, String>> parseCacheHeader(const String& header)
 
 CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
 {
 
 CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
 {
-    using namespace std::chrono;
-
     CacheControlDirectives result;
 
     String cacheControlValue = headers.get(HTTPHeaderName::CacheControl);
     CacheControlDirectives result;
 
     String cacheControlValue = headers.get(HTTPHeaderName::CacheControl);
@@ -306,7 +296,7 @@ CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
                 bool ok;
                 double maxAge = directives[i].second.toDouble(&ok);
                 if (ok)
                 bool ok;
                 double maxAge = directives[i].second.toDouble(&ok);
                 if (ok)
-                    result.maxAge = duration_cast<microseconds>(duration<double>(maxAge));
+                    result.maxAge = Seconds { maxAge };
             } else if (equalLettersIgnoringASCIICase(directives[i].first, "max-stale")) {
                 // https://tools.ietf.org/html/rfc7234#section-5.2.1.2
                 if (result.maxStale) {
             } else if (equalLettersIgnoringASCIICase(directives[i].first, "max-stale")) {
                 // https://tools.ietf.org/html/rfc7234#section-5.2.1.2
                 if (result.maxStale) {
@@ -315,13 +305,13 @@ CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
                 }
                 if (directives[i].second.isEmpty()) {
                     // if no value is assigned to max-stale, then the client is willing to accept a stale response of any age.
                 }
                 if (directives[i].second.isEmpty()) {
                     // if no value is assigned to max-stale, then the client is willing to accept a stale response of any age.
-                    result.maxStale = microseconds::max();
+                    result.maxStale = Seconds::infinity();
                     continue;
                 }
                 bool ok;
                 double maxStale = directives[i].second.toDouble(&ok);
                 if (ok)
                     continue;
                 }
                 bool ok;
                 double maxStale = directives[i].second.toDouble(&ok);
                 if (ok)
-                    result.maxStale = duration_cast<microseconds>(duration<double>(maxStale));
+                    result.maxStale = Seconds { maxStale };
             } else if (equalLettersIgnoringASCIICase(directives[i].first, "immutable"))
                 result.immutable = true;
         }
             } else if (equalLettersIgnoringASCIICase(directives[i].first, "immutable"))
                 result.immutable = true;
         }
index 5aecf47..bcd172f 100644 (file)
 #pragma once
 
 #include "PlatformExportMacros.h"
 #pragma once
 
 #include "PlatformExportMacros.h"
-#include <chrono>
 #include <pal/SessionID.h>
 #include <wtf/Optional.h>
 #include <wtf/Vector.h>
 #include <pal/SessionID.h>
 #include <wtf/Optional.h>
 #include <wtf/Vector.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -46,14 +46,14 @@ struct RedirectChainCacheStatus {
     };
     RedirectChainCacheStatus()
         : status(NoRedirection)
     };
     RedirectChainCacheStatus()
         : status(NoRedirection)
-        , endOfValidity(std::chrono::system_clock::time_point::max())
+        , endOfValidity(WallTime::infinity())
     { }
     Status status;
     { }
     Status status;
-    std::chrono::system_clock::time_point endOfValidity;
+    WallTime endOfValidity;
 };
 
 };
 
-WEBCORE_EXPORT std::chrono::microseconds computeCurrentAge(const ResourceResponse&, std::chrono::system_clock::time_point responseTimestamp);
-WEBCORE_EXPORT std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, std::chrono::system_clock::time_point responseTimestamp);
+WEBCORE_EXPORT Seconds computeCurrentAge(const ResourceResponse&, WallTime responseTimestamp);
+WEBCORE_EXPORT Seconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, WallTime responseTimestamp);
 WEBCORE_EXPORT void updateResponseHeadersAfterRevalidation(ResourceResponse&, const ResourceResponse& validatingResponse);
 WEBCORE_EXPORT void updateRedirectChainStatus(RedirectChainCacheStatus&, const ResourceResponse&);
 
 WEBCORE_EXPORT void updateResponseHeadersAfterRevalidation(ResourceResponse&, const ResourceResponse& validatingResponse);
 WEBCORE_EXPORT void updateRedirectChainStatus(RedirectChainCacheStatus&, const ResourceResponse&);
 
@@ -61,8 +61,8 @@ enum ReuseExpiredRedirectionOrNot { DoNotReuseExpiredRedirection, ReuseExpiredRe
 WEBCORE_EXPORT bool redirectChainAllowsReuse(RedirectChainCacheStatus, ReuseExpiredRedirectionOrNot);
 
 struct CacheControlDirectives {
 WEBCORE_EXPORT bool redirectChainAllowsReuse(RedirectChainCacheStatus, ReuseExpiredRedirectionOrNot);
 
 struct CacheControlDirectives {
-    std::optional<std::chrono::microseconds> maxAge;
-    std::optional<std::chrono::microseconds> maxStale;
+    std::optional<Seconds> maxAge;
+    std::optional<Seconds> maxStale;
     bool noCache { false };
     bool noStore { false };
     bool mustRevalidate { false };
     bool noCache { false };
     bool noStore { false };
     bool mustRevalidate { false };
index 07fb718..1a2410b 100644 (file)
@@ -253,14 +253,14 @@ bool parseHTTPRefresh(const String& refresh, double& delay, String& url)
     }
 }
 
     }
 }
 
-std::optional<std::chrono::system_clock::time_point> parseHTTPDate(const String& value)
+std::optional<WallTime> parseHTTPDate(const String& value)
 {
     double dateInMillisecondsSinceEpoch = parseDateFromNullTerminatedCharacters(value.utf8().data());
     if (!std::isfinite(dateInMillisecondsSinceEpoch))
 {
     double dateInMillisecondsSinceEpoch = parseDateFromNullTerminatedCharacters(value.utf8().data());
     if (!std::isfinite(dateInMillisecondsSinceEpoch))
-        return { };
+        return std::nullopt;
     // This assumes system_clock epoch equals Unix epoch which is true for all implementations but unspecified.
     // This assumes system_clock epoch equals Unix epoch which is true for all implementations but unspecified.
-    // FIXME: The parsing function should be switched to std::chrono too.
-    return std::chrono::system_clock::time_point(std::chrono::milliseconds(static_cast<long long>(dateInMillisecondsSinceEpoch)));
+    // FIXME: The parsing function should be switched to WallTime too.
+    return WallTime::fromRawSeconds(dateInMillisecondsSinceEpoch / 1000.0);
 }
 
 // FIXME: This function doesn't comply with RFC 6266.
 }
 
 // FIXME: This function doesn't comply with RFC 6266.
index a33b371..d6051e2 100644 (file)
@@ -33,6 +33,7 @@
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/Optional.h>
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/Optional.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
@@ -69,7 +70,7 @@ bool isValidAcceptHeaderValue(const String&);
 bool isValidLanguageHeaderValue(const String&);
 bool isValidHTTPToken(const String&);
 bool parseHTTPRefresh(const String& refresh, double& delay, String& url);
 bool isValidLanguageHeaderValue(const String&);
 bool isValidHTTPToken(const String&);
 bool parseHTTPRefresh(const String& refresh, double& delay, String& url);
-std::optional<std::chrono::system_clock::time_point> parseHTTPDate(const String&);
+std::optional<WallTime> parseHTTPDate(const String&);
 String filenameFromHTTPContentDisposition(const String&);
 String extractMIMETypeFromMediaType(const String&);
 String extractCharsetFromMediaType(const String&);
 String filenameFromHTTPContentDisposition(const String&);
 String extractMIMETypeFromMediaType(const String&);
 String extractCharsetFromMediaType(const String&);
index f9080e0..cb16967 100644 (file)
@@ -25,9 +25,9 @@
 
 #pragma once
 
 
 #pragma once
 
-#include <chrono>
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -50,6 +50,6 @@ WEBCORE_EXPORT void deleteCookie(const NetworkStorageSession&, const URL&, const
 WEBCORE_EXPORT void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames);
 WEBCORE_EXPORT void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames);
 WEBCORE_EXPORT void deleteAllCookies(const NetworkStorageSession&);
 WEBCORE_EXPORT void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames);
 WEBCORE_EXPORT void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames);
 WEBCORE_EXPORT void deleteAllCookies(const NetworkStorageSession&);
-WEBCORE_EXPORT void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point);
+WEBCORE_EXPORT void deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime);
 
 }
 
 }
index 212a795..53481af 100644 (file)
@@ -480,18 +480,18 @@ bool ResourceResponseBase::hasCacheValidatorFields() const
     return !m_httpHeaderFields.get(HTTPHeaderName::LastModified).isEmpty() || !m_httpHeaderFields.get(HTTPHeaderName::ETag).isEmpty();
 }
 
     return !m_httpHeaderFields.get(HTTPHeaderName::LastModified).isEmpty() || !m_httpHeaderFields.get(HTTPHeaderName::ETag).isEmpty();
 }
 
-std::optional<std::chrono::microseconds> ResourceResponseBase::cacheControlMaxAge() const
+std::optional<Seconds> ResourceResponseBase::cacheControlMaxAge() const
 {
     if (!m_haveParsedCacheControlHeader)
         parseCacheControlDirectives();
     return m_cacheControlDirectives.maxAge;
 }
 
 {
     if (!m_haveParsedCacheControlHeader)
         parseCacheControlDirectives();
     return m_cacheControlDirectives.maxAge;
 }
 
-static std::optional<std::chrono::system_clock::time_point> parseDateValueInHeader(const HTTPHeaderMap& headers, HTTPHeaderName headerName)
+static std::optional<WallTime> parseDateValueInHeader(const HTTPHeaderMap& headers, HTTPHeaderName headerName)
 {
     String headerValue = headers.get(headerName);
     if (headerValue.isEmpty())
 {
     String headerValue = headers.get(headerName);
     if (headerValue.isEmpty())
-        return { };
+        return std::nullopt;
     // This handles all date formats required by RFC2616:
     // Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
     // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
     // This handles all date formats required by RFC2616:
     // Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
     // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
@@ -499,7 +499,7 @@ static std::optional<std::chrono::system_clock::time_point> parseDateValueInHead
     return parseHTTPDate(headerValue);
 }
 
     return parseHTTPDate(headerValue);
 }
 
-std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::date() const
+std::optional<WallTime> ResourceResponseBase::date() const
 {
     lazyInit(CommonFieldsOnly);
 
 {
     lazyInit(CommonFieldsOnly);
 
@@ -510,10 +510,8 @@ std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::date(
     return m_date;
 }
 
     return m_date;
 }
 
-std::optional<std::chrono::microseconds> ResourceResponseBase::age() const
+std::optional<Seconds> ResourceResponseBase::age() const
 {
 {
-    using namespace std::chrono;
-
     lazyInit(CommonFieldsOnly);
 
     if (!m_haveParsedAgeHeader) {
     lazyInit(CommonFieldsOnly);
 
     if (!m_haveParsedAgeHeader) {
@@ -521,13 +519,13 @@ std::optional<std::chrono::microseconds> ResourceResponseBase::age() const
         bool ok;
         double ageDouble = headerValue.toDouble(&ok);
         if (ok)
         bool ok;
         double ageDouble = headerValue.toDouble(&ok);
         if (ok)
-            m_age = duration_cast<microseconds>(duration<double>(ageDouble));
+            m_age = Seconds { ageDouble };
         m_haveParsedAgeHeader = true;
     }
     return m_age;
 }
 
         m_haveParsedAgeHeader = true;
     }
     return m_age;
 }
 
-std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::expires() const
+std::optional<WallTime> ResourceResponseBase::expires() const
 {
     lazyInit(CommonFieldsOnly);
 
 {
     lazyInit(CommonFieldsOnly);
 
@@ -538,7 +536,7 @@ std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::expir
     return m_expires;
 }
 
     return m_expires;
 }
 
-std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::lastModified() const
+std::optional<WallTime> ResourceResponseBase::lastModified() const
 {
     lazyInit(CommonFieldsOnly);
 
 {
     lazyInit(CommonFieldsOnly);
 
@@ -547,7 +545,7 @@ std::optional<std::chrono::system_clock::time_point> ResourceResponseBase::lastM
 #if PLATFORM(COCOA)
         // CFNetwork converts malformed dates into Epoch so we need to treat Epoch as
         // an invalid value (rdar://problem/22352838).
 #if PLATFORM(COCOA)
         // CFNetwork converts malformed dates into Epoch so we need to treat Epoch as
         // an invalid value (rdar://problem/22352838).
-        const std::chrono::system_clock::time_point epoch;
+        const WallTime epoch = WallTime::fromRawSeconds(0);
         if (m_lastModified && m_lastModified.value() == epoch)
             m_lastModified = std::nullopt;
 #endif
         if (m_lastModified && m_lastModified.value() == epoch)
             m_lastModified = std::nullopt;
 #endif
index 12a82a4..f1b3821 100644 (file)
@@ -33,6 +33,7 @@
 #include "ParsedContentRange.h"
 #include "URL.h"
 #include <wtf/SHA1.h>
 #include "ParsedContentRange.h"
 #include "URL.h"
 #include <wtf/SHA1.h>
+#include <wtf/WallTime.h>
 
 namespace WebCore {
 
 
 namespace WebCore {
 
@@ -130,11 +131,11 @@ public:
     WEBCORE_EXPORT bool cacheControlContainsMustRevalidate() const;
     WEBCORE_EXPORT bool cacheControlContainsImmutable() const;
     WEBCORE_EXPORT bool hasCacheValidatorFields() const;
     WEBCORE_EXPORT bool cacheControlContainsMustRevalidate() const;
     WEBCORE_EXPORT bool cacheControlContainsImmutable() const;
     WEBCORE_EXPORT bool hasCacheValidatorFields() const;
-    WEBCORE_EXPORT std::optional<std::chrono::microseconds> cacheControlMaxAge() const;
-    WEBCORE_EXPORT std::optional<std::chrono::system_clock::time_point> date() const;
-    WEBCORE_EXPORT std::optional<std::chrono::microseconds> age() const;
-    WEBCORE_EXPORT std::optional<std::chrono::system_clock::time_point> expires() const;
-    WEBCORE_EXPORT std::optional<std::chrono::system_clock::time_point> lastModified() const;
+    WEBCORE_EXPORT std::optional<Seconds> cacheControlMaxAge() const;
+    WEBCORE_EXPORT std::optional<WallTime> date() const;
+    WEBCORE_EXPORT std::optional<Seconds> age() const;
+    WEBCORE_EXPORT std::optional<WallTime> expires() const;
+    WEBCORE_EXPORT std::optional<WallTime> lastModified() const;
     ParsedContentRange& contentRange() const;
 
     enum class Source { Unknown, Network, DiskCache, DiskCacheAfterValidation, MemoryCache, MemoryCacheAfterValidation, ServiceWorker };
     ParsedContentRange& contentRange() const;
 
     enum class Source { Unknown, Network, DiskCache, DiskCacheAfterValidation, MemoryCache, MemoryCacheAfterValidation, ServiceWorker };
@@ -211,10 +212,10 @@ protected:
     int m_httpStatusCode;
 
 private:
     int m_httpStatusCode;
 
 private:
-    mutable std::optional<std::chrono::microseconds> m_age;
-    mutable std::optional<std::chrono::system_clock::time_point> m_date;
-    mutable std::optional<std::chrono::system_clock::time_point> m_expires;
-    mutable std::optional<std::chrono::system_clock::time_point> m_lastModified;
+    mutable std::optional<Seconds> m_age;
+    mutable std::optional<WallTime> m_date;
+    mutable std::optional<WallTime> m_expires;
+    mutable std::optional<WallTime> m_lastModified;
     mutable ParsedContentRange m_contentRange;
     mutable CacheControlDirectives m_cacheControlDirectives;
 
     mutable ParsedContentRange m_contentRange;
     mutable CacheControlDirectives m_cacheControlDirectives;
 
index cf34d05..0ca2287 100644 (file)
@@ -316,7 +316,7 @@ void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vecto
 {
 }
 
 {
 }
 
-void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
+void deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime)
 {
 }
 
 {
 }
 
index a13d05b..e3b728b 100644 (file)
@@ -339,7 +339,7 @@ void CookieJarCurlFileSystem::deleteAllCookies(const NetworkStorageSession&)
     // FIXME: Not yet implemented
 }
 
     // FIXME: Not yet implemented
 }
 
-void CookieJarCurlFileSystem::deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point)
+void CookieJarCurlFileSystem::deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime)
 {
     // FIXME: Not yet implemented
 }
 {
     // FIXME: Not yet implemented
 }
@@ -391,7 +391,7 @@ void deleteAllCookies(const NetworkStorageSession& session)
     CurlContext::singleton().cookieJar().deleteAllCookies(session);
 }
 
     CurlContext::singleton().cookieJar().deleteAllCookies(session);
 }
 
-void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point since)
+void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, WallTime since)
 {
     CurlContext::singleton().cookieJar().deleteAllCookiesModifiedSince(session, since);
 }
 {
     CurlContext::singleton().cookieJar().deleteAllCookiesModifiedSince(session, since);
 }
index 2fa924f..a52fd78 100644 (file)
@@ -37,7 +37,7 @@ public:
     virtual void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) = 0;
     virtual void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) = 0;
     virtual void deleteAllCookies(const NetworkStorageSession&) = 0;
     virtual void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) = 0;
     virtual void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) = 0;
     virtual void deleteAllCookies(const NetworkStorageSession&) = 0;
-    virtual void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point) = 0;
+    virtual void deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime) = 0;
 };
 
 class CookieJarCurlFileSystem : public CookieJarCurl {
 };
 
 class CookieJarCurlFileSystem : public CookieJarCurl {
@@ -50,7 +50,7 @@ class CookieJarCurlFileSystem : public CookieJarCurl {
     void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) override;
     void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) override;
     void deleteAllCookies(const NetworkStorageSession&) override;
     void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) override;
     void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames) override;
     void deleteAllCookies(const NetworkStorageSession&) override;
-    void deleteAllCookiesModifiedSince(const NetworkStorageSession&, std::chrono::system_clock::time_point) override;
+    void deleteAllCookiesModifiedSince(const NetworkStorageSession&, WallTime) override;
 };
 
 } // namespace WebCore
 };
 
 } // namespace WebCore
index b7da373..cf5f8e6 100644 (file)
@@ -52,7 +52,7 @@ CurlCacheEntry::CurlCacheEntry(const String& url, ResourceHandle* job, const Str
     , m_contentFilename(cacheDir)
     , m_contentFile(FileSystem::invalidPlatformFileHandle)
     , m_entrySize(0)
     , m_contentFilename(cacheDir)
     , m_contentFile(FileSystem::invalidPlatformFileHandle)
     , m_entrySize(0)
-    , m_expireDate(-1)
+    , m_expireDate(WallTime::fromRawSeconds(-1))
     , m_headerParsed(false)
     , m_isLoading(false)
     , m_job(job)
     , m_headerParsed(false)
     , m_isLoading(false)
     , m_job(job)
@@ -87,7 +87,7 @@ bool CurlCacheEntry::isCached()
             return false;
     }
 
             return false;
     }
 
-    if (m_expireDate < currentTimeMS()) {
+    if (m_expireDate < WallTime::now()) {
         m_headerParsed = false;
         return false;
     }
         m_headerParsed = false;
         return false;
     }
@@ -272,18 +272,16 @@ void CurlCacheEntry::invalidate()
 
 bool CurlCacheEntry::parseResponseHeaders(const ResourceResponse& response)
 {
 
 bool CurlCacheEntry::parseResponseHeaders(const ResourceResponse& response)
 {
-    using namespace std::chrono;
-
     if (response.cacheControlContainsNoCache() || response.cacheControlContainsNoStore() || !response.hasCacheValidatorFields())
         return false;
 
     if (response.cacheControlContainsNoCache() || response.cacheControlContainsNoStore() || !response.hasCacheValidatorFields())
         return false;
 
-    double fileTime;
+    WallTime fileTime;
     time_t fileModificationDate;
 
     time_t fileModificationDate;
 
-    if (FileSystem::getFileModificationTime(m_headerFilename, fileModificationDate))
-        fileTime = difftime(fileModificationDate, 0) * 1000.0;
+    if (auto fileTimeFromFile = FileSystem::getFileModificationTime(m_headerFilename))
+        fileTime = fileTimeFromFile.value();
     else
     else
-        fileTime = currentTimeMS(); // GMT
+        fileTime = WallTime::now(); // GMT
 
     auto maxAge = response.cacheControlMaxAge();
     auto lastModificationDate = response.lastModified();
 
     auto maxAge = response.cacheControlMaxAge();
     auto lastModificationDate = response.lastModified();
@@ -292,24 +290,19 @@ bool CurlCacheEntry::parseResponseHeaders(const ResourceResponse& response)
 
     if (maxAge && !response.cacheControlContainsMustRevalidate()) {
         // When both the cache entry and the response contain max-age, the lesser one takes priority
 
     if (maxAge && !response.cacheControlContainsMustRevalidate()) {
         // When both the cache entry and the response contain max-age, the lesser one takes priority
-        auto maxAgeMS = duration_cast<milliseconds>(maxAge.value()).count();
-        double expires = fileTime + maxAgeMS;
-        if (m_expireDate == -1 || m_expireDate > expires)
+        WallTime expires = fileTime + *maxAge;
+        if (m_expireDate == WallTime::fromRawSeconds(-1) || m_expireDate > expires)
             m_expireDate = expires;
     } else if (responseDate && expirationDate) {
             m_expireDate = expires;
     } else if (responseDate && expirationDate) {
-        auto expirationDateMS = duration_cast<milliseconds>(expirationDate.value().time_since_epoch()).count();
-        auto responseDateMS = duration_cast<milliseconds>(responseDate.value().time_since_epoch()).count();
-        if (expirationDateMS >= responseDateMS)
-            m_expireDate = fileTime + (expirationDateMS - responseDateMS);
+        if (*expirationDate >= *responseDate)
+            m_expireDate = fileTime + (*expirationDate - *responseDate);
     }
     // If there is no lifetime information
     }
     // If there is no lifetime information
-    if (m_expireDate == -1) {
-        if (lastModificationDate) {
-            auto lastModificationDateMS = duration_cast<milliseconds>(lastModificationDate.value().time_since_epoch()).count();
-            m_expireDate = fileTime + (fileTime - lastModificationDateMS) * 0.1;
-        }
+    if (m_expireDate == WallTime::fromRawSeconds(-1)) {
+        if (lastModificationDate)
+            m_expireDate = fileTime + (fileTime - *lastModificationDate) * 0.1;
         else
         else
-            m_expireDate = 0;
+            m_expireDate = WallTime::fromRawSeconds(0);
     }
 
     String etag = response.httpHeaderField(HTTPHeaderName::ETag);
     }
 
     String etag = response.httpHeaderField(HTTPHeaderName::ETag);
index 81cbc71..cbc45fe 100644 (file)
@@ -78,7 +78,7 @@ private:
     FileSystem::PlatformFileHandle m_contentFile;
 
     size_t m_entrySize;
     FileSystem::PlatformFileHandle m_contentFile;
 
     size_t m_entrySize;
-    double m_expireDate;
+    WallTime m_expireDate;
     bool m_headerParsed;
     bool m_isLoading;
     ListHashSet<ResourceHandle*> m_clients;
     bool m_headerParsed;
     bool m_isLoading;
     ListHashSet<ResourceHandle*> m_clients;
index 4963906..6eec368 100644 (file)
@@ -377,12 +377,12 @@ void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vecto
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point timePoint)
+void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, WallTime timePoint)
 {
     if (![NSHTTPCookieStorage instancesRespondToSelector:@selector(removeCookiesSinceDate:)])
         return;
 
 {
     if (![NSHTTPCookieStorage instancesRespondToSelector:@selector(removeCookiesSinceDate:)])
         return;
 
-    NSTimeInterval timeInterval = std::chrono::duration_cast<std::chrono::duration<double>>(timePoint.time_since_epoch()).count();
+    NSTimeInterval timeInterval = timePoint.secondsSinceEpoch().seconds();
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
 
     auto *storage = session.nsCookieStorage();
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
 
     auto *storage = session.nsCookieStorage();
index 19752af..96bec16 100644 (file)
@@ -220,10 +220,10 @@ void deleteAllCookies(const NetworkStorageSession& session)
     }
 }
 
     }
 }
 
-void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, std::chrono::system_clock::time_point timestamp)
+void deleteAllCookiesModifiedSince(const NetworkStorageSession& session, WallTime timestamp)
 {
     // FIXME: Add support for deleting cookies modified since the given timestamp. It should probably be added to libsoup.
 {
     // FIXME: Add support for deleting cookies modified since the given timestamp. It should probably be added to libsoup.
-    if (timestamp == std::chrono::system_clock::from_time_t(0))
+    if (timestamp == WallTime::fromRawSeconds(0))
         deleteAllCookies(session);
     else
         g_warning("Deleting cookies modified since a given time span is not supported yet");
         deleteAllCookies(session);
     else
         g_warning("Deleting cookies modified since a given time span is not supported yet");
index 73b684d..e99151a 100644 (file)
@@ -92,7 +92,7 @@ void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<Rec
         CFStringRef item = (CFStringRef)CFArrayGetValueAtIndex(items.get(), i);
         if (CFGetTypeID(item) == CFStringGetTypeID()) {
             // We are choosing not to use or store search times on Windows at this time, so for now it's OK to use a "distant past" time as a placeholder.
         CFStringRef item = (CFStringRef)CFArrayGetValueAtIndex(items.get(), i);
         if (CFGetTypeID(item) == CFStringGetTypeID()) {
             // We are choosing not to use or store search times on Windows at this time, so for now it's OK to use a "distant past" time as a placeholder.
-            searchItems.append({ String{ item }, std::chrono::system_clock::time_point::min() });
+            searchItems.append({ String{ item }, -WallTime::infinity() });
         }
     }
 #endif
         }
     }
 #endif
index d430604..88fd64a 100644 (file)
@@ -100,7 +100,7 @@ void RenderSearchField::addSearchResult()
         return recentSearch.string == value;
     });
 
         return recentSearch.string == value;
     });
 
-    RecentSearch recentSearch = { value, std::chrono::system_clock::now() };
+    RecentSearch recentSearch = { value, WallTime::now() };
     m_recentSearches.insert(0, recentSearch);
     while (static_cast<int>(m_recentSearches.size()) > inputElement().maxResults())
         m_recentSearches.removeLast();
     m_recentSearches.insert(0, recentSearch);
     while (static_cast<int>(m_recentSearches.size()) > inputElement().maxResults())
         m_recentSearches.removeLast();
index e166f3b..e3ed6fa 100644 (file)
@@ -1,3 +1,164 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        Use MonotonicTime, WallTime, and Seconds instead.
+        Changes are mechanical ones.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::deleteWebsiteData):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
+        (WebKit::CacheStorage::Caches::clear):
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::responseHasExpired):
+        (WebKit::NetworkCache::responseNeedsRevalidation):
+        (WebKit::NetworkCache::makeStoreDecision):
+        (WebKit::NetworkCache::Cache::clear):
+        (WebKit::NetworkCache::Cache::storeData):
+        * NetworkProcess/cache/NetworkCache.h:
+        * NetworkProcess/cache/NetworkCacheEntry.cpp:
+        (WebKit::NetworkCache::Entry::Entry):
+        (WebKit::NetworkCache::Entry::asJSON const):
+        * NetworkProcess/cache/NetworkCacheEntry.h:
+        (WebKit::NetworkCache::Entry::timeStamp const):
+        * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
+        (WebKit::NetworkCache::fileTimes):
+        (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
+        * NetworkProcess/cache/NetworkCacheFileSystem.h:
+        * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
+        (WebKit::NetworkCache::IOChannel::IOChannel):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::responseNeedsRevalidation):
+        (WebKit::NetworkCache::canRevalidate):
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::Storage::readRecord):
+        (WebKit::NetworkCache::Storage::clear):
+        (WebKit::NetworkCache::computeRecordWorth):
+        * NetworkProcess/cache/NetworkCacheStorage.h:
+        Bump the cache version. We now change the data in persistent cache.
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
+        (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
+        (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
+        (WebKit::NetworkCache::SubresourceInfo::lastSeen const):
+        (WebKit::NetworkCache::SubresourceInfo::firstSeen const):
+        (WebKit::NetworkCache::SubresourcesEntry::timeStamp const):
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::clearHSTSCache):
+        (WebKit::clearNSURLCache):
+        (WebKit::NetworkProcess::clearDiskCache):
+        * NetworkProcess/curl/NetworkProcessCurl.cpp:
+        (WebKit::NetworkProcess::clearDiskCache):
+        * NetworkProcess/mac/NetworkProcessMac.mm:
+        (WebKit::NetworkProcess::clearCacheForAllOrigins):
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::clearCacheForAllOrigins):
+        (WebKit::NetworkProcess::clearDiskCache):
+        * Platform/IPC/ArgumentCoders.cpp:
+        (IPC::ArgumentCoder<WallTime>::encode):
+        (IPC::ArgumentCoder<WallTime>::decode):
+        (IPC::ArgumentCoder<std::chrono::system_clock::time_point>::encode): Deleted.
+        (IPC::ArgumentCoder<std::chrono::system_clock::time_point>::decode): Deleted.
+        * Platform/IPC/ArgumentCoders.h:
+        * PluginProcess/PluginProcess.cpp:
+        (WebKit::PluginProcess::deleteWebsiteData):
+        * PluginProcess/PluginProcess.h:
+        * PluginProcess/PluginProcess.messages.in:
+        * Scripts/webkit/messages.py:
+        (headers_for_type):
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
+        (WebKit::RemoteLayerBackingStore::lastDisplayTime const):
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::RemoteLayerBackingStore):
+        (WebKit::RemoteLayerBackingStore::display):
+        * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
+        * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm:
+        (WebKit::RemoteLayerBackingStoreCollection::markBackingStoreVolatile):
+        (WebKit::RemoteLayerBackingStoreCollection::volatilityTimerFired):
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<RecentSearch>::decode):
+        (IPC::ArgumentCoder<WallTime>::encode): Deleted.
+        (IPC::ArgumentCoder<WallTime>::decode): Deleted.
+        * Shared/WebCoreArgumentCoders.h:
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::deleteWebsiteData):
+        * StorageProcess/StorageProcess.h:
+        * StorageProcess/StorageProcess.messages.in:
+        * UIProcess/API/C/WKApplicationCacheManager.cpp:
+        (WKApplicationCacheManagerDeleteAllEntries):
+        * UIProcess/API/C/WKCookieManager.cpp:
+        (WKCookieManagerDeleteAllCookiesModifiedAfterDate):
+        * UIProcess/API/C/WKKeyValueStorageManager.cpp:
+        (WKKeyValueStorageManagerDeleteAllEntries):
+        * UIProcess/API/C/WKResourceCacheManager.cpp:
+        (WKResourceCacheManagerClearCacheForAllOrigins):
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+        (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
+        (WKWebsiteDataStoreRemoveAllFetchCaches):
+        (WKWebsiteDataStoreRemoveAllIndexedDatabases):
+        (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (toSystemClockTime):
+        (-[WKWebsiteDataStore _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours:]):
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkit_web_context_clear_cache):
+        * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
+        (webkit_website_data_manager_clear):
+        * UIProcess/DrawingAreaProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::deleteWebsiteData):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Plugins/PluginProcessManager.cpp:
+        (WebKit::PluginProcessManager::deleteWebsiteData):
+        * UIProcess/Plugins/PluginProcessManager.h:
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::deleteWebsiteData):
+        * UIProcess/Plugins/PluginProcessProxy.h:
+        * UIProcess/Storage/StorageProcessProxy.cpp:
+        (WebKit::StorageProcessProxy::deleteWebsiteData):
+        * UIProcess/Storage/StorageProcessProxy.h:
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
+        * UIProcess/WebCookieManagerProxy.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::deleteWebsiteData):
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+        * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
+        (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
+        * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
+        * UIProcess/WebStorage/StorageManager.cpp:
+        (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
+        * UIProcess/WebStorage/StorageManager.h:
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::removeData):
+        (WebKit::WebsiteDataStore::removeMediaKeys):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
+        * UIProcess/wpe/WebPageProxyWPE.cpp:
+        (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
+        * WebProcess/Cookies/WebCookieManager.cpp:
+        (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
+        * WebProcess/Cookies/WebCookieManager.h:
+        * WebProcess/Cookies/WebCookieManager.messages.in:
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::lastModifiedDateMS):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::deleteWebsiteData):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
index 4ded64a..0b32641 100644 (file)
@@ -456,7 +456,7 @@ void NetworkProcess::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<Websit
     }
 }
 
     }
 }
 
-void NetworkProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+void NetworkProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince, uint64_t callbackID)
 {
 #if PLATFORM(COCOA)
     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
 {
 #if PLATFORM(COCOA)
     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
index 67d2804..91a61a8 100644 (file)
@@ -116,7 +116,7 @@ public:
 
 #if PLATFORM(COCOA)
     RetainPtr<CFDataRef> sourceApplicationAuditData() const;
 
 #if PLATFORM(COCOA)
     RetainPtr<CFDataRef> sourceApplicationAuditData() const;
-    void clearHSTSCache(WebCore::NetworkStorageSession&, std::chrono::system_clock::time_point modifiedSince);
+    void clearHSTSCache(WebCore::NetworkStorageSession&, WallTime modifiedSince);
 #endif
 
 #if USE(NETWORK_SESSION)
 #endif
 
 #if USE(NETWORK_SESSION)
@@ -197,13 +197,13 @@ private:
     void destroySession(PAL::SessionID);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, uint64_t callbackID);
     void destroySession(PAL::SessionID);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, uint64_t callbackID);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, uint64_t callbackID);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID);
 
     void clearCachedCredentials();
 
     // FIXME: This should take a session ID so we can identify which disk cache to delete.
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID);
 
     void clearCachedCredentials();
 
     // FIXME: This should take a session ID so we can identify which disk cache to delete.
-    void clearDiskCache(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler);
+    void clearDiskCache(WallTime modifiedSince, Function<void ()>&& completionHandler);
 
     void downloadRequest(PAL::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedFilename);
     void resumeDownload(PAL::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, SandboxExtension::Handle&&);
 
     void downloadRequest(PAL::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedFilename);
     void resumeDownload(PAL::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, SandboxExtension::Handle&&);
index 5bede8e..fd2118a 100644 (file)
@@ -39,7 +39,7 @@ messages -> NetworkProcess LegacyReceiver {
     DestroySession(PAL::SessionID sessionID)
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, OptionSet<WebKit::WebsiteDataFetchOption> fetchOptions, uint64_t callbackID)
     DestroySession(PAL::SessionID sessionID)
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, OptionSet<WebKit::WebsiteDataFetchOption> fetchOptions, uint64_t callbackID)
-    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, WallTime modifiedSince, uint64_t callbackID)
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, Vector<String> cookieHostNames, uint64_t callbackID)
 
     DownloadRequest(PAL::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, String suggestedFilename)
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, Vector<String> cookieHostNames, uint64_t callbackID)
 
     DownloadRequest(PAL::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, String suggestedFilename)
index 4689845..a2f1970 100644 (file)
@@ -194,7 +194,7 @@ void Caches::clear(CompletionHandler<void()>&& completionHandler)
     if (m_engine)
         m_engine->removeFile(cachesListFilename(m_rootPath));
     if (m_storage) {
     if (m_engine)
         m_engine->removeFile(cachesListFilename(m_rootPath));
     if (m_storage) {
-        m_storage->clear(String { }, std::chrono::system_clock::time_point::min(), [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
+        m_storage->clear(String { }, -WallTime::infinity(), [protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
             ASSERT(RunLoop::isMain());
             protectedThis->clearMemoryRepresentation();
             completionHandler();
             ASSERT(RunLoop::isMain());
             protectedThis->clearMemoryRepresentation();
             completionHandler();
index cefcf66..73a25f4 100644 (file)
@@ -48,7 +48,6 @@
 #include <notify.h>
 #endif
 
 #include <notify.h>
 #endif
 
-using namespace std::literals::chrono_literals;
 using namespace WebCore::FileSystem;
 
 namespace WebKit {
 using namespace WebCore::FileSystem;
 
 namespace WebKit {
@@ -154,7 +153,7 @@ static bool cachePolicyAllowsExpired(WebCore::ResourceRequestCachePolicy policy)
     return false;
 }
 
     return false;
 }
 
-static bool responseHasExpired(const WebCore::ResourceResponse& response, std::chrono::system_clock::time_point timestamp, std::optional<std::chrono::microseconds> maxStale)
+static bool responseHasExpired(const WebCore::ResourceResponse& response, WallTime timestamp, std::optional<Seconds> maxStale)
 {
     if (response.cacheControlContainsNoCache())
         return true;
 {
     if (response.cacheControlContainsNoCache())
         return true;
@@ -162,7 +161,7 @@ static bool responseHasExpired(const WebCore::ResourceResponse& response, std::c
     auto age = WebCore::computeCurrentAge(response, timestamp);
     auto lifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(response, timestamp);
 
     auto age = WebCore::computeCurrentAge(response, timestamp);
     auto lifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(response, timestamp);
 
-    auto maximumStaleness = maxStale ? maxStale.value() : 0ms;
+    auto maximumStaleness = maxStale ? maxStale.value() : 0_ms;
     bool hasExpired = age - lifetime > maximumStaleness;
 
 #ifndef LOG_DISABLED
     bool hasExpired = age - lifetime > maximumStaleness;
 
 #ifndef LOG_DISABLED
@@ -173,13 +172,13 @@ static bool responseHasExpired(const WebCore::ResourceResponse& response, std::c
     return hasExpired;
 }
 
     return hasExpired;
 }
 
-static bool responseNeedsRevalidation(const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, std::chrono::system_clock::time_point timestamp)
+static bool responseNeedsRevalidation(const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, WallTime timestamp)
 {
     auto requestDirectives = WebCore::parseCacheControlDirectives(request.httpHeaderFields());
     if (requestDirectives.noCache)
         return true;
     // For requests we ignore max-age values other than zero.
 {
     auto requestDirectives = WebCore::parseCacheControlDirectives(request.httpHeaderFields());
     if (requestDirectives.noCache)
         return true;
     // For requests we ignore max-age values other than zero.
-    if (requestDirectives.maxAge && requestDirectives.maxAge.value() == 0ms)
+    if (requestDirectives.maxAge && requestDirectives.maxAge.value() == 0_ms)
         return true;
 
     return responseHasExpired(response, timestamp, requestDirectives.maxStale);
         return true;
 
     return responseHasExpired(response, timestamp, requestDirectives.maxStale);
@@ -279,8 +278,8 @@ static StoreDecision makeStoreDecision(const WebCore::ResourceRequest& originalR
     bool isMainResource = originalRequest.requester() == WebCore::ResourceRequest::Requester::Main;
     bool storeUnconditionallyForHistoryNavigation = isMainResource || originalRequest.priority() == WebCore::ResourceLoadPriority::VeryHigh;
     if (!storeUnconditionallyForHistoryNavigation) {
     bool isMainResource = originalRequest.requester() == WebCore::ResourceRequest::Requester::Main;
     bool storeUnconditionallyForHistoryNavigation = isMainResource || originalRequest.priority() == WebCore::ResourceLoadPriority::VeryHigh;
     if (!storeUnconditionallyForHistoryNavigation) {
-        auto now = std::chrono::system_clock::now();
-        bool hasNonZeroLifetime = !response.cacheControlContainsNoCache() && WebCore::computeFreshnessLifetimeForHTTPFamily(response, now) > 0ms;
+        auto now = WallTime::now();
+        bool hasNonZeroLifetime = !response.cacheControlContainsNoCache() && WebCore::computeFreshnessLifetimeForHTTPFamily(response, now) > 0_ms;
 
         bool possiblyReusable = response.hasCacheValidatorFields() || hasNonZeroLifetime;
         if (!possiblyReusable)
 
         bool possiblyReusable = response.hasCacheValidatorFields() || hasNonZeroLifetime;
         if (!possiblyReusable)
@@ -598,7 +597,7 @@ void Cache::deleteDumpFile()
     });
 }
 
     });
 }
 
-void Cache::clear(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler)
+void Cache::clear(WallTime modifiedSince, Function<void ()>&& completionHandler)
 {
     LOG(NetworkCache, "(NetworkProcess) clearing cache");
 
 {
     LOG(NetworkCache, "(NetworkProcess) clearing cache");
 
@@ -613,7 +612,7 @@ void Cache::clear(std::chrono::system_clock::time_point modifiedSince, Function<
 
 void Cache::clear()
 {
 
 void Cache::clear()
 {
-    clear(std::chrono::system_clock::time_point::min(), nullptr);
+    clear(-WallTime::infinity(), nullptr);
 }
 
 String Cache::recordsPath() const
 }
 
 String Cache::recordsPath() const
@@ -637,7 +636,7 @@ void Cache::retrieveData(const DataKey& dataKey, Function<void (const uint8_t* d
 void Cache::storeData(const DataKey& dataKey, const uint8_t* data, size_t size)
 {
     Key key { dataKey, m_storage->salt() };
 void Cache::storeData(const DataKey& dataKey, const uint8_t* data, size_t size)
 {
     Key key { dataKey, m_storage->salt() };
-    Storage::Record record { key, std::chrono::system_clock::now(), { }, Data { data, size }, { } };
+    Storage::Record record { key, WallTime::now(), { }, Data { data, size }, { } };
     m_storage->store(record, { });
 }
 
     m_storage->store(record, { });
 }
 
index 65a1b7b..e79077a 100644 (file)
@@ -117,7 +117,7 @@ public:
     void remove(const Vector<Key>&, Function<void ()>&&);
 
     void clear();
     void remove(const Vector<Key>&, Function<void ()>&&);
 
     void clear();
-    void clear(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler);
+    void clear(WallTime modifiedSince, Function<void ()>&& completionHandler);
 
     void retrieveData(const DataKey&, Function<void (const uint8_t* data, size_t size)>);
     void storeData(const DataKey&,  const uint8_t* data, size_t);
 
     void retrieveData(const DataKey&, Function<void (const uint8_t* data, size_t size)>);
     void storeData(const DataKey&,  const uint8_t* data, size_t);
index 72db618..ef33e7b 100644 (file)
@@ -38,7 +38,7 @@ namespace NetworkCache {
 
 Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, RefPtr<WebCore::SharedBuffer>&& buffer, const Vector<std::pair<String, String>>& varyingRequestHeaders)
     : m_key(key)
 
 Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, RefPtr<WebCore::SharedBuffer>&& buffer, const Vector<std::pair<String, String>>& varyingRequestHeaders)
     : m_key(key)
-    , m_timeStamp(std::chrono::system_clock::now())
+    , m_timeStamp(WallTime::now())
     , m_response(response)
     , m_varyingRequestHeaders(varyingRequestHeaders)
     , m_buffer(WTFMove(buffer))
     , m_response(response)
     , m_varyingRequestHeaders(varyingRequestHeaders)
     , m_buffer(WTFMove(buffer))
@@ -48,7 +48,7 @@ Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, RefPtr<W
 
 Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& redirectRequest, const Vector<std::pair<String, String>>& varyingRequestHeaders)
     : m_key(key)
 
 Entry::Entry(const Key& key, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& redirectRequest, const Vector<std::pair<String, String>>& varyingRequestHeaders)
     : m_key(key)
-    , m_timeStamp(std::chrono::system_clock::now())
+    , m_timeStamp(WallTime::now())
     , m_response(response)
     , m_varyingRequestHeaders(varyingRequestHeaders)
 {
     , m_response(response)
     , m_varyingRequestHeaders(varyingRequestHeaders)
 {
@@ -214,7 +214,7 @@ void Entry::asJSON(StringBuilder& json, const Storage::RecordInfo& info) const
     json.appendQuotedJSONString(m_key.partition());
     json.appendLiteral(",\n");
     json.appendLiteral("\"timestamp\": ");
     json.appendQuotedJSONString(m_key.partition());
     json.appendLiteral(",\n");
     json.appendLiteral("\"timestamp\": ");
-    json.appendNumber(std::chrono::duration_cast<std::chrono::milliseconds>(m_timeStamp.time_since_epoch()).count());
+    json.appendNumber(m_timeStamp.secondsSinceEpoch().milliseconds());
     json.appendLiteral(",\n");
     json.appendLiteral("\"URL\": ");
     json.appendQuotedJSONString(m_response.url().string());
     json.appendLiteral(",\n");
     json.appendLiteral("\"URL\": ");
     json.appendQuotedJSONString(m_response.url().string());
index 82ed889..53edef7 100644 (file)
@@ -52,7 +52,7 @@ public:
     static std::unique_ptr<Entry> decodeStorageRecord(const Storage::Record&);
 
     const Key& key() const { return m_key; }
     static std::unique_ptr<Entry> decodeStorageRecord(const Storage::Record&);
 
     const Key& key() const { return m_key; }
-    std::chrono::system_clock::time_point timeStamp() const { return m_timeStamp; }
+    WallTime timeStamp() const { return m_timeStamp; }
     const WebCore::ResourceResponse& response() const { return m_response; }
     const Vector<std::pair<String, String>>& varyingRequestHeaders() const { return m_varyingRequestHeaders; }
 
     const WebCore::ResourceResponse& response() const { return m_response; }
     const Vector<std::pair<String, String>>& varyingRequestHeaders() const { return m_varyingRequestHeaders; }
 
@@ -77,7 +77,7 @@ private:
 #endif
 
     Key m_key;
 #endif
 
     Key m_key;
-    std::chrono::system_clock::time_point m_timeStamp;
+    WallTime m_timeStamp;
     WebCore::ResourceResponse m_response;
     Vector<std::pair<String, String>> m_varyingRequestHeaders;
 
     WebCore::ResourceResponse m_response;
     Vector<std::pair<String, String>> m_varyingRequestHeaders;
 
index ee6d14e..b8fb7c9 100644 (file)
@@ -104,7 +104,7 @@ FileTimes fileTimes(const String& path)
     struct stat fileInfo;
     if (stat(WebCore::FileSystem::fileSystemRepresentation(path).data(), &fileInfo))
         return { };
     struct stat fileInfo;
     if (stat(WebCore::FileSystem::fileSystemRepresentation(path).data(), &fileInfo))
         return { };
-    return { std::chrono::system_clock::from_time_t(fileInfo.st_birthtime), std::chrono::system_clock::from_time_t(fileInfo.st_mtime) };
+    return { WallTime::fromRawSeconds(fileInfo.st_birthtime), WallTime::fromRawSeconds(fileInfo.st_mtime) };
 #elif USE(SOUP)
     // There's no st_birthtime in some operating systems like Linux, so we use xattrs to set/get the creation time.
     GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(WebCore::FileSystem::fileSystemRepresentation(path).data()));
 #elif USE(SOUP)
     // There's no st_birthtime in some operating systems like Linux, so we use xattrs to set/get the creation time.
     GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(WebCore::FileSystem::fileSystemRepresentation(path).data()));
@@ -114,8 +114,8 @@ FileTimes fileTimes(const String& path)
     const char* birthtimeString = g_file_info_get_attribute_string(fileInfo.get(), "xattr::birthtime");
     if (!birthtimeString)
         return { };
     const char* birthtimeString = g_file_info_get_attribute_string(fileInfo.get(), "xattr::birthtime");
     if (!birthtimeString)
         return { };
-    return { std::chrono::system_clock::from_time_t(g_ascii_strtoull(birthtimeString, nullptr, 10)),
-        std::chrono::system_clock::from_time_t(g_file_info_get_attribute_uint64(fileInfo.get(), "time::modified")) };
+    return { WallTime::fromRawSeconds(g_ascii_strtoull(birthtimeString, nullptr, 10)),
+        WallTime::fromRawSeconds(g_file_info_get_attribute_uint64(fileInfo.get(), "time::modified")) };
 #endif
 }
 
 #endif
 }
 
@@ -124,7 +124,7 @@ void updateFileModificationTimeIfNeeded(const String& path)
     auto times = fileTimes(path);
     if (times.creation != times.modification) {
         // Don't update more than once per hour.
     auto times = fileTimes(path);
     if (times.creation != times.modification) {
         // Don't update more than once per hour.
-        if (std::chrono::system_clock::now() - times.modification < std::chrono::hours(1))
+        if (WallTime::now() - times.modification < 1_h)
             return;
     }
     // This really updates both the access time and the modification time.
             return;
     }
     // This really updates both the access time and the modification time.
index 13e96cf..807d049 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include <WebCore/FileSystem.h>
 #pragma once
 
 #include <WebCore/FileSystem.h>
-#include <chrono>
 
 namespace WebKit {
 namespace NetworkCache {
 
 namespace WebKit {
 namespace NetworkCache {
@@ -37,8 +36,8 @@ void traverseDirectory(const String& path, const Function<void (const String& fi
 void deleteDirectoryRecursively(const String& path);
 
 struct FileTimes {
 void deleteDirectoryRecursively(const String& path);
 
 struct FileTimes {
-    std::chrono::system_clock::time_point creation;
-    std::chrono::system_clock::time_point modification;
+    WallTime creation;
+    WallTime modification;
 };
 FileTimes fileTimes(const String& path);
 void updateFileModificationTimeIfNeeded(const String& path);
 };
 FileTimes fileTimes(const String& path);
 void updateFileModificationTimeIfNeeded(const String& path);
index 4ce7762..5392c79 100644 (file)
@@ -48,7 +48,7 @@ IOChannel::IOChannel(const String& filePath, Type type)
         g_file_delete(file.get(), nullptr, nullptr);
         m_outputStream = adoptGRef(G_OUTPUT_STREAM(g_file_create(file.get(), static_cast<GFileCreateFlags>(G_FILE_CREATE_PRIVATE), nullptr, nullptr)));
 #if !HAVE(STAT_BIRTHTIME)
         g_file_delete(file.get(), nullptr, nullptr);
         m_outputStream = adoptGRef(G_OUTPUT_STREAM(g_file_create(file.get(), static_cast<GFileCreateFlags>(G_FILE_CREATE_PRIVATE), nullptr, nullptr)));
 #if !HAVE(STAT_BIRTHTIME)
-        GUniquePtr<char> birthtimeString(g_strdup_printf("%" G_GUINT64_FORMAT, std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())));
+        GUniquePtr<char> birthtimeString(g_strdup_printf("%" G_GUINT64_FORMAT, WallTime::now().secondsSinceEpoch().secondsAs<uint64_t>()));
         g_file_set_attribute_string(file.get(), "xattr::birthtime", birthtimeString.get(), G_FILE_QUERY_INFO_NONE, nullptr, nullptr);
 #endif
         break;
         g_file_set_attribute_string(file.get(), "xattr::birthtime", birthtimeString.get(), G_FILE_QUERY_INFO_NONE, nullptr, nullptr);
 #endif
         break;
index ed80915..c53f7d2 100644 (file)
@@ -46,7 +46,6 @@ namespace WebKit {
 namespace NetworkCache {
 
 using namespace WebCore;
 namespace NetworkCache {
 
 using namespace WebCore;
-using namespace std::literals::chrono_literals;
 
 static const Seconds preloadedEntryLifetime { 10_s };
 
 
 static const Seconds preloadedEntryLifetime { 10_s };
 
@@ -111,14 +110,14 @@ static inline ResourceRequest constructRevalidationRequest(const Key& key, const
     return revalidationRequest;
 }
 
     return revalidationRequest;
 }
 
-static bool responseNeedsRevalidation(const ResourceResponse& response, std::chrono::system_clock::time_point timestamp)
+static bool responseNeedsRevalidation(const ResourceResponse& response, WallTime timestamp)
 {
     if (response.cacheControlContainsNoCache())
         return true;
 
     auto age = computeCurrentAge(response, timestamp);
     auto lifetime = computeFreshnessLifetimeForHTTPFamily(response, timestamp);
 {
     if (response.cacheControlContainsNoCache())
         return true;
 
     auto age = computeCurrentAge(response, timestamp);
     auto lifetime = computeFreshnessLifetimeForHTTPFamily(response, timestamp);
-    return age - lifetime > 0ms;
+    return age - lifetime > 0_ms;
 }
 
 class SpeculativeLoadManager::ExpiringEntry {
 }
 
 class SpeculativeLoadManager::ExpiringEntry {
@@ -495,24 +494,24 @@ static bool canRevalidate(const SubresourceInfo& subresourceInfo, const Entry* e
         return true;
     
     auto seenAge = subresourceInfo.lastSeen() - subresourceInfo.firstSeen();
         return true;
     
     auto seenAge = subresourceInfo.lastSeen() - subresourceInfo.firstSeen();
-    if (seenAge == 0ms) {
+    if (seenAge == 0_ms) {
         LOG(NetworkCacheSpeculativePreloading, "Speculative load: Seen only once");
         return false;
     }
     
         LOG(NetworkCacheSpeculativePreloading, "Speculative load: Seen only once");
         return false;
     }
     
-    auto now = std::chrono::system_clock::now();
+    auto now = WallTime::now();
     auto firstSeenAge = now - subresourceInfo.firstSeen();
     auto lastSeenAge = now - subresourceInfo.lastSeen();
     // Sanity check.
     auto firstSeenAge = now - subresourceInfo.firstSeen();
     auto lastSeenAge = now - subresourceInfo.lastSeen();
     // Sanity check.
-    if (seenAge <= 0ms || firstSeenAge <= 0ms || lastSeenAge <= 0ms)
+    if (seenAge <= 0_ms || firstSeenAge <= 0_ms || lastSeenAge <= 0_ms)
         return false;
     
     // Load full resources speculatively if they seem to stay the same.
     const auto minimumAgeRatioToLoad = 2. / 3;
     const auto recentMinimumAgeRatioToLoad = 1. / 3;
         return false;
     
     // Load full resources speculatively if they seem to stay the same.
     const auto minimumAgeRatioToLoad = 2. / 3;
     const auto recentMinimumAgeRatioToLoad = 1. / 3;
-    const auto recentThreshold = 5min;
+    const auto recentThreshold = 5_min;
     
     
-    auto ageRatio = std::chrono::duration_cast<std::chrono::duration<double>>(seenAge) / firstSeenAge;
+    auto ageRatio = seenAge / firstSeenAge;
     auto minimumAgeRatio = lastSeenAge > recentThreshold ? minimumAgeRatioToLoad : recentMinimumAgeRatioToLoad;
     
     LOG(NetworkCacheSpeculativePreloading, "Speculative load: ok=%d ageRatio=%f entry=%d", ageRatio > minimumAgeRatio, ageRatio, !!entry);
     auto minimumAgeRatio = lastSeenAge > recentThreshold ? minimumAgeRatioToLoad : recentMinimumAgeRatioToLoad;
     
     LOG(NetworkCacheSpeculativePreloading, "Speculative load: ok=%d ageRatio=%f entry=%d", ageRatio > minimumAgeRatio, ageRatio, !!entry);
index 879f1dc..705e835 100644 (file)
@@ -379,7 +379,7 @@ struct RecordMetaData {
 
     unsigned cacheStorageVersion;
     Key key;
 
     unsigned cacheStorageVersion;
     Key key;
-    std::chrono::system_clock::time_point timeStamp;
+    WallTime timeStamp;
     SHA1::Digest headerHash;
     uint64_t headerSize { 0 };
     SHA1::Digest bodyHash;
     SHA1::Digest headerHash;
     uint64_t headerSize { 0 };
     SHA1::Digest bodyHash;
@@ -453,7 +453,7 @@ void Storage::readRecord(ReadOperation& readOperation, const Data& recordData)
         return;
 
     // Sanity check against time stamps in future.
         return;
 
     // Sanity check against time stamps in future.
-    if (metaData.timeStamp > std::chrono::system_clock::now())
+    if (metaData.timeStamp > WallTime::now())
         return;
 
     Data bodyData;
         return;
 
     Data bodyData;
@@ -947,7 +947,7 @@ void Storage::setCapacity(size_t capacity)
     shrinkIfNeeded();
 }
 
     shrinkIfNeeded();
 }
 
-void Storage::clear(const String& type, std::chrono::system_clock::time_point modifiedSinceTime, Function<void ()>&& completionHandler)
+void Storage::clear(const String& type, WallTime modifiedSinceTime, Function<void ()>&& completionHandler)
 {
     ASSERT(RunLoop::isMain());
     LOG(NetworkCacheStorage, "(NetworkProcess) clearing cache");
 {
     ASSERT(RunLoop::isMain());
     LOG(NetworkCacheStorage, "(NetworkProcess) clearing cache");
@@ -962,7 +962,7 @@ void Storage::clear(const String& type, std::chrono::system_clock::time_point mo
         auto recordsPath = this->recordsPath();
         traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
             auto filePath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
         auto recordsPath = this->recordsPath();
         traverseRecordsFiles(recordsPath, type, [modifiedSinceTime](const String& fileName, const String& hashString, const String& type, bool isBlob, const String& recordDirectoryPath) {
             auto filePath = WebCore::FileSystem::pathByAppendingComponent(recordDirectoryPath, fileName);
-            if (modifiedSinceTime > std::chrono::system_clock::time_point::min()) {
+            if (modifiedSinceTime > -WallTime::infinity()) {
                 auto times = fileTimes(filePath);
                 if (times.modification < modifiedSinceTime)
                     return;
                 auto times = fileTimes(filePath);
                 if (times.modification < modifiedSinceTime)
                     return;
@@ -984,19 +984,16 @@ void Storage::clear(const String& type, std::chrono::system_clock::time_point mo
 
 static double computeRecordWorth(FileTimes times)
 {
 
 static double computeRecordWorth(FileTimes times)
 {
-    using namespace std::chrono;
-    using namespace std::literals::chrono_literals;
-
-    auto age = system_clock::now() - times.creation;
+    auto age = WallTime::now() - times.creation;
     // File modification time is updated manually on cache read. We don't use access time since OS may update it automatically.
     auto accessAge = times.modification - times.creation;
 
     // For sanity.
     // File modification time is updated manually on cache read. We don't use access time since OS may update it automatically.
     auto accessAge = times.modification - times.creation;
 
     // For sanity.
-    if (age <= 0s || accessAge < 0s || accessAge > age)
+    if (age <= 0_s || accessAge < 0_s || accessAge > age)
         return 0;
 
     // We like old entries that have been accessed recently.
         return 0;
 
     // We like old entries that have been accessed recently.
-    return duration<double>(accessAge) / age;
+    return accessAge / age;
 }
 
 static double deletionProbability(FileTimes times, unsigned bodyShareCount)
 }
 
 static double deletionProbability(FileTimes times, unsigned bodyShareCount)
index 45ba8b0..b5f72aa 100644 (file)
@@ -34,6 +34,7 @@
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
 #include <wtf/Optional.h>
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
 #include <wtf/Optional.h>
+#include <wtf/WallTime.h>
 #include <wtf/WorkQueue.h>
 #include <wtf/text/WTFString.h>
 
 #include <wtf/WorkQueue.h>
 #include <wtf/text/WTFString.h>
 
@@ -51,7 +52,7 @@ public:
         WTF_MAKE_FAST_ALLOCATED;
     public:
         Key key;
         WTF_MAKE_FAST_ALLOCATED;
     public:
         Key key;
-        std::chrono::system_clock::time_point timeStamp;
+        WallTime timeStamp;
         Data header;
         Data body;
         std::optional<SHA1::Digest> bodyHash;
         Data header;
         Data body;
         std::optional<SHA1::Digest> bodyHash;
@@ -65,7 +66,7 @@ public:
 
     void remove(const Key&);
     void remove(const Vector<Key>&, Function<void ()>&&);
 
     void remove(const Key&);
     void remove(const Vector<Key>&, Function<void ()>&&);
-    void clear(const String& type, std::chrono::system_clock::time_point modifiedSinceTime, Function<void ()>&& completionHandler);
+    void clear(const String& type, WallTime modifiedSinceTime, Function<void ()>&& completionHandler);
 
     struct RecordInfo {
         size_t bodySize;
 
     struct RecordInfo {
         size_t bodySize;
@@ -86,7 +87,7 @@ public:
     size_t capacity() const { return m_capacity; }
     size_t approximateSize() const;
 
     size_t capacity() const { return m_capacity; }
     size_t approximateSize() const;
 
-    static const unsigned version = 11;
+    static const unsigned version = 12;
 #if PLATFORM(MAC)
     /// Allow the last stable version of the cache to co-exist with the latest development one.
     static const unsigned lastStableVersion = 11;
 #if PLATFORM(MAC)
     /// Allow the last stable version of the cache to co-exist with the latest development one.
     static const unsigned lastStableVersion = 11;
index 561e4e6..fc53ef0 100644 (file)
@@ -31,8 +31,6 @@
 #include "Logging.h"
 #include "NetworkCacheCoders.h"
 
 #include "Logging.h"
 #include "NetworkCacheCoders.h"
 
-using namespace std::chrono;
-
 namespace WebKit {
 namespace NetworkCache {
 
 namespace WebKit {
 namespace NetworkCache {
 
@@ -114,7 +112,7 @@ SubresourcesEntry::SubresourcesEntry(const Storage::Record& storageEntry)
 
 SubresourceInfo::SubresourceInfo(const Key& key, const WebCore::ResourceRequest& request, const SubresourceInfo* previousInfo)
     : m_key(key)
 
 SubresourceInfo::SubresourceInfo(const Key& key, const WebCore::ResourceRequest& request, const SubresourceInfo* previousInfo)
     : m_key(key)
-    , m_lastSeen(std::chrono::system_clock::now())
+    , m_lastSeen(WallTime::now())
     , m_firstSeen(previousInfo ? previousInfo->firstSeen() : m_lastSeen)
     , m_isTransient(!previousInfo)
     , m_firstPartyForCookies(request.firstPartyForCookies())
     , m_firstSeen(previousInfo ? previousInfo->firstSeen() : m_lastSeen)
     , m_isTransient(!previousInfo)
     , m_firstPartyForCookies(request.firstPartyForCookies())
@@ -158,7 +156,7 @@ static Vector<SubresourceInfo> makeSubresourceInfoVector(const Vector<std::uniqu
 
 SubresourcesEntry::SubresourcesEntry(Key&& key, const Vector<std::unique_ptr<SubresourceLoad>>& subresourceLoads)
     : m_key(WTFMove(key))
 
 SubresourcesEntry::SubresourcesEntry(Key&& key, const Vector<std::unique_ptr<SubresourceLoad>>& subresourceLoads)
     : m_key(WTFMove(key))
-    , m_timeStamp(std::chrono::system_clock::now())
+    , m_timeStamp(WallTime::now())
     , m_subresources(makeSubresourceInfoVector(subresourceLoads, nullptr))
 {
     ASSERT(m_key.type() == "SubResources");
     , m_subresources(makeSubresourceInfoVector(subresourceLoads, nullptr))
 {
     ASSERT(m_key.type() == "SubResources");
index c2d5da8..0b9156e 100644 (file)
@@ -46,8 +46,8 @@ public:
     SubresourceInfo(const Key&, const WebCore::ResourceRequest&, const SubresourceInfo* previousInfo);
 
     const Key& key() const { return m_key; }
     SubresourceInfo(const Key&, const WebCore::ResourceRequest&, const SubresourceInfo* previousInfo);
 
     const Key& key() const { return m_key; }
-    std::chrono::system_clock::time_point lastSeen() const { return m_lastSeen; }
-    std::chrono::system_clock::time_point firstSeen() const { return m_firstSeen; }
+    WallTime lastSeen() const { return m_lastSeen; }
+    WallTime firstSeen() const { return m_firstSeen; }
 
     bool isTransient() const { return m_isTransient; }
     const WebCore::URL& firstPartyForCookies() const { ASSERT(!m_isTransient); return m_firstPartyForCookies; }
 
     bool isTransient() const { return m_isTransient; }
     const WebCore::URL& firstPartyForCookies() const { ASSERT(!m_isTransient); return m_firstPartyForCookies; }
@@ -58,8 +58,8 @@ public:
 
 private:
     Key m_key;
 
 private:
     Key m_key;
-    std::chrono::system_clock::time_point m_lastSeen;
-    std::chrono::system_clock::time_point m_firstSeen;
+    WallTime m_lastSeen;
+    WallTime m_firstSeen;
     bool m_isTransient { false };
     WebCore::URL m_firstPartyForCookies;
     WebCore::HTTPHeaderMap m_requestHeaders;
     bool m_isTransient { false };
     WebCore::URL m_firstPartyForCookies;
     WebCore::HTTPHeaderMap m_requestHeaders;
@@ -88,14 +88,14 @@ public:
     static std::unique_ptr<SubresourcesEntry> decodeStorageRecord(const Storage::Record&);
 
     const Key& key() const { return m_key; }
     static std::unique_ptr<SubresourcesEntry> decodeStorageRecord(const Storage::Record&);
 
     const Key& key() const { return m_key; }
-    std::chrono::system_clock::time_point timeStamp() const { return m_timeStamp; }
+    WallTime timeStamp() const { return m_timeStamp; }
     const Vector<SubresourceInfo>& subresources() const { return m_subresources; }
 
     void updateSubresourceLoads(const Vector<std::unique_ptr<SubresourceLoad>>&);
 
 private:
     Key m_key;
     const Vector<SubresourceInfo>& subresources() const { return m_subresources; }
 
     void updateSubresourceLoads(const Vector<std::unique_ptr<SubresourceLoad>>&);
 
 private:
     Key m_key;
-    std::chrono::system_clock::time_point m_timeStamp;
+    WallTime m_timeStamp;
     Vector<SubresourceInfo> m_subresources;
 };
 
     Vector<SubresourceInfo> m_subresources;
 };
 
index 8632e58..d7573a2 100644 (file)
@@ -166,20 +166,20 @@ RetainPtr<CFDataRef> NetworkProcess::sourceApplicationAuditData() const
 #endif
 }
 
 #endif
 }
 
-void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& session, std::chrono::system_clock::time_point modifiedSince)
+void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& session, WallTime modifiedSince)
 {
 {
-    NSTimeInterval timeInterval = std::chrono::duration_cast<std::chrono::duration<double>>(modifiedSince.time_since_epoch()).count();
+    NSTimeInterval timeInterval = modifiedSince.secondsSinceEpoch().seconds();
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
 
     _CFNetworkResetHSTSHostsSinceDate(session.platformSession(), (__bridge CFDateRef)date);
 }
 
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
 
     _CFNetworkResetHSTSHostsSinceDate(session.platformSession(), (__bridge CFDateRef)date);
 }
 
-static void clearNSURLCache(dispatch_group_t group, std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler)
+static void clearNSURLCache(dispatch_group_t group, WallTime modifiedSince, Function<void ()>&& completionHandler)
 {
     dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), BlockPtr<void()>::fromCallable([modifiedSince, completionHandler = WTFMove(completionHandler)] () mutable {
         NSURLCache *cache = [NSURLCache sharedURLCache];
 
 {
     dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), BlockPtr<void()>::fromCallable([modifiedSince, completionHandler = WTFMove(completionHandler)] () mutable {
         NSURLCache *cache = [NSURLCache sharedURLCache];
 
-        NSTimeInterval timeInterval = std::chrono::duration_cast<std::chrono::duration<double>>(modifiedSince.time_since_epoch()).count();
+        NSTimeInterval timeInterval = modifiedSince.secondsSinceEpoch().seconds();
         NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
         [cache removeCachedResponsesSinceDate:date];
 
         NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
         [cache removeCachedResponsesSinceDate:date];
 
@@ -189,7 +189,7 @@ static void clearNSURLCache(dispatch_group_t group, std::chrono::system_clock::t
     }).get());
 }
 
     }).get());
 }
 
-void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler)
+void NetworkProcess::clearDiskCache(WallTime modifiedSince, Function<void ()>&& completionHandler)
 {
     if (!m_clearCacheDispatchGroup)
         m_clearCacheDispatchGroup = dispatch_group_create();
 {
     if (!m_clearCacheDispatchGroup)
         m_clearCacheDispatchGroup = dispatch_group_create();
index 69a82a7..b3fe6ba 100644 (file)
@@ -63,7 +63,7 @@ void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
     notImplemented();
 }
 
     notImplemented();
 }
 
-void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point, Function<void()>&&)
+void NetworkProcess::clearDiskCache(WallTime, Function<void()>&&)
 {
     notImplemented();
 }
 {
     notImplemented();
 }
index 562608c..517ba02 100644 (file)
@@ -127,7 +127,7 @@ void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
     if (resourceCachesToClear == InMemoryResourceCachesOnly)
         return;
 
     if (resourceCachesToClear == InMemoryResourceCachesOnly)
         return;
 
-    clearDiskCache(std::chrono::system_clock::time_point::min(), [] { });
+    clearDiskCache(-WallTime::infinity(), [] { });
 }
 
 void NetworkProcess::platformTerminate()
 }
 
 void NetworkProcess::platformTerminate()
index 4c8b4a4..ca2abb2 100644 (file)
@@ -153,10 +153,10 @@ void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
     if (cachesToClear == InMemoryResourceCachesOnly)
         return;
 
     if (cachesToClear == InMemoryResourceCachesOnly)
         return;
 
-    clearDiskCache(std::chrono::system_clock::time_point::min(), [] { });
+    clearDiskCache(-WallTime::infinity(), [] { });
 }
 
 }
 
-void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point modifiedSince, Function<void ()>&& completionHandler)
+void NetworkProcess::clearDiskCache(WallTime modifiedSince, Function<void ()>&& completionHandler)
 {
     if (!m_cache)
         return;
 {
     if (!m_cache)
         return;
index 38437fc..fe919b8 100644 (file)
 
 namespace IPC {
 
 
 namespace IPC {
 
-void ArgumentCoder<std::chrono::system_clock::time_point>::encode(IPC::Encoder& encoder, const std::chrono::system_clock::time_point& timePoint)
+void ArgumentCoder<WallTime>::encode(Encoder& encoder, const WallTime& time)
 {
 {
-    encoder << static_cast<int64_t>(timePoint.time_since_epoch().count());
+    encoder << time.secondsSinceEpoch().value();
 }
 
 }
 
-bool ArgumentCoder<std::chrono::system_clock::time_point>::decode(Decoder& decoder, std::chrono::system_clock::time_point& result)
+bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time)
 {
 {
-    int64_t time;
-    if (!decoder.decode(time))
+    double value;
+    if (!decoder.decode(value))
         return false;
 
         return false;
 
-    result = std::chrono::system_clock::time_point(std::chrono::system_clock::duration(static_cast<std::chrono::system_clock::rep>(time)));
+    time = WallTime::fromRawSeconds(value);
     return true;
 }
 
     return true;
 }
 
-std::optional<std::chrono::system_clock::time_point> ArgumentCoder<std::chrono::system_clock::time_point>::decode(Decoder& decoder)
+std::optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder)
 {
 {
-    std::optional<int64_t> time;
+    std::optional<double> time;
     decoder >> time;
     if (!time)
         return std::nullopt;
     decoder >> time;
     if (!time)
         return std::nullopt;
-    return { std::chrono::system_clock::time_point { std::chrono::system_clock::duration(static_cast<std::chrono::system_clock::rep>(*time)) }};
+    return WallTime::fromRawSeconds(*time);
 }
 }
-    
+
 void ArgumentCoder<AtomicString>::encode(Encoder& encoder, const AtomicString& atomicString)
 {
     encoder << atomicString.string();
 void ArgumentCoder<AtomicString>::encode(Encoder& encoder, const AtomicString& atomicString)
 {
     encoder << atomicString.string();
index 8384525..47fd98b 100644 (file)
 
 #include "Decoder.h"
 #include "Encoder.h"
 
 #include "Decoder.h"
 #include "Encoder.h"
-#include <chrono>
 #include <utility>
 #include <wtf/Forward.h>
 #include <wtf/SHA1.h>
 #include <utility>
 #include <wtf/Forward.h>
 #include <wtf/SHA1.h>
+#include <wtf/WallTime.h>
 
 namespace IPC {
 
 
 namespace IPC {
 
@@ -211,23 +211,6 @@ template<typename... Elements> struct ArgumentCoder<std::tuple<Elements...>> {
 };
 
 
 };
 
 
-template<typename Rep, typename Period> struct ArgumentCoder<std::chrono::duration<Rep, Period>> {
-    static void encode(Encoder& encoder, const std::chrono::duration<Rep, Period>& duration)
-    {
-        static_assert(std::is_integral<Rep>::value && std::is_signed<Rep>::value && sizeof(Rep) <= sizeof(int64_t), "Serialization of this Rep type is not supported yet. Only signed integer type which can be fit in an int64_t is currently supported.");
-        encoder << static_cast<int64_t>(duration.count());
-    }
-
-    static bool decode(Decoder& decoder, std::chrono::duration<Rep, Period>& result)
-    {
-        int64_t count;
-        if (!decoder.decode(count))
-            return false;
-        result = std::chrono::duration<Rep, Period>(static_cast<Rep>(count));
-        return true;
-    }
-};
-
 template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType>> {
     static void encode(Encoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair)
     {
 template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType>> {
     static void encode(Encoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair)
     {
@@ -518,10 +501,10 @@ template<typename ValueType, typename ErrorType> struct ArgumentCoder<Expected<V
     }
 };
 
     }
 };
 
-template<> struct ArgumentCoder<std::chrono::system_clock::time_point> {
-    static void encode(Encoder&, const std::chrono::system_clock::time_point&);
-    static bool decode(Decoder&, std::chrono::system_clock::time_point&);
-    static std::optional<std::chrono::system_clock::time_point> decode(Decoder&);
+template<> struct ArgumentCoder<WallTime> {
+    static void encode(Encoder&, const WallTime&);
+    static bool decode(Decoder&, WallTime&);
+    static std::optional<WallTime> decode(Decoder&);
 };
 
 template<> struct ArgumentCoder<AtomicString> {
 };
 
 template<> struct ArgumentCoder<AtomicString> {
index 7cc57e7..f7e9860 100644 (file)
@@ -192,13 +192,13 @@ void PluginProcess::getSitesWithData(uint64_t callbackID)
     parentProcessConnection()->send(Messages::PluginProcessProxy::DidGetSitesWithData(sites, callbackID), 0);
 }
 
     parentProcessConnection()->send(Messages::PluginProcessProxy::DidGetSitesWithData(sites, callbackID), 0);
 }
 
-void PluginProcess::deleteWebsiteData(std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+void PluginProcess::deleteWebsiteData(WallTime modifiedSince, uint64_t callbackID)
 {
     if (auto* module = netscapePluginModule()) {
 {
     if (auto* module = netscapePluginModule()) {
-        auto currentTime = std::chrono::system_clock::now();
+        auto currentTime = WallTime::now();
 
         if (currentTime > modifiedSince) {
 
         if (currentTime > modifiedSince) {
-            uint64_t maximumAge = std::chrono::duration_cast<std::chrono::seconds>(currentTime - modifiedSince).count();
+            uint64_t maximumAge = (currentTime - modifiedSince).secondsAs<uint64_t>();
 
             module->clearSiteData(String(), NP_CLEAR_ALL, maximumAge);
         }
 
             module->clearSiteData(String(), NP_CLEAR_ALL, maximumAge);
         }
index 8e7f0a7..dea50af 100644 (file)
@@ -94,7 +94,7 @@ private:
     void createWebProcessConnection();
 
     void getSitesWithData(uint64_t callbackID);
     void createWebProcessConnection();
 
     void getSitesWithData(uint64_t callbackID);
-    void deleteWebsiteData(std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID);
+    void deleteWebsiteData(WallTime modifiedSince, uint64_t callbackID);
     void deleteWebsiteDataForHostNames(const Vector<String>& hostNames, uint64_t callbackID);
 
     void platformInitializePluginProcess(PluginProcessCreationParameters&&);
     void deleteWebsiteDataForHostNames(const Vector<String>& hostNames, uint64_t callbackID);
 
     void platformInitializePluginProcess(PluginProcessCreationParameters&&);
index 070e940..1792f92 100644 (file)
@@ -35,7 +35,7 @@ messages -> PluginProcess LegacyReceiver {
     # DidGetSitesWithData message with the sites.
     GetSitesWithData(uint64_t callbackID)
 
     # DidGetSitesWithData message with the sites.
     GetSitesWithData(uint64_t callbackID)
 
-    DeleteWebsiteData(std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+    DeleteWebsiteData(WallTime modifiedSince, uint64_t callbackID)
     DeleteWebsiteDataForHostNames(Vector<String> hostNames, uint64_t callbackID)
 
     SetProcessSuppressionEnabled(bool flag)
     DeleteWebsiteDataForHostNames(Vector<String> hostNames, uint64_t callbackID)
 
     SetProcessSuppressionEnabled(bool flag)
index d1dd654..08d24f2 100644 (file)
@@ -361,6 +361,9 @@ def headers_for_type(type):
     header_infos_and_types = class_template_headers(type)
 
     special_cases = {
     header_infos_and_types = class_template_headers(type)
 
     special_cases = {
+        'MonotonicTime': ['<wtf/MonotonicTime.h>'],
+        'Seconds': ['<wtf/Seconds.h>'],
+        'WallTime': ['<wtf/WallTime.h>'],
         'String': ['<wtf/text/WTFString.h>'],
         'PAL::SessionID': ['<pal/SessionID.h>'],
         'WebCore::AttachmentDisplayOptions': ['<WebCore/AttachmentTypes.h>'],
         'String': ['<wtf/text/WTFString.h>'],
         'PAL::SessionID': ['<pal/SessionID.h>'],
         'WebCore::AttachmentDisplayOptions': ['<WebCore/AttachmentTypes.h>'],
@@ -410,7 +413,6 @@ def headers_for_type(type):
         'struct WebKit::WebUserScriptData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebUserStyleSheetData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebScriptMessageHandlerData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebUserScriptData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebUserStyleSheetData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebScriptMessageHandlerData': ['"WebUserContentControllerDataTypes.h"'],
-        'std::chrono::system_clock::time_point': ['<chrono>'],
     }
 
     headers = []
     }
 
     headers = []
index da19a3e..28a4980 100644 (file)
@@ -30,7 +30,7 @@
 #include <WebCore/IOSurface.h>
 #include <WebCore/MachSendRight.h>
 #include <WebCore/Region.h>
 #include <WebCore/IOSurface.h>
 #include <WebCore/MachSendRight.h>
 #include <WebCore/Region.h>
-#include <chrono>
+#include <wtf/MonotonicTime.h>
 
 OBJC_CLASS CALayer;
 
 
 OBJC_CLASS CALayer;
 
@@ -92,7 +92,7 @@ public:
 
     bool setBufferVolatility(BufferType, bool isVolatile);
 
 
     bool setBufferVolatility(BufferType, bool isVolatile);
 
-    std::chrono::steady_clock::time_point lastDisplayTime() const { return m_lastDisplayTime; }
+    MonotonicTime lastDisplayTime() const { return m_lastDisplayTime; }
 
 private:
     void drawInContext(WebCore::GraphicsContext&, CGImageRef backImage);
 
 private:
     void drawInContext(WebCore::GraphicsContext&, CGImageRef backImage);
@@ -149,7 +149,7 @@ private:
 
     WebCore::RepaintRectList m_paintingRects;
 
 
     WebCore::RepaintRectList m_paintingRects;
 
-    std::chrono::steady_clock::time_point m_lastDisplayTime;
+    MonotonicTime m_lastDisplayTime;
 };
 
 } // namespace WebKit
 };
 
 } // namespace WebKit
index 19d2232..5937d2d 100644 (file)
@@ -51,7 +51,7 @@ namespace WebKit {
 RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
     : m_layer(layer)
     , m_isOpaque(false)
 RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
     : m_layer(layer)
     , m_isOpaque(false)
-    , m_lastDisplayTime(std::chrono::steady_clock::time_point::min())
+    , m_lastDisplayTime(-MonotonicTime::infinity())
 {
     if (!m_layer)
         return;
 {
     if (!m_layer)
         return;
@@ -226,7 +226,7 @@ bool RemoteLayerBackingStore::display()
 {
     ASSERT(!m_frontContextPendingFlush);
 
 {
     ASSERT(!m_frontContextPendingFlush);
 
-    m_lastDisplayTime = std::chrono::steady_clock::now();
+    m_lastDisplayTime = MonotonicTime::now();
 
     bool needToEncodeBackingStore = false;
     if (RemoteLayerTreeContext* context = m_layer->context())
 
     bool needToEncodeBackingStore = false;
     if (RemoteLayerTreeContext* context = m_layer->context())
index 7fb695d..fd81360 100644 (file)
@@ -63,7 +63,7 @@ private:
     };
     typedef unsigned VolatilityMarkingFlags;
     bool markBackingStoreVolatileImmediately(RemoteLayerBackingStore&, VolatilityMarkingFlags = 0);
     };
     typedef unsigned VolatilityMarkingFlags;
     bool markBackingStoreVolatileImmediately(RemoteLayerBackingStore&, VolatilityMarkingFlags = 0);
-    bool markBackingStoreVolatile(RemoteLayerBackingStore&, std::chrono::steady_clock::time_point now);
+    bool markBackingStoreVolatile(RemoteLayerBackingStore&, MonotonicTime now);
 
     HashSet<RemoteLayerBackingStore*> m_liveBackingStore;
     HashSet<RemoteLayerBackingStore*> m_unparentedBackingStore;
 
     HashSet<RemoteLayerBackingStore*> m_liveBackingStore;
     HashSet<RemoteLayerBackingStore*> m_unparentedBackingStore;
index 654816f..3b03927 100644 (file)
 #import "RemoteLayerBackingStore.h"
 #import "RemoteLayerTreeContext.h"
 
 #import "RemoteLayerBackingStore.h"
 #import "RemoteLayerTreeContext.h"
 
-using namespace std::literals::chrono_literals;
-
-const std::chrono::seconds volatileBackingStoreAgeThreshold = 1s;
-const std::chrono::milliseconds volatileSecondaryBackingStoreAgeThreshold = 200ms;
+const Seconds volatileBackingStoreAgeThreshold = 1_s;
+const Seconds volatileSecondaryBackingStoreAgeThreshold = 200_ms;
 const Seconds volatilityTimerInterval = 200_ms;
 
 namespace WebKit {
 const Seconds volatilityTimerInterval = 200_ms;
 
 namespace WebKit {
@@ -122,7 +120,7 @@ bool RemoteLayerBackingStoreCollection::markBackingStoreVolatileImmediately(Remo
     return successfullyMadeBackingStoreVolatile;
 }
 
     return successfullyMadeBackingStoreVolatile;
 }
 
-bool RemoteLayerBackingStoreCollection::markBackingStoreVolatile(RemoteLayerBackingStore& backingStore, std::chrono::steady_clock::time_point now)
+bool RemoteLayerBackingStoreCollection::markBackingStoreVolatile(RemoteLayerBackingStore& backingStore, MonotonicTime now)
 {
     if (now - backingStore.lastDisplayTime() < volatileBackingStoreAgeThreshold) {
         if (now - backingStore.lastDisplayTime() >= volatileSecondaryBackingStoreAgeThreshold)
 {
     if (now - backingStore.lastDisplayTime() < volatileBackingStoreAgeThreshold) {
         if (now - backingStore.lastDisplayTime() >= volatileSecondaryBackingStoreAgeThreshold)
@@ -166,7 +164,7 @@ void RemoteLayerBackingStoreCollection::volatilityTimerFired()
 {
     bool successfullyMadeBackingStoreVolatile = true;
 
 {
     bool successfullyMadeBackingStoreVolatile = true;
 
-    auto now = std::chrono::steady_clock::now();
+    auto now = MonotonicTime::now();
     for (const auto& backingStore : m_liveBackingStore)
         successfullyMadeBackingStoreVolatile &= markBackingStoreVolatile(*backingStore, now);
 
     for (const auto& backingStore : m_liveBackingStore)
         successfullyMadeBackingStoreVolatile &= markBackingStoreVolatile(*backingStore, now);
 
index 7f815ce..8864df2 100644 (file)
@@ -80,7 +80,6 @@
 #include <pal/SessionID.h>
 #include <wtf/MonotonicTime.h>
 #include <wtf/Seconds.h>
 #include <pal/SessionID.h>
 #include <wtf/MonotonicTime.h>
 #include <wtf/Seconds.h>
-#include <wtf/WallTime.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringHash.h>
 
 #include <wtf/text/CString.h>
 #include <wtf/text/StringHash.h>
 
@@ -162,21 +161,6 @@ bool ArgumentCoder<MonotonicTime>::decode(Decoder& decoder, MonotonicTime& time)
     return true;
 }
 
     return true;
 }
 
-void ArgumentCoder<WallTime>::encode(Encoder& encoder, const WallTime& time)
-{
-    encoder << time.secondsSinceEpoch().value();
-}
-
-bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time)
-{
-    double value;
-    if (!decoder.decode(value))
-        return false;
-
-    time = WallTime::fromRawSeconds(value);
-    return true;
-}
-
 void ArgumentCoder<Seconds>::encode(Encoder& encoder, const Seconds& seconds)
 {
     encoder << seconds.value();
 void ArgumentCoder<Seconds>::encode(Encoder& encoder, const Seconds& seconds)
 {
     encoder << seconds.value();
@@ -855,7 +839,7 @@ std::optional<RecentSearch> ArgumentCoder<RecentSearch>::decode(Decoder& decoder
     if (!string)
         return std::nullopt;
     
     if (!string)
         return std::nullopt;
     
-    std::optional<std::chrono::system_clock::time_point> time;
+    std::optional<WallTime> time;
     decoder >> time;
     if (!time)
         return std::nullopt;
     decoder >> time;
     if (!time)
         return std::nullopt;
index 5a1fdb5..a2cd09b 100644 (file)
@@ -46,7 +46,6 @@
 namespace WTF {
 class MonotonicTime;
 class Seconds;
 namespace WTF {
 class MonotonicTime;
 class Seconds;
-class WallTime;
 }
 
 namespace WebCore {
 }
 
 namespace WebCore {
@@ -169,11 +168,6 @@ template<> struct ArgumentCoder<WTF::MonotonicTime> {
     static bool decode(Decoder&, WTF::MonotonicTime&);
 };
 
     static bool decode(Decoder&, WTF::MonotonicTime&);
 };
 
-template<> struct ArgumentCoder<WTF::WallTime> {
-    static void encode(Encoder&, const WTF::WallTime&);
-    static bool decode(Decoder&, WTF::WallTime&);
-};
-
 template<> struct ArgumentCoder<WTF::Seconds> {
     static void encode(Encoder&, const WTF::Seconds&);
     static bool decode(Decoder&, WTF::Seconds&);
 template<> struct ArgumentCoder<WTF::Seconds> {
     static void encode(Encoder&, const WTF::Seconds&);
     static bool decode(Decoder&, WTF::Seconds&);
index 7f2bc1b..44e8f40 100644 (file)
@@ -299,7 +299,7 @@ void StorageProcess::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<Websit
 #endif
 }
 
 #endif
 }
 
-void StorageProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+void StorageProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince, uint64_t callbackID)
 {
     auto callbackAggregator = CallbackAggregator::create([this, callbackID] {
         parentProcessConnection()->send(Messages::StorageProcessProxy::DidDeleteWebsiteData(callbackID), 0);
 {
     auto callbackAggregator = CallbackAggregator::create([this, callbackID] {
         parentProcessConnection()->send(Messages::StorageProcessProxy::DidDeleteWebsiteData(callbackID), 0);
index 71067a2..7205bae 100644 (file)
@@ -121,7 +121,7 @@ private:
     void createStorageToWebProcessConnection(bool isServiceWorkerProcess);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, uint64_t callbackID);
     void createStorageToWebProcessConnection(bool isServiceWorkerProcess);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, uint64_t callbackID);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince, uint64_t callbackID);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<WebCore::SecurityOriginData>& origins, uint64_t callbackID);
 #if ENABLE(SANDBOX_EXTENSIONS)
     void grantSandboxExtensionsForBlobs(const Vector<String>& paths, SandboxExtension::HandleArray&&);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<WebCore::SecurityOriginData>& origins, uint64_t callbackID);
 #if ENABLE(SANDBOX_EXTENSIONS)
     void grantSandboxExtensionsForBlobs(const Vector<String>& paths, SandboxExtension::HandleArray&&);
index 99277d1..e3a1271 100644 (file)
@@ -28,7 +28,7 @@ messages -> StorageProcess LegacyReceiver {
     CreateStorageToWebProcessConnection(bool isServiceWorkerProcess)
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, uint64_t callbackID)
     CreateStorageToWebProcessConnection(bool isServiceWorkerProcess)
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, uint64_t callbackID)
-    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, WallTime modifiedSince, uint64_t callbackID)
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, uint64_t callbackID)
 #if ENABLE(SANDBOX_EXTENSIONS)
     GrantSandboxExtensionsForBlobs(Vector<String> paths, WebKit::SandboxExtension::HandleArray extensions)
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, uint64_t callbackID)
 #if ENABLE(SANDBOX_EXTENSIONS)
     GrantSandboxExtensionsForBlobs(Vector<String> paths, WebKit::SandboxExtension::HandleArray extensions)
index b371566..fab60af 100644 (file)
@@ -65,5 +65,5 @@ void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRe
 void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
 void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore();
-    websiteDataStore.removeData(WebsiteDataType::OfflineWebApplicationCache, std::chrono::system_clock::time_point::min(), [] { });
+    websiteDataStore.removeData(WebsiteDataType::OfflineWebApplicationCache, -WallTime::infinity(), [] { });
 }
 }
index 789d2ec..1cc75a0 100644 (file)
@@ -59,10 +59,7 @@ void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef)
 
 void WKCookieManagerDeleteAllCookiesModifiedAfterDate(WKCookieManagerRef cookieManagerRef, double date)
 {
 
 void WKCookieManagerDeleteAllCookiesModifiedAfterDate(WKCookieManagerRef cookieManagerRef, double date)
 {
-    using namespace std::chrono;
-
-    auto time = system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date)));
-    toImpl(cookieManagerRef)->deleteAllCookiesModifiedSince(PAL::SessionID::defaultSessionID(), time, [](CallbackBase::Error){});
+    toImpl(cookieManagerRef)->deleteAllCookiesModifiedSince(PAL::SessionID::defaultSessionID(), WallTime::fromRawSeconds(date), [](CallbackBase::Error){});
 }
 
 void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy)
 }
 
 void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy)
index 4eb8903..f10d633 100644 (file)
@@ -128,5 +128,5 @@ void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyVal
     if (!storageManager)
         return;
 
     if (!storageManager)
         return;
 
-    storageManager->deleteLocalStorageOriginsModifiedSince(std::chrono::system_clock::time_point::min(), [] { });
+    storageManager->deleteLocalStorageOriginsModifiedSince(-WallTime::infinity(), [] { });
 }
 }
index f77e28f..23aa4d1 100644 (file)
@@ -90,5 +90,5 @@ void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheMa
 void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager, WKResourceCachesToClear cachesToClear)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore();
 void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager, WKResourceCachesToClear cachesToClear)
 {
     auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore();
-    websiteDataStore.removeData(toWebsiteDataTypes(cachesToClear), std::chrono::system_clock::time_point::min(), [] { });
+    websiteDataStore.removeData(toWebsiteDataTypes(cachesToClear), -WallTime::infinity(), [] { });
 }
 }
index cf8ad59..f6aa5ec 100644 (file)
@@ -337,13 +337,13 @@ void WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHou
     if (!store)
         return;
 
     if (!store)
         return;
 
-    store->scheduleClearInMemoryAndPersistent(std::chrono::system_clock::now() - std::chrono::hours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+    store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
 }
 
 void WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemovalFunction callback)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::ResourceLoadStatistics;
 }
 
 void WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemovalFunction callback)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::ResourceLoadStatistics;
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::from_time_t(0), [context, callback] {
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, WallTime::fromRawSeconds(0), [context, callback] {
         callback(context);
     });
 }
         callback(context);
     });
 }
@@ -361,7 +361,7 @@ void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef da
 void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::DOMCache;
 void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::DOMCache;
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [context, callback] {
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [context, callback] {
         callback(context);
     });
 }
         callback(context);
     });
 }
@@ -381,14 +381,14 @@ void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStore
 void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::IndexedDBDatabases;
 void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::IndexedDBDatabases;
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [] { });
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [] { });
 }
 
 void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef)
 {
 #if ENABLE(SERVICE_WORKER)
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::ServiceWorkerRegistrations;
 }
 
 void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef)
 {
 #if ENABLE(SERVICE_WORKER)
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::ServiceWorkerRegistrations;
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [] { });
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [] { });
 #else
     UNUSED_PARAM(dataStoreRef);
 #endif
 #else
     UNUSED_PARAM(dataStoreRef);
 #endif
index c6a0fb1..b865b42 100644 (file)
@@ -106,12 +106,10 @@ using namespace WebCore;
     return WebKit::wrapper(_websiteDataStore->httpCookieStore());
 }
 
     return WebKit::wrapper(_websiteDataStore->httpCookieStore());
 }
 
-static std::chrono::system_clock::time_point toSystemClockTime(NSDate *date)
+static WallTime toSystemClockTime(NSDate *date)
 {
     ASSERT(date);
 {
     ASSERT(date);
-    using namespace std::chrono;
-
-    return system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date.timeIntervalSince1970)));
+    return WallTime::fromRawSeconds(date.timeIntervalSince1970);
 }
 
 - (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler
 }
 
 - (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler
@@ -559,7 +557,7 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
     if (!store)
         return;
 
     if (!store)
         return;
 
-    store->scheduleClearInMemoryAndPersistent(std::chrono::system_clock::now() - std::chrono::hours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
+    store->scheduleClearInMemoryAndPersistent(WallTime::now() - Seconds::fromHours(hours), WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::Yes);
 }
 
 - (void)_resourceLoadStatisticsResetToConsistentState
 }
 
 - (void)_resourceLoadStatisticsResetToConsistentState
index 7d5853e..b1c967f 100644 (file)
@@ -766,7 +766,7 @@ void webkit_web_context_clear_cache(WebKitWebContext* context)
     websiteDataTypes |= WebsiteDataType::MemoryCache;
     websiteDataTypes |= WebsiteDataType::DiskCache;
     auto& websiteDataStore = webkitWebsiteDataManagerGetDataStore(context->priv->websiteDataManager.get()).websiteDataStore();
     websiteDataTypes |= WebsiteDataType::MemoryCache;
     websiteDataTypes |= WebsiteDataType::DiskCache;
     auto& websiteDataStore = webkitWebsiteDataManagerGetDataStore(context->priv->websiteDataManager.get()).websiteDataStore();
-    websiteDataStore.removeData(websiteDataTypes, std::chrono::system_clock::time_point::min(), [] { });
+    websiteDataStore.removeData(websiteDataTypes, -WallTime::infinity(), [] { });
 }
 
 /**
 }
 
 /**
index fb1997a..9435f39 100644 (file)
@@ -879,7 +879,7 @@ void webkit_website_data_manager_clear(WebKitWebsiteDataManager* manager, WebKit
 {
     g_return_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager));
 
 {
     g_return_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager));
 
-    std::chrono::system_clock::time_point timePoint = timeSpan ? std::chrono::system_clock::now() - std::chrono::microseconds(timeSpan) : std::chrono::system_clock::from_time_t(0);
+    WallTime timePoint = timeSpan ? WallTime::now() - Seconds::fromMicroseconds(timeSpan) : WallTime::fromRawSeconds(0);
     GRefPtr<GTask> task = adoptGRef(g_task_new(manager, cancellable, callback, userData));
     manager->priv->websiteDataStore->websiteDataStore().removeData(toWebsiteDataTypes(types), timePoint, [task = WTFMove(task)] {
         g_task_return_boolean(task.get(), TRUE);
     GRefPtr<GTask> task = adoptGRef(g_task_new(manager, cancellable, callback, userData));
     manager->priv->websiteDataStore->websiteDataStore().removeData(toWebsiteDataTypes(types), timePoint, [task = WTFMove(task)] {
         g_task_return_boolean(task.get(), TRUE);
index 50a297c..ad8356c 100644 (file)
@@ -33,7 +33,6 @@
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/IntSize.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/IntSize.h>
-#include <chrono>
 #include <stdint.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RunLoop.h>
 #include <stdint.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RunLoop.h>
index bd6bf14..5cfe0dc 100644 (file)
@@ -142,7 +142,7 @@ void NetworkProcessProxy::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<W
     send(Messages::NetworkProcess::FetchWebsiteData(sessionID, dataTypes, fetchOptions, callbackID), 0);
 }
 
     send(Messages::NetworkProcess::FetchWebsiteData(sessionID, dataTypes, fetchOptions, callbackID), 0);
 }
 
-void NetworkProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler)
+void NetworkProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, WallTime modifiedSince, WTF::Function<void ()>&& completionHandler)
 {
     auto callbackID = generateCallbackID();
     RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data", this);
 {
     auto callbackID = generateCallbackID();
     RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is deleting Website data", this);
index 68baf68..211c14c 100644 (file)
@@ -70,7 +70,7 @@ public:
     DownloadProxy* createDownloadProxy(const WebCore::ResourceRequest&);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, WTF::Function<void(WebsiteData)>&& completionHandler);
     DownloadProxy* createDownloadProxy(const WebCore::ResourceRequest&);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, WTF::Function<void(WebsiteData)>&& completionHandler);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void()>&& completionHandler);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, WTF::Function<void()>&& completionHandler);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebKit::WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, WTF::Function<void()>&& completionHandler);
 
 #if PLATFORM(COCOA)
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebKit::WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, WTF::Function<void()>&& completionHandler);
 
 #if PLATFORM(COCOA)
index 9ce54de..17b319d 100644 (file)
@@ -109,7 +109,7 @@ void PluginProcessManager::fetchWebsiteData(const PluginModuleInfo& plugin, Opti
     pluginProcess->fetchWebsiteData(WTFMove(completionHandler));
 }
 
     pluginProcess->fetchWebsiteData(WTFMove(completionHandler));
 }
 
-void PluginProcessManager::deleteWebsiteData(const PluginModuleInfo& plugin, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler)
+void PluginProcessManager::deleteWebsiteData(const PluginModuleInfo& plugin, WallTime modifiedSince, WTF::Function<void ()>&& completionHandler)
 {
     PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
     pluginProcess->deleteWebsiteData(modifiedSince, WTFMove(completionHandler));
 {
     PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
     pluginProcess->deleteWebsiteData(modifiedSince, WTFMove(completionHandler));
index 1f3479b..6f67096 100644 (file)
@@ -61,7 +61,7 @@ public:
     void removePluginProcessProxy(PluginProcessProxy*);
 
     void fetchWebsiteData(const PluginModuleInfo&, OptionSet<WebsiteDataFetchOption>, WTF::Function<void (Vector<String>)>&& completionHandler);
     void removePluginProcessProxy(PluginProcessProxy*);
 
     void fetchWebsiteData(const PluginModuleInfo&, OptionSet<WebsiteDataFetchOption>, WTF::Function<void (Vector<String>)>&& completionHandler);
-    void deleteWebsiteData(const PluginModuleInfo&, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler);
+    void deleteWebsiteData(const PluginModuleInfo&, WallTime modifiedSince, WTF::Function<void ()>&& completionHandler);
     void deleteWebsiteDataForHostNames(const PluginModuleInfo&, const Vector<String>& hostNames, WTF::Function<void ()>&& completionHandler);
 
 #if PLATFORM(COCOA)
     void deleteWebsiteDataForHostNames(const PluginModuleInfo&, const Vector<String>& hostNames, WTF::Function<void ()>&& completionHandler);
 
 #if PLATFORM(COCOA)
index f7db207..acd9935 100644 (file)
@@ -129,7 +129,7 @@ void PluginProcessProxy::fetchWebsiteData(WTF::Function<void (Vector<String>)>&&
     m_connection->send(Messages::PluginProcess::GetSitesWithData(callbackID), 0);
 }
 
     m_connection->send(Messages::PluginProcess::GetSitesWithData(callbackID), 0);
 }
 
-void PluginProcessProxy::deleteWebsiteData(std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler)
+void PluginProcessProxy::deleteWebsiteData(WallTime modifiedSince, WTF::Function<void ()>&& completionHandler)
 {
     uint64_t callbackID = generateCallbackID();
     m_pendingDeleteWebsiteDataCallbacks.set(callbackID, WTFMove(completionHandler));
 {
     uint64_t callbackID = generateCallbackID();
     m_pendingDeleteWebsiteDataCallbacks.set(callbackID, WTFMove(completionHandler));
index 8f5a1d1..2530ffe 100644 (file)
@@ -79,7 +79,7 @@ public:
     void getPluginProcessConnection(Ref<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>&&);
 
     void fetchWebsiteData(WTF::Function<void (Vector<String>)>&& completionHandler);
     void getPluginProcessConnection(Ref<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>&&);
 
     void fetchWebsiteData(WTF::Function<void (Vector<String>)>&& completionHandler);
-    void deleteWebsiteData(std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler);
+    void deleteWebsiteData(WallTime modifiedSince, WTF::Function<void ()>&& completionHandler);
     void deleteWebsiteDataForHostNames(const Vector<String>& hostNames, WTF::Function<void ()>&& completionHandler);
 
     bool isValid() const { return m_connection; }
     void deleteWebsiteDataForHostNames(const Vector<String>& hostNames, WTF::Function<void ()>&& completionHandler);
 
     bool isValid() const { return m_connection; }
@@ -155,7 +155,7 @@ private:
     HashMap<uint64_t, WTF::Function<void (Vector<String>)>> m_pendingFetchWebsiteDataCallbacks;
 
     struct DeleteWebsiteDataRequest {
     HashMap<uint64_t, WTF::Function<void (Vector<String>)>> m_pendingFetchWebsiteDataCallbacks;
 
     struct DeleteWebsiteDataRequest {
-        std::chrono::system_clock::time_point modifiedSince;
+        WallTime modifiedSince;
         uint64_t callbackID;
     };
     Vector<DeleteWebsiteDataRequest> m_pendingDeleteWebsiteDataRequests;
         uint64_t callbackID;
     };
     Vector<DeleteWebsiteDataRequest> m_pendingDeleteWebsiteDataRequests;
index 5b52106..1ba3a24 100644 (file)
@@ -93,7 +93,7 @@ void StorageProcessProxy::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<W
     send(Messages::StorageProcess::FetchWebsiteData(sessionID, dataTypes, callbackID), 0);
 }
 
     send(Messages::StorageProcess::FetchWebsiteData(sessionID, dataTypes, callbackID), 0);
 }
 
-void StorageProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler)
+void StorageProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, WallTime modifiedSince, WTF::Function<void ()>&& completionHandler)
 {
     auto callbackID = generateCallbackID();
 
 {
     auto callbackID = generateCallbackID();
 
index edb0d22..7ced659 100644 (file)
@@ -52,7 +52,7 @@ public:
     ~StorageProcessProxy();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WTF::Function<void(WebsiteData)>&& completionHandler);
     ~StorageProcessProxy();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WTF::Function<void(WebsiteData)>&& completionHandler);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void()>&& completionHandler);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, WTF::Function<void()>&& completionHandler);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, WTF::Function<void()>&& completionHandler);
 
     void getStorageProcessConnection(bool isServiceWorkerProcess, Ref<Messages::WebProcessProxy::GetStorageProcessConnection::DelayedReply>&&);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, WTF::Function<void()>&& completionHandler);
 
     void getStorageProcessConnection(bool isServiceWorkerProcess, Ref<Messages::WebProcessProxy::GetStorageProcessConnection::DelayedReply>&&);
index 5472490..cdc455f 100644 (file)
@@ -140,7 +140,7 @@ void WebCookieManagerProxy::deleteCookie(PAL::SessionID sessionID, const Cookie&
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteCookie(sessionID, cookie, callbackID));
 }
 
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteCookie(sessionID, cookie, callbackID));
 }
 
-void WebCookieManagerProxy::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, std::chrono::system_clock::time_point time, Function<void (CallbackBase::Error)>&& callbackFunction)
+void WebCookieManagerProxy::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, Function<void (CallbackBase::Error)>&& callbackFunction)
 {
     auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time, callbackID));
 {
     auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time, callbackID));
index d0a4a4e..97f14ad 100644 (file)
@@ -68,7 +68,7 @@ public:
     void deleteCookie(PAL::SessionID, const WebCore::Cookie&, Function<void (CallbackBase::Error)>&&);
     void deleteCookiesForHostname(PAL::SessionID, const String& hostname);
     void deleteAllCookies(PAL::SessionID);
     void deleteCookie(PAL::SessionID, const WebCore::Cookie&, Function<void (CallbackBase::Error)>&&);
     void deleteCookiesForHostname(PAL::SessionID, const String& hostname);
     void deleteAllCookies(PAL::SessionID);
-    void deleteAllCookiesModifiedSince(PAL::SessionID, std::chrono::system_clock::time_point, Function<void (CallbackBase::Error)>&&);
+    void deleteAllCookiesModifiedSince(PAL::SessionID, WallTime, Function<void (CallbackBase::Error)>&&);
 
     void setCookie(PAL::SessionID, const WebCore::Cookie&, Function<void (CallbackBase::Error)>&&);
     void setCookies(PAL::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, Function<void (CallbackBase::Error)>&&);
 
     void setCookie(PAL::SessionID, const WebCore::Cookie&, Function<void (CallbackBase::Error)>&&);
     void setCookies(PAL::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, Function<void (CallbackBase::Error)>&&);
index 64d18e3..c3554ac 100644 (file)
@@ -852,7 +852,7 @@ void WebProcessProxy::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<Websi
     });
 }
 
     });
 }
 
-void WebProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, std::chrono::system_clock::time_point modifiedSince, Function<void()>&& completionHandler)
+void WebProcessProxy::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> dataTypes, WallTime modifiedSince, Function<void()>&& completionHandler)
 {
     ASSERT(canSendMessage());
 
 {
     ASSERT(canSendMessage());
 
index 5ce5ce9..222c4f6 100644 (file)
@@ -151,7 +151,7 @@ public:
     void releasePageCache();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, Function<void(WebsiteData)>&& completionHandler);
     void releasePageCache();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, Function<void(WebsiteData)>&& completionHandler);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()>&& completionHandler);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, Function<void()>&& completionHandler);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()>&& completionHandler);
     static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, Function<void (const HashSet<String>&)>&& completionHandler);
     static void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<void(HashSet<String>&&)>&& completionHandler);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()>&& completionHandler);
     static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, Function<void (const HashSet<String>&)>&& completionHandler);
     static void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<void(HashSet<String>&&)>&& completionHandler);
index 3913a1c..189119a 100644 (file)
@@ -598,7 +598,7 @@ void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGr
     });
 }
 
     });
 }
 
-void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince, ShouldGrandfather shouldGrandfather)
+void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather shouldGrandfather)
 {
     // For now, be conservative and clear everything regardless of modifiedSince.
     UNUSED_PARAM(modifiedSince);
 {
     // For now, be conservative and clear everything regardless of modifiedSince.
     UNUSED_PARAM(modifiedSince);
index dc6ed48..ff17cde 100644 (file)
@@ -120,7 +120,7 @@ public:
         Yes,
     };
     void scheduleClearInMemoryAndPersistent(ShouldGrandfather);
         Yes,
     };
     void scheduleClearInMemoryAndPersistent(ShouldGrandfather);
-    void scheduleClearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince, ShouldGrandfather);
+    void scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather);
 
     void setTimeToLiveUserInteraction(Seconds);
     void setTimeToLiveCookiePartitionFree(Seconds);
 
     void setTimeToLiveUserInteraction(Seconds);
     void setTimeToLiveCookiePartitionFree(Seconds);
index b9ca89f..3638fdd 100644 (file)
@@ -142,7 +142,7 @@ static std::optional<time_t> fileModificationTime(const String& filePath)
     return time;
 }
 
     return time;
 }
 
-Vector<SecurityOriginData> LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::time_point time)
+Vector<SecurityOriginData> LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(WallTime time)
 {
     ASSERT(!RunLoop::isMain());
     importOriginIdentifiers();
 {
     ASSERT(!RunLoop::isMain());
     importOriginIdentifiers();
@@ -151,11 +151,11 @@ Vector<SecurityOriginData> LocalStorageDatabaseTracker::deleteDatabasesModifiedS
     for (const String& origin : m_origins) {
         String filePath = pathForDatabaseWithOriginIdentifier(origin);
 
     for (const String& origin : m_origins) {
         String filePath = pathForDatabaseWithOriginIdentifier(origin);
 
-        auto modificationTime = fileModificationTime(filePath);
+        auto modificationTime = FileSystem::getFileModificationTime(filePath);
         if (!modificationTime)
             continue;
 
         if (!modificationTime)
             continue;
 
-        if (modificationTime.value() >= std::chrono::system_clock::to_time_t(time))
+        if (modificationTime.value() >= time)
             originIdentifiersToDelete.append(origin);
     }
 
             originIdentifiersToDelete.append(origin);
     }
 
index 7ceb191..5679a83 100644 (file)
@@ -30,6 +30,7 @@
 #include <wtf/Optional.h>
 #include <wtf/RefPtr.h>
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/Optional.h>
 #include <wtf/RefPtr.h>
 #include <wtf/ThreadSafeRefCounted.h>
+#include <wtf/WallTime.h>
 #include <wtf/WorkQueue.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 #include <wtf/WorkQueue.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
@@ -55,7 +56,7 @@ public:
     void deleteAllDatabases();
 
     // Returns a vector of the origins whose databases have been deleted.
     void deleteAllDatabases();
 
     // Returns a vector of the origins whose databases have been deleted.
-    Vector<WebCore::SecurityOriginData> deleteDatabasesModifiedSince(std::chrono::system_clock::time_point);
+    Vector<WebCore::SecurityOriginData> deleteDatabasesModifiedSince(WallTime);
 
     Vector<WebCore::SecurityOriginData> origins() const;
 
 
     Vector<WebCore::SecurityOriginData> origins() const;
 
index 638ca6c..82706b8 100644 (file)
@@ -618,7 +618,7 @@ void StorageManager::deleteLocalStorageEntriesForOrigin(SecurityOriginData&& sec
     });
 }
 
     });
 }
 
-void StorageManager::deleteLocalStorageOriginsModifiedSince(std::chrono::system_clock::time_point time, Function<void()>&& completionHandler)
+void StorageManager::deleteLocalStorageOriginsModifiedSince(WallTime time, Function<void()>&& completionHandler)
 {
     m_queue->dispatch([this, protectedThis = makeRef(*this), time, completionHandler = WTFMove(completionHandler)]() mutable {
         auto deletedOrigins = m_localStorageDatabaseTracker->deleteDatabasesModifiedSince(time);
 {
     m_queue->dispatch([this, protectedThis = makeRef(*this), time, completionHandler = WTFMove(completionHandler)]() mutable {
         auto deletedOrigins = m_localStorageDatabaseTracker->deleteDatabasesModifiedSince(time);
index a1f69eb..2b1f8de 100644 (file)
@@ -29,7 +29,6 @@
 #include "LocalStorageDatabaseTracker.h"
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/SecurityOriginHash.h>
 #include "LocalStorageDatabaseTracker.h"
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/SecurityOriginHash.h>
-#include <chrono>
 #include <wtf/Forward.h>
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
 #include <wtf/Forward.h>
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
@@ -66,7 +65,7 @@ public:
     void getLocalStorageOrigins(Function<void(HashSet<WebCore::SecurityOriginData>&&)>&& completionHandler);
     void deleteLocalStorageEntriesForOrigin(WebCore::SecurityOriginData&&);
 
     void getLocalStorageOrigins(Function<void(HashSet<WebCore::SecurityOriginData>&&)>&& completionHandler);
     void deleteLocalStorageEntriesForOrigin(WebCore::SecurityOriginData&&);
 
-    void deleteLocalStorageOriginsModifiedSince(std::chrono::system_clock::time_point, Function<void()>&& completionHandler);
+    void deleteLocalStorageOriginsModifiedSince(WallTime, Function<void()>&& completionHandler);
     void deleteLocalStorageEntriesForOrigins(const Vector<WebCore::SecurityOriginData>&, Function<void()>&& completionHandler);
 
     void getLocalStorageOriginDetails(Function<void(Vector<LocalStorageDatabaseTracker::OriginDetails>)>&& completionHandler);
     void deleteLocalStorageEntriesForOrigins(const Vector<WebCore::SecurityOriginData>&, Function<void()>&& completionHandler);
 
     void getLocalStorageOriginDetails(Function<void(Vector<LocalStorageDatabaseTracker::OriginDetails>)>&& completionHandler);
index 4280818..a74c2fc 100644 (file)
@@ -129,7 +129,7 @@ void WebsiteDataStore::platformDestroy()
     }
 }
 
     }
 }
 
-void WebsiteDataStore::platformRemoveRecentSearches(std::chrono::system_clock::time_point oldestTimeToRemove)
+void WebsiteDataStore::platformRemoveRecentSearches(WallTime oldestTimeToRemove)
 {
     WebCore::removeRecentlyModifiedRecentSearches(oldestTimeToRemove);
 }
 {
     WebCore::removeRecentlyModifiedRecentSearches(oldestTimeToRemove);
 }
index 8343d72..c3c8e26 100644 (file)
@@ -630,7 +630,7 @@ static ProcessAccessType computeWebProcessAccessTypeForDataRemoval(OptionSet<Web
     return processAccessType;
 }
 
     return processAccessType;
 }
 
-void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, std::chrono::system_clock::time_point modifiedSince, Function<void()>&& completionHandler)
+void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, WallTime modifiedSince, Function<void()>&& completionHandler)
 {
     struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
         explicit CallbackAggregator(Function<void()>&& completionHandler)
 {
     struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
         explicit CallbackAggregator(Function<void()>&& completionHandler)
@@ -810,13 +810,13 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, std::chr
     if (dataTypes.contains(WebsiteDataType::PlugInData) && isPersistent()) {
         class State {
         public:
     if (dataTypes.contains(WebsiteDataType::PlugInData) && isPersistent()) {
         class State {
         public:
-            static void deleteData(Ref<CallbackAggregator>&& callbackAggregator, Vector<PluginModuleInfo>&& plugins, std::chrono::system_clock::time_point modifiedSince)
+            static void deleteData(Ref<CallbackAggregator>&& callbackAggregator, Vector<PluginModuleInfo>&& plugins, WallTime modifiedSince)
             {
                 new State(WTFMove(callbackAggregator), WTFMove(plugins), modifiedSince);
             }
 
         private:
             {
                 new State(WTFMove(callbackAggregator), WTFMove(plugins), modifiedSince);
             }
 
         private:
-            State(Ref<CallbackAggregator>&& callbackAggregator, Vector<PluginModuleInfo>&& plugins, std::chrono::system_clock::time_point modifiedSince)
+            State(Ref<CallbackAggregator>&& callbackAggregator, Vector<PluginModuleInfo>&& plugins, WallTime modifiedSince)
                 : m_callbackAggregator(WTFMove(callbackAggregator))
                 , m_plugins(WTFMove(plugins))
                 , m_modifiedSince(modifiedSince)
                 : m_callbackAggregator(WTFMove(callbackAggregator))
                 , m_plugins(WTFMove(plugins))
                 , m_modifiedSince(modifiedSince)
@@ -848,7 +848,7 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, std::chr
 
             Ref<CallbackAggregator> m_callbackAggregator;
             Vector<PluginModuleInfo> m_plugins;
 
             Ref<CallbackAggregator> m_callbackAggregator;
             Vector<PluginModuleInfo> m_plugins;
-            std::chrono::system_clock::time_point m_modifiedSince;
+            WallTime m_modifiedSince;
         };
 
         State::deleteData(*callbackAggregator, plugins(), modifiedSince);
         };
 
         State::deleteData(*callbackAggregator, plugins(), modifiedSince);
@@ -1344,18 +1344,18 @@ Vector<WebCore::SecurityOriginData> WebsiteDataStore::mediaKeyOrigins(const Stri
     return origins;
 }
 
     return origins;
 }
 
-void WebsiteDataStore::removeMediaKeys(const String& mediaKeysStorageDirectory, std::chrono::system_clock::time_point modifiedSince)
+void WebsiteDataStore::removeMediaKeys(const String& mediaKeysStorageDirectory, WallTime modifiedSince)
 {
     ASSERT(!mediaKeysStorageDirectory.isEmpty());
 
     for (const auto& mediaKeyDirectory : WebCore::FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) {
         auto mediaKeyFile = computeMediaKeyFile(mediaKeyDirectory);
 
 {
     ASSERT(!mediaKeysStorageDirectory.isEmpty());
 
     for (const auto& mediaKeyDirectory : WebCore::FileSystem::listDirectory(mediaKeysStorageDirectory, "*")) {
         auto mediaKeyFile = computeMediaKeyFile(mediaKeyDirectory);
 
-        time_t modificationTime;
-        if (!WebCore::FileSystem::getFileModificationTime(mediaKeyFile, modificationTime))
+        auto modificationTime = WebCore::FileSystem::getFileModificationTime(mediaKeyFile);
+        if (!modificationTime)
             continue;
 
             continue;
 
-        if (std::chrono::system_clock::from_time_t(modificationTime) < modifiedSince)
+        if (modificationTime.value() < modifiedSince)
             continue;
 
         WebCore::FileSystem::deleteFile(mediaKeyFile);
             continue;
 
         WebCore::FileSystem::deleteFile(mediaKeyFile);
index 1944988..38bff8c 100644 (file)
@@ -112,7 +112,7 @@ public:
     void fetchData(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Function<void(Vector<WebsiteDataRecord>)>&& completionHandler);
     void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, HashSet<String>&&)>&& completionHandler);
     void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void(HashSet<String>&&)>&& completionHandler);
     void fetchData(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Function<void(Vector<WebsiteDataRecord>)>&& completionHandler);
     void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, HashSet<String>&&)>&& completionHandler);
     void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void(HashSet<String>&&)>&& completionHandler);
-    void removeData(OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()>&& completionHandler);
+    void removeData(OptionSet<WebsiteDataType>, WallTime modifiedSince, Function<void()>&& completionHandler);
     void removeData(OptionSet<WebsiteDataType>, const Vector<WebsiteDataRecord>&, Function<void()>&& completionHandler);
     void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler);
 
     void removeData(OptionSet<WebsiteDataType>, const Vector<WebsiteDataRecord>&, Function<void()>&& completionHandler);
     void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler);
 
@@ -174,7 +174,7 @@ private:
 
     void platformInitialize();
     void platformDestroy();
 
     void platformInitialize();
     void platformDestroy();
-    static void platformRemoveRecentSearches(std::chrono::system_clock::time_point);
+    static void platformRemoveRecentSearches(WallTime);
 
     HashSet<RefPtr<WebProcessPool>> processPools(size_t count = std::numeric_limits<size_t>::max(), bool ensureAPoolExists = true) const;
 
 
     HashSet<RefPtr<WebProcessPool>> processPools(size_t count = std::numeric_limits<size_t>::max(), bool ensureAPoolExists = true) const;
 
@@ -183,7 +183,7 @@ private:
 #endif
 
     static Vector<WebCore::SecurityOriginData> mediaKeyOrigins(const String& mediaKeysStorageDirectory);
 #endif
 
     static Vector<WebCore::SecurityOriginData> mediaKeyOrigins(const String& mediaKeysStorageDirectory);
-    static void removeMediaKeys(const String& mediaKeysStorageDirectory, std::chrono::system_clock::time_point modifiedSince);
+    static void removeMediaKeys(const String& mediaKeysStorageDirectory, WallTime modifiedSince);
     static void removeMediaKeys(const String& mediaKeysStorageDirectory, const HashSet<WebCore::SecurityOriginData>&);
 
     void maybeRegisterWithSessionIDMap();
     static void removeMediaKeys(const String& mediaKeysStorageDirectory, const HashSet<WebCore::SecurityOriginData>&);
 
     void maybeRegisterWithSessionIDMap();
index 461d38f..962e838 100644 (file)
@@ -75,8 +75,9 @@ void WebPageProxy::loadRecentSearches(const String&, Vector<WebCore::RecentSearc
     notImplemented();
 }
 
     notImplemented();
 }
 
-void WebsiteDataStore::platformRemoveRecentSearches(std::chrono::system_clock::time_point oldestTimeToRemove)
+void WebsiteDataStore::platformRemoveRecentSearches(WallTime oldestTimeToRemove)
 {
 {
+    UNUSED_PARAM(oldestTimeToRemove);
     notImplemented();
 }
 
     notImplemented();
 }
 
index 2fa72f0..35b66f2 100644 (file)
@@ -58,7 +58,7 @@ void WebPageProxy::loadRecentSearches(const String&, Vector<WebCore::RecentSearc
     notImplemented();
 }
 
     notImplemented();
 }
 
-void WebsiteDataStore::platformRemoveRecentSearches(std::chrono::system_clock::time_point)
+void WebsiteDataStore::platformRemoveRecentSearches(WallTime)
 {
     notImplemented();
 }
 {
     notImplemented();
 }
index 1ad88d4..d8fc6e2 100644 (file)
@@ -84,7 +84,7 @@ void WebCookieManager::deleteCookie(PAL::SessionID sessionID, const Cookie& cook
     m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
     m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
-void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, std::chrono::system_clock::time_point time, CallbackID callbackID)
+void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, CallbackID callbackID)
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
index a5ebd4d..5be9253 100644 (file)
@@ -31,7 +31,6 @@
 #include "NetworkProcessSupplement.h"
 #include "OptionalCallbackID.h"
 #include "WebProcessSupplement.h"
 #include "NetworkProcessSupplement.h"
 #include "OptionalCallbackID.h"
 #include "WebProcessSupplement.h"
-#include <chrono>
 #include <pal/SessionID.h>
 #include <stdint.h>
 #include <wtf/Forward.h>
 #include <pal/SessionID.h>
 #include <stdint.h>
 #include <wtf/Forward.h>
@@ -74,7 +73,7 @@ private:
     void deleteCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
     void deleteCookiesForHostname(PAL::SessionID, const String&);
     void deleteAllCookies(PAL::SessionID);
     void deleteCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
     void deleteCookiesForHostname(PAL::SessionID, const String&);
     void deleteAllCookies(PAL::SessionID);
-    void deleteAllCookiesModifiedSince(PAL::SessionID, std::chrono::system_clock::time_point, CallbackID);
+    void deleteAllCookiesModifiedSince(PAL::SessionID, WallTime, CallbackID);
 
     void setCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
     void setCookies(PAL::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, CallbackID);
 
     void setCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
     void setCookies(PAL::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, CallbackID);
index 43f6a7b..e3de9d8 100644 (file)
@@ -33,7 +33,7 @@
     void GetAllCookies(PAL::SessionID sessionID, WebKit::CallbackID callbackID)
     void GetCookies(PAL::SessionID sessionID, WebCore::URL url, WebKit::CallbackID callbackID)
     void DeleteCookie(PAL::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
     void GetAllCookies(PAL::SessionID sessionID, WebKit::CallbackID callbackID)
     void GetCookies(PAL::SessionID sessionID, WebCore::URL url, WebKit::CallbackID callbackID)
     void DeleteCookie(PAL::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
-    void DeleteAllCookiesModifiedSince(PAL::SessionID sessionID, std::chrono::system_clock::time_point time, WebKit::CallbackID callbackID)
+    void DeleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, WebKit::CallbackID callbackID)
 
     void SetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::OptionalCallbackID callbackID)
     void GetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
 
     void SetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::OptionalCallbackID callbackID)
     void GetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
index 3d28d61..60d8ef7 100644 (file)
@@ -223,7 +223,7 @@ static uint32_t lastModifiedDateMS(const ResourceResponse& response)
     if (!lastModified)
         return 0;
 
     if (!lastModified)
         return 0;
 
-    return std::chrono::duration_cast<std::chrono::milliseconds>(lastModified.value().time_since_epoch()).count();
+    return lastModified.value().secondsSinceEpoch().millisecondsAs<uint32_t>();
 }
 
 void PluginView::Stream::willSendRequest(NetscapePlugInStreamLoader*, ResourceRequest&& request, const ResourceResponse& redirectResponse, CompletionHandler<void(ResourceRequest&&)>&& decisionHandler)
 }
 
 void PluginView::Stream::willSendRequest(NetscapePlugInStreamLoader*, ResourceRequest&& request, const ResourceResponse& redirectResponse, CompletionHandler<void(ResourceRequest&&)>&& decisionHandler)
index 039ace7..3ff5d5c 100644 (file)
@@ -1252,7 +1252,7 @@ void WebProcess::fetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDat
     }
 }
 
     }
 }
 
-void WebProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince)
+void WebProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince)
 {
     UNUSED_PARAM(modifiedSince);
 
 {
     UNUSED_PARAM(modifiedSince);
 
index 12f990b..3c60558 100644 (file)
@@ -307,7 +307,7 @@ private:
     void releasePageCache();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WebsiteData&);
     void releasePageCache();
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WebsiteData&);
-    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince);
+    void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins);
 
     void setMemoryCacheDisabled(bool);
     void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins);
 
     void setMemoryCacheDisabled(bool);
index e18b9a8..30259bb 100644 (file)
@@ -77,7 +77,7 @@ messages -> WebProcess LegacyReceiver {
     ReleasePageCache()
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes) -> (struct WebKit::WebsiteData websiteData)
     ReleasePageCache()
 
     FetchWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes) -> (struct WebKit::WebsiteData websiteData)
-    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince) -> ()
+    DeleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, WallTime modifiedSince) -> ()
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins) -> ()
 
     SetHiddenPageDOMTimerThrottlingIncreaseLimit(int milliseconds)
     DeleteWebsiteDataForOrigins(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins) -> ()
 
     SetHiddenPageDOMTimerThrottlingIncreaseLimit(int milliseconds)
index 4292832..1ab580e 100644 (file)
@@ -1,3 +1,13 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        * Storage/WebDatabaseProvider.cpp:
+        (WebDatabaseProvider::deleteAllDatabases):
+
 2017-12-28  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win][CMake] Use add_custom_command to copy each forwarding header files
 2017-12-28  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win][CMake] Use add_custom_command to copy each forwarding header files
index 0bedd34..f5234dd 100644 (file)
@@ -59,6 +59,6 @@ WebCore::IDBClient::IDBConnectionToServer& WebDatabaseProvider::idbConnectionToS
 void WebDatabaseProvider::deleteAllDatabases()
 {
     for (auto& server : m_idbServerMap.values())
 void WebDatabaseProvider::deleteAllDatabases()
 {
     for (auto& server : m_idbServerMap.values())
-        server->idbServer().closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point::min(), [] { });
+        server->idbServer().closeAndDeleteDatabasesModifiedSince(-WallTime::infinity(), [] { });
 }
 #endif
 }
 #endif
index 2db5245..9f9c309 100644 (file)
@@ -1,3 +1,13 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        * Plugins/PluginStream.cpp:
+        (WebCore::lastModifiedDateMS):
+
 2018-01-02  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win] Web Inspector: Wrongly placed inspector highlight in HiDPI
 2018-01-02  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win] Web Inspector: Wrongly placed inspector highlight in HiDPI
index 59fc3bf..c89d336 100644 (file)
@@ -133,7 +133,7 @@ static uint32_t lastModifiedDateMS(const ResourceResponse& response)
     if (!lastModified)
         return 0;
 
     if (!lastModified)
         return 0;
 
-    return std::chrono::duration_cast<std::chrono::milliseconds>(lastModified.value().time_since_epoch()).count();
+    return lastModified.value().secondsSinceEpoch().millisecondsAs<uint32_t>();
 }
 
 void PluginStream::startStream()
 }
 
 void PluginStream::startStream()
index 05942f4..0084aee 100644 (file)
@@ -1,3 +1,13 @@
+2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Remove std::chrono completely
+        https://bugs.webkit.org/show_bug.cgi?id=181186
+
+        Reviewed by Alex Christensen.
+
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        (WTR::TestController::platformRunUntil):
+
 2018-01-02  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         REGRESSION(r223253): Broke ResourceLoadStatistics layout tests for non-Cocoa ports
 2018-01-02  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         REGRESSION(r223253): Broke ResourceLoadStatistics layout tests for non-Cocoa ports
index 50d307c..aa5885b 100644 (file)
@@ -78,12 +78,9 @@ void TestController::platformRunUntil(bool&, double timeout)
 {
     if (timeout > 0) {
         // FIXME: This conversion is now repeated in several places, it should be moved to a common place in WTF and used everywhere.
 {
     if (timeout > 0) {
         // FIXME: This conversion is now repeated in several places, it should be moved to a common place in WTF and used everywhere.
-        auto timeoutDuration = std::chrono::duration<double>(timeout);
-        auto safeDuration = std::chrono::microseconds::max();
-        if (timeoutDuration < safeDuration)
-            safeDuration = std::chrono::duration_cast<std::chrono::microseconds>(timeoutDuration);
+        auto timeoutDuration = Seconds { timeout };
         gint64 currentTime = g_get_monotonic_time();
         gint64 currentTime = g_get_monotonic_time();
-        gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, safeDuration.count());
+        gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, timeoutDuration.microsecondsAs<int64_t>());
         ASSERT(targetTime >= currentTime);
         g_source_set_ready_time(timeoutSource(), targetTime);
     } else
         ASSERT(targetTime >= currentTime);
         g_source_set_ready_time(timeoutSource(), targetTime);
     } else