Title: [217724] trunk
Revision
217724
Author
simon.fra...@apple.com
Date
2017-06-02 11:20:47 -0700 (Fri, 02 Jun 2017)

Log Message

Get <chrono> out of StdLibExtras.h
https://bugs.webkit.org/show_bug.cgi?id=172744

Reviewed by Zalan Bujtas.

Source/WebCore:

Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.

* fileapi/FileReader.cpp:
* inspector/InspectorOverlay.cpp:
* loader/CrossOriginPreflightResultCache.cpp:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::freshnessLifetime):
* page/ResourceUsageThread.cpp:
(WebCore::ResourceUsageThread::threadBody):
* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
* platform/network/CacheValidation.cpp:
(WebCore::computeFreshnessLifetimeForHTTPFamily):
* platform/network/CacheValidation.h:

Source/WebKit2:

Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.

* NetworkProcess/cache/NetworkCache.cpp:
* NetworkProcess/cache/NetworkCacheFileSystem.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::computeRecordWorth):
* Shared/mac/RemoteLayerBackingStoreCollection.mm:
* WebProcess/Cookies/WebCookieManager.h:

Source/WTF:

We hates std::chrono. Don't include it everywhere to discourage use.

* wtf/StdLibExtras.h:

Tools:

* TestWebKitAPI/Tests/WTF/WorkQueue.cpp:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (217723 => 217724)


--- trunk/Source/WTF/ChangeLog	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WTF/ChangeLog	2017-06-02 18:20:47 UTC (rev 217724)
@@ -1,3 +1,14 @@
+2017-06-02  Simon Fraser  <simon.fra...@apple.com>
+
+        Get <chrono> out of StdLibExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=172744
+
+        Reviewed by Zalan Bujtas.
+
+        We hates std::chrono. Don't include it everywhere to discourage use.
+
+        * wtf/StdLibExtras.h:
+
 2017-06-02  Filip Pizlo  <fpi...@apple.com>
 
         Atomics.load and Atomics.store need to be fully fenced

Modified: trunk/Source/WTF/wtf/StdLibExtras.h (217723 => 217724)


--- trunk/Source/WTF/wtf/StdLibExtras.h	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WTF/wtf/StdLibExtras.h	2017-06-02 18:20:47 UTC (rev 217724)
@@ -27,7 +27,6 @@
 #ifndef WTF_StdLibExtras_h
 #define WTF_StdLibExtras_h
 
-#include <chrono>
 #include <cstring>
 #include <memory>
 #include <type_traits>
@@ -543,9 +542,4 @@
 using WTF::safeCast;
 using WTF::tryBinarySearch;
 
-#if !COMPILER(CLANG) || __cplusplus >= 201400L
-// We normally don't want to bring in entire std namespaces, but literals are an exception.
-using namespace std::literals::chrono_literals;
-#endif
-
 #endif // WTF_StdLibExtras_h

Modified: trunk/Source/WebCore/ChangeLog (217723 => 217724)


