Title: [277038] trunk/Source
Revision
277038
Author
[email protected]
Date
2021-05-05 13:34:53 -0700 (Wed, 05 May 2021)

Log Message

Add WebKitAdditions stubs for new NetworkLoadMetrics
https://bugs.webkit.org/show_bug.cgi?id=225406
<rdar://77563372>

Reviewed by Jer Noble.

Source/WebCore:

I also removed some dead code and added static asserts that do what the dead code was intended to do.

* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy const):
(WebCore::NetworkLoadMetrics::operator== const):
(WebCore::NetworkLoadMetrics::encode const):
(WebCore::NetworkLoadMetrics::decode):
(WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::encode): Deleted.
(WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::decode): Deleted.
* platform/network/cocoa/WebCoreNSURLSession.mm:

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277037 => 277038)


--- trunk/Source/WebCore/ChangeLog	2021-05-05 20:34:06 UTC (rev 277037)
+++ trunk/Source/WebCore/ChangeLog	2021-05-05 20:34:53 UTC (rev 277038)
@@ -1,3 +1,22 @@
+2021-05-05  Alex Christensen  <[email protected]>
+
+        Add WebKitAdditions stubs for new NetworkLoadMetrics
+        https://bugs.webkit.org/show_bug.cgi?id=225406
+        <rdar://77563372>
+
+        Reviewed by Jer Noble.
+
+        I also removed some dead code and added static asserts that do what the dead code was intended to do.
+
+        * platform/network/NetworkLoadMetrics.h:
+        (WebCore::NetworkLoadMetrics::isolatedCopy const):
+        (WebCore::NetworkLoadMetrics::operator== const):
+        (WebCore::NetworkLoadMetrics::encode const):
+        (WebCore::NetworkLoadMetrics::decode):
+        (WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::encode): Deleted.
+        (WTF::Persistence::Coder<Optional<WebCore::NetworkLoadPriority>>::decode): Deleted.
+        * platform/network/cocoa/WebCoreNSURLSession.mm:
+
 2021-05-05  Alicia Boya GarcĂ­a  <[email protected]>
 
         [MSE][GStreamer] WebKitMediaSrc rework v2

Modified: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h (277037 => 277038)


--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h	2021-05-05 20:34:06 UTC (rev 277037)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h	2021-05-05 20:34:53 UTC (rev 277038)
@@ -33,6 +33,18 @@
 #include <wtf/persistence/PersistentCoder.h>
 #include <wtf/text/WTFString.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/NetworkLoadMetricsAdditions.h>
+#else
+#define NETWORK_LOAD_METRICS_ADDITIONS_1
+#define NETWORK_LOAD_METRICS_ADDITIONS_2
+#define NETWORK_LOAD_METRICS_ADDITIONS_3
+#define NETWORK_LOAD_METRICS_ADDITIONS_4
+#define NETWORK_LOAD_METRICS_ADDITIONS_5
+#define NETWORK_LOAD_METRICS_ADDITIONS_6
+#define NETWORK_LOAD_METRICS_ADDITIONS_7
+#endif
+
 #if PLATFORM(COCOA)
 OBJC_CLASS NSDictionary;
 #endif
@@ -46,6 +58,8 @@
     Unknown,
 };
 