--- trunk/Source/WebCore/ChangeLog	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/ChangeLog	2017-06-02 18:20:47 UTC (rev 217724)
@@ -1,3 +1,25 @@
+2017-06-02  Simon Fraser  <simon.fra...@apple.com>
+
+        Get <chrono> out of StdLibExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=172744
+
+        Reviewed by Zalan Bujtas.
+
+        Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
+
+        * fileapi/FileReader.cpp:
+        * inspector/InspectorOverlay.cpp:
+        * loader/CrossOriginPreflightResultCache.cpp:
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::freshnessLifetime):
+        * page/ResourceUsageThread.cpp:
+        (WebCore::ResourceUsageThread::threadBody):
+        * page/cocoa/MemoryReleaseCocoa.mm:
+        (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
+        * platform/network/CacheValidation.cpp:
+        (WebCore::computeFreshnessLifetimeForHTTPFamily):
+        * platform/network/CacheValidation.h:
+
 2017-06-02  Andy Estes  <aes...@apple.com>
 
         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest

Modified: trunk/Source/WebCore/fileapi/FileReader.cpp (217723 => 217724)


--- trunk/Source/WebCore/fileapi/FileReader.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/fileapi/FileReader.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -43,6 +43,8 @@
 
 namespace WebCore {
 
+using namespace std::literals::chrono_literals;
+
 // Fire the progress event at least every 50ms.
 static const auto progressNotificationInterval = 50ms;
 

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (217723 => 217724)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -63,6 +63,7 @@
 #include <inspector/InspectorValues.h>
 
 using namespace Inspector;
+using namespace std::literals::chrono_literals;
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp (217723 => 217724)


--- trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -33,10 +33,11 @@
 #include "ResourceResponse.h"
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
+using namespace std::literals::chrono_literals;
+
 // 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.

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (217723 => 217724)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -395,6 +395,8 @@
 
 std::chrono::microseconds CachedResource::freshnessLifetime(const ResourceResponse& response) const
 {
+    using namespace std::literals::chrono_literals;
+
     if (!response.url().protocolIsInHTTPFamily()) {
         StringView protocol = response.url().protocol();
         if (!shouldCacheSchemeIndefinitely(protocol)) {

Modified: trunk/Source/WebCore/page/ResourceUsageThread.cpp (217723 => 217724)


--- trunk/Source/WebCore/page/ResourceUsageThread.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/page/ResourceUsageThread.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -110,6 +110,8 @@
 
 NO_RETURN void ResourceUsageThread::threadBody()
 {
+    using namespace std::literals::chrono_literals;
+
     while (true) {
         // Only do work if we have observers.
         waitUntilObservers();

Modified: trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm (217723 => 217724)


--- trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm	2017-06-02 18:20:47 UTC (rev 217724)
@@ -66,6 +66,8 @@
 void jettisonExpensiveObjectsOnTopLevelNavigation()
 {
 #if PLATFORM(IOS)
+    using namespace std::literals::chrono_literals;
+
     // Protect against doing excessive jettisoning during repeated navigations.
     const auto minimumTimeSinceNavigation = 2s;
 

Modified: trunk/Source/WebCore/platform/network/CacheValidation.cpp (217723 => 217724)


--- trunk/Source/WebCore/platform/network/CacheValidation.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/platform/network/CacheValidation.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -38,6 +38,8 @@
 
 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.
@@ -113,6 +115,7 @@
 std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse& response, std::chrono::system_clock::time_point responseTime)
 {
     using namespace std::chrono;
+
     ASSERT(response.url().protocolIsInHTTPFamily());
 
     // Freshness Lifetime:

Modified: trunk/Source/WebCore/platform/network/CacheValidation.h (217723 => 217724)


--- trunk/Source/WebCore/platform/network/CacheValidation.h	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebCore/platform/network/CacheValidation.h	2017-06-02 18:20:47 UTC (rev 217724)
@@ -23,11 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef CacheValidation_h
-#define CacheValidation_h
+#pragma once
 
 #include "PlatformExportMacros.h"
 #include "SessionID.h"
+#include <chrono>
 #include <wtf/Optional.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -77,5 +77,3 @@
 WEBCORE_EXPORT bool isStatusCodePotentiallyCacheable(int statusCode);
 
 }
-
-#endif

Modified: trunk/Source/WebKit2/ChangeLog (217723 => 217724)


--- trunk/Source/WebKit2/ChangeLog	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-02 18:20:47 UTC (rev 217724)
@@ -1,3 +1,20 @@
+2017-06-02  Simon Fraser  <simon.fra...@apple.com>
+
+        Get <chrono> out of StdLibExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=172744
+
+        Reviewed by Zalan Bujtas.
+
+        Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        * NetworkProcess/cache/NetworkCacheFileSystem.h:
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::computeRecordWorth):
+        * Shared/mac/RemoteLayerBackingStoreCollection.mm:
+        * WebProcess/Cookies/WebCookieManager.h:
+
 2017-06-02  Andy Estes  <aes...@apple.com>
 
         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (217723 => 217724)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -50,6 +50,8 @@
 #include <notify.h>
 #endif
 
+using namespace std::literals::chrono_literals;
+
 namespace WebKit {
 namespace NetworkCache {
 

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.h (217723 => 217724)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.h	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheFileSystem.h	2017-06-02 18:20:47 UTC (rev 217724)
@@ -23,12 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NetworkCacheFileSystem_h
-#define NetworkCacheFileSystem_h
+#pragma once
 
 #if ENABLE(NETWORK_CACHE)
 
 #include <WebCore/FileSystem.h>
+#include <chrono>
 #include <functional>
 
 namespace WebKit {
@@ -52,6 +52,3 @@
 }
 
 #endif 
-
-#endif
-

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp (217723 => 217724)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -46,6 +46,7 @@
 namespace NetworkCache {
 
 using namespace WebCore;
+using namespace std::literals::chrono_literals;
 
 static const Seconds preloadedEntryLifetime { 10_s };
 

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (217723 => 217724)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -934,6 +934,8 @@
 static double computeRecordWorth(FileTimes times)
 {
     using namespace std::chrono;
+    using namespace std::literals::chrono_literals;
+
     auto age = system_clock::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;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm (217723 => 217724)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm	2017-06-02 18:20:47 UTC (rev 217724)
@@ -30,6 +30,8 @@
 #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 volatilityTimerInterval = 200_ms;

Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h (217723 => 217724)


--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h	2017-06-02 18:20:47 UTC (rev 217724)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebCookieManager_h
-#define WebCookieManager_h
+#pragma once
 
 #include "HTTPCookieAcceptPolicy.h"
 #include "MessageReceiver.h"
@@ -31,6 +30,7 @@
 #include "NetworkProcessSupplement.h"
 #include "WebProcessSupplement.h"
 #include <WebCore/SessionID.h>
+#include <chrono>
 #include <stdint.h>
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
@@ -91,5 +91,3 @@
 };
 
 } // namespace WebKit
-
-#endif // WebCookieManager_h

Modified: trunk/Tools/ChangeLog (217723 => 217724)


--- trunk/Tools/ChangeLog	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Tools/ChangeLog	2017-06-02 18:20:47 UTC (rev 217724)
@@ -1,3 +1,12 @@
+2017-06-02  Simon Fraser  <simon.fra...@apple.com>
+
+        Get <chrono> out of StdLibExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=172744
+
+        Reviewed by Zalan Bujtas.
+
+        * TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
+
 2017-06-02  Zan Dobersek  <zdober...@igalia.com>
 
         [WPE] Enable SUBTLE_CRYPTO

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp (217723 => 217724)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp	2017-06-02 18:14:47 UTC (rev 217723)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp	2017-06-02 18:20:47 UTC (rev 217724)
@@ -35,6 +35,8 @@
 
 namespace TestWebKitAPI {
 
+using namespace std::literals::chrono_literals;
+
 static const char* simpleTestLabel = "simpleTest";
 static const char* longTestLabel = "longTest";
 static const char* thirdTestLabel = "thirdTest";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to