+NETWORK_LOAD_METRICS_ADDITIONS_1;
+
 class NetworkLoadMetricsWithoutNonTimingData {
     WTF_MAKE_FAST_ALLOCATED(NetworkLoadMetricsWithoutNonTimingData);
 public:
@@ -111,6 +125,7 @@
         copy.tlsProtocol = tlsProtocol.isolatedCopy();
         copy.tlsCipher = tlsCipher.isolatedCopy();
         copy.priority = priority;
+        NETWORK_LOAD_METRICS_ADDITIONS_2;
         copy.requestHeaders = requestHeaders.isolatedCopy();
 
         copy.requestHeaderBytesSent = requestHeaderBytesSent;
@@ -145,6 +160,7 @@
             && tlsProtocol == other.tlsProtocol
             && tlsCipher == other.tlsCipher
             && priority == other.priority
+            NETWORK_LOAD_METRICS_ADDITIONS_3
             && requestHeaders == other.requestHeaders
             && requestHeaderBytesSent == other.requestHeaderBytesSent
             && requestBodyBytesSent == other.requestBodyBytesSent
@@ -168,6 +184,7 @@
     String tlsCipher;
 
     NetworkLoadPriority priority { NetworkLoadPriority::Unknown };
+    NETWORK_LOAD_METRICS_ADDITIONS_4;
 
     HTTPHeaderMap requestHeaders;
 
@@ -185,6 +202,8 @@
 template<class Encoder>
 void NetworkLoadMetrics::encode(Encoder& encoder) const
 {
+    static_assert(Encoder::isIPCEncoder, "NetworkLoadMetrics should not be stored by the WTF::Persistence::Encoder");
+
     encoder << fetchStart;
     encoder << domainLookupStart;
     encoder << domainLookupEnd;
@@ -206,6 +225,7 @@
     encoder << tlsProtocol;
     encoder << tlsCipher;
     encoder << priority;
+    NETWORK_LOAD_METRICS_ADDITIONS_5;
     encoder << requestHeaders;
     encoder << requestHeaderBytesSent;
     encoder << requestBodyBytesSent;
@@ -217,6 +237,8 @@
 template<class Decoder>
 bool NetworkLoadMetrics::decode(Decoder& decoder, NetworkLoadMetrics& metrics)
 {
+    static_assert(Decoder::isIPCDecoder, "NetworkLoadMetrics should not be stored by the WTF::Persistence::Encoder");
+
     return decoder.decode(metrics.fetchStart)
         && decoder.decode(metrics.domainLookupStart)
         && decoder.decode(metrics.domainLookupEnd)
@@ -238,6 +260,7 @@
         && decoder.decode(metrics.tlsProtocol)
         && decoder.decode(metrics.tlsCipher)
         && decoder.decode(metrics.priority)
+        NETWORK_LOAD_METRICS_ADDITIONS_6
         && decoder.decode(metrics.requestHeaders)
         && decoder.decode(metrics.requestHeaderBytesSent)
         && decoder.decode(metrics.requestBodyBytesSent)
@@ -248,21 +271,4 @@
 
 } // namespace WebCore
 
-// NetworkLoadMetrics should not be stored by the WTF::Persistence::Decoder.
-namespace WTF {
-namespace Persistence {
-
-template<> struct Coder<Optional<WebCore::NetworkLoadPriority>> {
-    static NO_RETURN_DUE_TO_ASSERT void encode(Encoder&, const Optional<WebCore::NetworkLoadPriority>&)
-    {
-        ASSERT_NOT_REACHED();
-    }
-
-    static bool decode(Decoder&, Optional<WebCore::NetworkLoadPriority>&)
-    {
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-};
-
-}} // namespace WTF::Persistence
+NETWORK_LOAD_METRICS_ADDITIONS_7

Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (277037 => 277038)


--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2021-05-05 20:34:06 UTC (rev 277037)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm	2021-05-05 20:34:53 UTC (rev 277038)
@@ -30,11 +30,19 @@
 #import "ParsedRequestRange.h"
 #import "PlatformMediaResourceLoader.h"
 #import "SubresourceLoader.h"
+#import <pal/spi/cf/CFNetworkSPI.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/CompletionHandler.h>
 #import <wtf/WeakObjCPtr.h>
 #import <wtf/cocoa/VectorCocoa.h>
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebCoreNSURLSessionAdditions.h>
+#else
+#define WEBCORE_SESSION_ADDITIONS_1
+#define WEBCORE_SESSION_ADDITIONS_2
+#endif
+
 using namespace WebCore;
 
 #pragma mark - Private declarations
@@ -67,6 +75,7 @@
 @property (readonly, getter=isExpensive) BOOL expensive;
 @property (readonly, getter=isConstrained) BOOL constrained;
 @property (readonly, getter=isMultipath) BOOL multipath;
+WEBCORE_SESSION_ADDITIONS_1;
 @end
 
 @implementation WebCoreNSURLSessionTaskTransactionMetrics {
@@ -147,6 +156,8 @@
     return _metrics.isReusedConnection;
 }
 
+WEBCORE_SESSION_ADDITIONS_2
+
 @dynamic cellular;
 - (BOOL)cellular
 {

Modified: trunk/Source/WebKit/ChangeLog (277037 => 277038)


--- trunk/Source/WebKit/ChangeLog	2021-05-05 20:34:06 UTC (rev 277037)
+++ trunk/Source/WebKit/ChangeLog	2021-05-05 20:34:53 UTC (rev 277038)
@@ -1,3 +1,14 @@
+2021-05-05  Alex Christensen  <[email protected]>
+
+        Add WebKitAdditions stubs for new NetworkLoadMetrics
+        https://bugs.webkit.org/show_bug.cgi?id=225406
+        <rdar://77563372>
+
+        Reviewed by Jer Noble.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
+
 2021-05-05  Dean Jackson  <[email protected]>
 
         Separated layers need to be configured

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (277037 => 277038)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-05-05 20:34:06 UTC (rev 277037)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-05-05 20:34:53 UTC (rev 277038)
@@ -64,6 +64,8 @@
 #import <WebKitAdditions/NetworkSessionCocoaAdditions.h>
 #else
 #define NETWORK_SESSION_COCOA_ADDITIONS_1
+#define NETWORK_SESSION_COCOA_ADDITIONS_2
+#define NETWORK_SESSION_COCOA_ADDITIONS_3
 void WebKit::NetworkSessionCocoa::removeNetworkWebsiteData(WallTime, CompletionHandler<void()>&& completionHandler) { completionHandler(); }
 #endif
 
@@ -120,6 +122,8 @@
     return WebCore::NetworkLoadPriority::Medium;
 }
 
+NETWORK_SESSION_COCOA_ADDITIONS_2
+
 #if HAVE(CFNETWORK_NEGOTIATED_SSL_PROTOCOL_CIPHER)
 #if HAVE(CFNETWORK_METRICS_APIS_V4)
 static String stringForTLSProtocolVersion(tls_protocol_version_t protocol)
@@ -801,6 +805,8 @@
 #endif
         networkLoadMetrics.isReusedConnection = m.isReusedConnection;
 
+        NETWORK_SESSION_COCOA_ADDITIONS_3
+
         if (networkDataTask->shouldCaptureExtraNetworkLoadMetrics()) {
             networkLoadMetrics.priority = toNetworkLoadPriority(task.priority);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to