Diff
Modified: trunk/Source/WebCore/ChangeLog (282852 => 282853)
--- trunk/Source/WebCore/ChangeLog 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/ChangeLog 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1,3 +1,73 @@
+2021-09-21 Alex Christensen <[email protected]>
+
+ Reduce sizeof(NetworkLoadMetrics)
+ https://bugs.webkit.org/show_bug.cgi?id=226982
+
+ Reviewed by Chris Dumez.
+
+ No change in behavior. Just greatly reducing the size of a common structure.
+
+ We take all the members that aren't used without the inspector and move them to a new struct,
+ AdditionalNetworkLoadMetricsForWebInspector. We also remove some equality comparison that
+ was unnecessary because it was only used for AuthenticationChallenge equality comparisons in
+ ResourceHandleMac. We also use emptyMetrics() to remove a few unnecessary and hard to see
+ copy constructor calls.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/agents/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
+ (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
+ * loader/DocumentThreadableLoader.cpp:
+ (WebCore::DocumentThreadableLoader::loadRequest):
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::didReceiveResponse):
+ (WebCore::SubresourceLoader::didFinishLoading):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ * platform/network/AuthenticationChallengeBase.cpp:
+ (WebCore::AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison):
+ (WebCore::AuthenticationChallengeBase::compare): Deleted.
+ * platform/network/AuthenticationChallengeBase.h:
+ (WebCore::operator==): Deleted.
+ (WebCore::operator!=): Deleted.
+ * platform/network/NetworkLoadMetrics.cpp: Added.
+ (WebCore::NetworkLoadMetrics::NetworkLoadMetrics):
+ (WebCore::NetworkLoadMetrics::emptyMetrics):
+ (WebCore::AdditionalNetworkLoadMetricsForWebInspector::isolatedCopy):
+ (WebCore::NetworkLoadMetrics::isolatedCopy const):
+ * platform/network/NetworkLoadMetrics.h:
+ (WebCore::NetworkLoadMetrics::encode const):
+ (WebCore::NetworkLoadMetrics::decode):
+ (WebCore::AdditionalNetworkLoadMetricsForWebInspector::encode const):
+ (WebCore::AdditionalNetworkLoadMetricsForWebInspector::decode):
+ (WebCore::NetworkLoadMetricsWithoutNonTimingData::isComplete const): Deleted.
+ (WebCore::NetworkLoadMetricsWithoutNonTimingData::markComplete): Deleted.
+ (WebCore::NetworkLoadMetrics::NetworkLoadMetrics): Deleted.
+ (WebCore::NetworkLoadMetrics::isolatedCopy const): Deleted.
+ (WebCore::NetworkLoadMetrics::operator== const): Deleted.
+ (WebCore::NetworkLoadMetrics::operator!= const): Deleted.
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::ResourceResponseBase::equalForWebKitLegacyChallengeComparison):
+ (WebCore::ResourceResponseBase::compare): Deleted.
+ * platform/network/ResourceResponseBase.h:
+ (WebCore::operator==): Deleted.
+ (WebCore::operator!=): Deleted.
+ * platform/network/curl/CurlContext.cpp:
+ (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
+ * platform/network/curl/CurlRequest.cpp:
+ (WebCore::CurlRequest::networkLoadMetrics):
+ * platform/network/curl/ResourceHandleCurl.cpp:
+ (WebCore::ResourceHandle::receivedCredential):
+ (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
+ (WebCore::ResourceHandle::receivedCancellation):
+ * platform/network/mac/ResourceHandleMac.mm:
+ (WebCore::ResourceHandle::receivedCredential):
+ (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
+ (WebCore::ResourceHandle::receivedCancellation):
+ (WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling):
+ (WebCore::ResourceHandle::receivedChallengeRejection):
+
2021-09-21 Myles C. Maxfield <[email protected]>
Parsing support for font-palette
Modified: trunk/Source/WebCore/Sources.txt (282852 => 282853)
--- trunk/Source/WebCore/Sources.txt 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/Sources.txt 2021-09-22 00:27:22 UTC (rev 282853)
@@ -2127,6 +2127,7 @@
platform/network/HTTPHeaderValues.cpp
platform/network/HTTPParsers.cpp
platform/network/MIMEHeader.cpp
+platform/network/NetworkLoadMetrics.cpp
platform/network/NetworkStateNotifier.cpp
platform/network/NetworkStorageSession.cpp
platform/network/ParsedContentRange.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (282852 => 282853)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-22 00:27:22 UTC (rev 282853)
@@ -9871,6 +9871,7 @@
5C9EF2F221F06171003BDC56 /* StorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageSessionProvider.h; sourceTree = "<group>"; };
5CA1DEC21F71E68600E71BD3 /* HTTPHeaderField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderField.cpp; sourceTree = "<group>"; };
5CA1DEC41F71E68700E71BD3 /* HTTPHeaderField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHeaderField.h; sourceTree = "<group>"; };
+ 5CAF7AAF26FA99680003F19E /* NetworkLoadMetrics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkLoadMetrics.cpp; sourceTree = "<group>"; };
5CB37FFC1C62D27800F20188 /* ScrollbarsControllerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarsControllerMock.cpp; sourceTree = "<group>"; };
5CB37FFD1C62D27800F20188 /* ScrollbarsControllerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarsControllerMock.h; sourceTree = "<group>"; };
5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaAccessibilitySoftLink.cpp; sourceTree = "<group>"; };
@@ -22067,6 +22068,7 @@
514C765E0CE923A1007EF3CD /* HTTPParsers.h */,
628D214B12131ED10055DCFC /* NetworkingContext.h */,
416D759F20C6441300D02D2C /* NetworkLoadInformation.h */,
+ 5CAF7AAF26FA99680003F19E /* NetworkLoadMetrics.cpp */,
8A81BF8411DCFD9000DA2B98 /* NetworkLoadMetrics.h */,
1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */,
1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */,
Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (282852 => 282853)
--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -263,21 +263,22 @@
if (!networkLoadMetrics.protocol.isNull())
metrics->setProtocol(networkLoadMetrics.protocol);
- if (networkLoadMetrics.priority != NetworkLoadPriority::Unknown)
- metrics->setPriority(toProtocol(networkLoadMetrics.priority));
- if (!networkLoadMetrics.remoteAddress.isNull())
- metrics->setRemoteAddress(networkLoadMetrics.remoteAddress);
- if (!networkLoadMetrics.connectionIdentifier.isNull())
- metrics->setConnectionIdentifier(networkLoadMetrics.connectionIdentifier);
- if (!networkLoadMetrics.requestHeaders.isEmpty())
- metrics->setRequestHeaders(buildObjectForHeaders(networkLoadMetrics.requestHeaders));
-
- if (networkLoadMetrics.requestHeaderBytesSent != std::numeric_limits<uint64_t>::max())
- metrics->setRequestHeaderBytesSent(networkLoadMetrics.requestHeaderBytesSent);
- if (networkLoadMetrics.requestBodyBytesSent != std::numeric_limits<uint64_t>::max())
- metrics->setRequestBodyBytesSent(networkLoadMetrics.requestBodyBytesSent);
- if (networkLoadMetrics.responseHeaderBytesReceived != std::numeric_limits<uint64_t>::max())
- metrics->setResponseHeaderBytesReceived(networkLoadMetrics.responseHeaderBytesReceived);
+ if (auto* additionalMetrics = networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector.get()) {
+ if (additionalMetrics->priority != NetworkLoadPriority::Unknown)
+ metrics->setPriority(toProtocol(additionalMetrics->priority));
+ if (!additionalMetrics->remoteAddress.isNull())
+ metrics->setRemoteAddress(additionalMetrics->remoteAddress);
+ if (!additionalMetrics->connectionIdentifier.isNull())
+ metrics->setConnectionIdentifier(additionalMetrics->connectionIdentifier);
+ if (!additionalMetrics->requestHeaders.isEmpty())
+ metrics->setRequestHeaders(buildObjectForHeaders(additionalMetrics->requestHeaders));
+ if (additionalMetrics->requestHeaderBytesSent != std::numeric_limits<uint64_t>::max())
+ metrics->setRequestHeaderBytesSent(additionalMetrics->requestHeaderBytesSent);
+ if (additionalMetrics->requestBodyBytesSent != std::numeric_limits<uint64_t>::max())
+ metrics->setRequestBodyBytesSent(additionalMetrics->requestBodyBytesSent);
+ if (additionalMetrics->responseHeaderBytesReceived != std::numeric_limits<uint64_t>::max())
+ metrics->setResponseHeaderBytesReceived(additionalMetrics->responseHeaderBytesReceived);
+ }
if (networkLoadMetrics.responseBodyBytesReceived != std::numeric_limits<uint64_t>::max())
metrics->setResponseBodyBytesReceived(networkLoadMetrics.responseBodyBytesReceived);
if (networkLoadMetrics.responseBodyDecodedSize != std::numeric_limits<uint64_t>::max())
@@ -286,12 +287,13 @@
auto connectionPayload = Protocol::Security::Connection::create()
.release();
- if (!networkLoadMetrics.tlsProtocol.isEmpty())
- connectionPayload->setProtocol(networkLoadMetrics.tlsProtocol);
+ if (auto* additionalMetrics = networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector.get()) {
+ if (!additionalMetrics->tlsProtocol.isEmpty())
+ connectionPayload->setProtocol(additionalMetrics->tlsProtocol);
+ if (!additionalMetrics->tlsCipher.isEmpty())
+ connectionPayload->setCipher(additionalMetrics->tlsCipher);
+ }
- if (!networkLoadMetrics.tlsCipher.isEmpty())
- connectionPayload->setCipher(networkLoadMetrics.tlsCipher);
-
metrics->setSecurityConnection(WTFMove(connectionPayload));
return metrics;
@@ -353,7 +355,7 @@
if (resourceLoader) {
auto* metrics = response.deprecatedNetworkLoadMetricsOrNull();
- responseObject->setTiming(buildObjectForTiming(metrics ? *metrics : NetworkLoadMetrics { }, *resourceLoader));
+ responseObject->setTiming(buildObjectForTiming(metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), *resourceLoader));
}
if (auto& certificateInfo = response.certificateInfo()) {
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (282852 => 282853)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1393,7 +1393,7 @@
if (document.settings().performanceNavigationTimingAPIEnabled() && m_mainResource) {
auto* metrics = m_response.deprecatedNetworkLoadMetricsOrNull();
- window->performance().addNavigationTiming(*this, document, *m_mainResource, timing(), metrics ? *metrics : NetworkLoadMetrics { });
+ window->performance().addNavigationTiming(*this, document, *m_mainResource, timing(), metrics ? *metrics : NetworkLoadMetrics::emptyMetrics());
}
}
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (282852 => 282853)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -664,7 +664,7 @@
}
const auto* timing = response.deprecatedNetworkLoadMetricsOrNull();
- auto resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, timing ? *timing : NetworkLoadMetrics { }, response, securityOrigin());
+ auto resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, timing ? *timing : NetworkLoadMetrics::emptyMetrics(), response, securityOrigin());
if (options().initiatorContext == InitiatorContext::Worker)
finishedTimingForWorkerLoad(resourceTiming);
else {
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (282852 => 282853)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -498,7 +498,7 @@
if (responseHasHTTPStatusCodeError()) {
m_loadTiming.markEndTime();
auto* metrics = this->response().deprecatedNetworkLoadMetricsOrNull();
- reportResourceTiming(metrics ? *metrics : NetworkLoadMetrics { });
+ reportResourceTiming(metrics ? *metrics : NetworkLoadMetrics::emptyMetrics());
m_state = Finishing;
m_resource->error(CachedResource::LoadError);
@@ -741,7 +741,7 @@
// complete load metrics in didFinishLoad. In those cases, fall back to the possibility
// that they populated partial load timing information on the ResourceResponse.
const auto* timing = m_resource->response().deprecatedNetworkLoadMetricsOrNull();
- reportResourceTiming(timing ? *timing : NetworkLoadMetrics { });
+ reportResourceTiming(timing ? *timing : NetworkLoadMetrics::emptyMetrics());
}
if (m_resource->type() != CachedResource::Type::MainResource)
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (282852 => 282853)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1041,7 +1041,7 @@
// for this document because it may have been speculatively preloaded.
if (auto metricsFromResource = resource->takeNetworkLoadMetrics(); metricsFromResource && documentLoader && metricsFromResource->redirectStart >= documentLoader->timing().timeOrigin())
metrics = WTFMove(metricsFromResource);
- auto resourceTiming = ResourceTiming::fromMemoryCache(url, request.initiatorName(), loadTiming, resource->response(), metrics ? *metrics : NetworkLoadMetrics { }, *request.origin());
+ auto resourceTiming = ResourceTiming::fromMemoryCache(url, request.initiatorName(), loadTiming, resource->response(), metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), *request.origin());
if (initiatorContext == InitiatorContext::Worker) {
ASSERT(is<CachedRawResource>(resource.get()));
downcast<CachedRawResource>(resource.get())->finishedTimingForWorkerLoad(WTFMove(resourceTiming));
Modified: trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -82,7 +82,7 @@
m_isNull = true;
}
-bool AuthenticationChallengeBase::compare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
+bool AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
if (a.isNull() && b.isNull())
return true;
@@ -99,9 +99,9 @@
if (a.previousFailureCount() != b.previousFailureCount())
return false;
- if (a.failureResponse() != b.failureResponse())
+ if (!ResourceResponseBase::equalForWebKitLegacyChallengeComparison(a.failureResponse(), b.failureResponse()))
return false;
-
+
if (a.error() != b.error())
return false;
Modified: trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.h (282852 => 282853)
--- trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.h 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/AuthenticationChallengeBase.h 2021-09-22 00:27:22 UTC (rev 282853)
@@ -48,7 +48,7 @@
WEBCORE_EXPORT bool isNull() const;
WEBCORE_EXPORT void nullify();
- WEBCORE_EXPORT static bool compare(const AuthenticationChallenge& a, const AuthenticationChallenge& b);
+ WEBCORE_EXPORT static bool equalForWebKitLegacyChallengeComparison(const AuthenticationChallenge&, const AuthenticationChallenge&);
protected:
// The AuthenticationChallenge subclass may "shadow" this method to compare platform specific fields
@@ -62,9 +62,6 @@
ResourceError m_error;
};
-inline bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return AuthenticationChallengeBase::compare(a, b); }
-inline bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return !(a == b); }
-
}
#endif
Added: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp (0 => 282853)
--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkLoadMetrics.h"
+
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+NetworkLoadMetrics::NetworkLoadMetrics()
+ : complete(false)
+ , cellular(false)
+ , expensive(false)
+ , constrained(false)
+ , multipath(false)
+ , isReusedConnection(false)
+ , failsTAOCheck(false)
+ , hasCrossOriginRedirect(false) { }
+
+const NetworkLoadMetrics& NetworkLoadMetrics::emptyMetrics()
+{
+ static NeverDestroyed<NetworkLoadMetrics> metrics;
+ return metrics.get();
+}
+
+Ref<AdditionalNetworkLoadMetricsForWebInspector> AdditionalNetworkLoadMetricsForWebInspector::isolatedCopy()
+{
+ auto copy = AdditionalNetworkLoadMetricsForWebInspector::create();
+ copy->priority = priority;
+ copy->remoteAddress = remoteAddress.isolatedCopy();
+ copy->connectionIdentifier = connectionIdentifier.isolatedCopy();
+ copy->tlsProtocol = tlsProtocol.isolatedCopy();
+ copy->tlsCipher = tlsCipher.isolatedCopy();
+ copy->requestHeaders = requestHeaders.isolatedCopy();
+ copy->requestHeaderBytesSent = requestHeaderBytesSent;
+ copy->responseHeaderBytesReceived = responseHeaderBytesReceived;
+ copy->requestBodyBytesSent = requestBodyBytesSent;
+ return copy;
+}
+
+NetworkLoadMetrics NetworkLoadMetrics::isolatedCopy() const
+{
+ NetworkLoadMetrics copy;
+
+ copy.redirectStart = redirectStart.isolatedCopy();
+ copy.fetchStart = fetchStart.isolatedCopy();
+ copy.domainLookupStart = domainLookupStart.isolatedCopy();
+ copy.domainLookupEnd = domainLookupEnd.isolatedCopy();
+ copy.connectStart = connectStart.isolatedCopy();
+ copy.secureConnectionStart = secureConnectionStart.isolatedCopy();
+ copy.connectEnd = connectEnd.isolatedCopy();
+ copy.requestStart = requestStart.isolatedCopy();
+ copy.responseStart = responseStart.isolatedCopy();
+ copy.responseEnd = responseEnd.isolatedCopy();
+
+ copy.protocol = protocol.isolatedCopy();
+
+ copy.redirectCount = redirectCount;
+
+ copy.complete = complete;
+ copy.cellular = cellular;
+ copy.expensive = expensive;
+ copy.constrained = constrained;
+ copy.multipath = multipath;
+ copy.isReusedConnection = isReusedConnection;
+ copy.failsTAOCheck = failsTAOCheck;
+ copy.hasCrossOriginRedirect = hasCrossOriginRedirect;
+
+ copy.privacyStance = privacyStance;
+
+ copy.responseBodyBytesReceived = responseBodyBytesReceived;
+ copy.responseBodyDecodedSize = responseBodyDecodedSize;
+
+ if (additionalNetworkLoadMetricsForWebInspector)
+ copy.additionalNetworkLoadMetricsForWebInspector = additionalNetworkLoadMetricsForWebInspector->isolatedCopy();
+
+ return copy;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h (282852 => 282853)
--- trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/NetworkLoadMetrics.h 2021-09-22 00:27:22 UTC (rev 282853)
@@ -34,7 +34,6 @@
#if PLATFORM(COCOA)
OBJC_CLASS NSURLConnection;
-OBJC_CLASS NSURLResponse;
OBJC_CLASS NSURLSessionTaskMetrics;
#endif
@@ -59,9 +58,20 @@
constexpr MonotonicTime reusedTLSConnectionSentinel { MonotonicTime::fromRawSeconds(-1) };
-class NetworkLoadMetricsWithoutNonTimingData {
- WTF_MAKE_FAST_ALLOCATED(NetworkLoadMetricsWithoutNonTimingData);
+struct AdditionalNetworkLoadMetricsForWebInspector;
+
+class NetworkLoadMetrics {
+ WTF_MAKE_FAST_ALLOCATED(NetworkLoadMetrics);
public:
+ WEBCORE_EXPORT NetworkLoadMetrics();
+
+ static const NetworkLoadMetrics& emptyMetrics();
+
+ NetworkLoadMetrics isolatedCopy() const;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static std::optional<NetworkLoadMetrics> decode(Decoder&);
+
bool isComplete() const { return complete; }
void markComplete() { complete = true; }
@@ -82,111 +92,34 @@
uint16_t redirectCount { 0 };
- // FIXME: These could all be made bit fields.
- bool complete { false };
- bool cellular { false };
- bool expensive { false };
- bool constrained { false };
- bool multipath { false };
- bool isReusedConnection { false };
- bool failsTAOCheck { false };
- bool hasCrossOriginRedirect { false };
-};
+ bool complete : 1;
+ bool cellular : 1;
+ bool expensive : 1;
+ bool constrained : 1;
+ bool multipath : 1;
+ bool isReusedConnection : 1;
+ bool failsTAOCheck : 1;
+ bool hasCrossOriginRedirect : 1;
-class NetworkLoadMetrics : public NetworkLoadMetricsWithoutNonTimingData {
-public:
- NetworkLoadMetrics()
- : NetworkLoadMetricsWithoutNonTimingData()
- {
- }
+ PrivacyStance privacyStance { PrivacyStance::Unknown };
- NetworkLoadMetrics isolatedCopy() const
- {
- NetworkLoadMetrics copy;
+ uint64_t responseBodyBytesReceived { std::numeric_limits<uint64_t>::max() };
+ uint64_t responseBodyDecodedSize { std::numeric_limits<uint64_t>::max() };
- copy.redirectStart = redirectStart;
- copy.fetchStart = fetchStart;
+ RefPtr<AdditionalNetworkLoadMetricsForWebInspector> additionalNetworkLoadMetricsForWebInspector;
+};
- copy.domainLookupStart = domainLookupStart;
- copy.domainLookupEnd = domainLookupEnd;
- copy.connectStart = connectStart;
- copy.secureConnectionStart = secureConnectionStart;
- copy.connectEnd = connectEnd;
- copy.requestStart = requestStart;
- copy.responseStart = responseStart;
- copy.responseEnd = responseEnd;
- copy.complete = complete;
- copy.protocol = protocol.isolatedCopy();
- copy.redirectCount = redirectCount;
- copy.cellular = cellular;
- copy.expensive = expensive;
- copy.constrained = constrained;
- copy.multipath = multipath;
- copy.isReusedConnection = isReusedConnection;
- copy.failsTAOCheck = failsTAOCheck;
- copy.hasCrossOriginRedirect = hasCrossOriginRedirect;
+struct AdditionalNetworkLoadMetricsForWebInspector : public RefCounted<AdditionalNetworkLoadMetricsForWebInspector> {
- copy.remoteAddress = remoteAddress.isolatedCopy();
- copy.connectionIdentifier = connectionIdentifier.isolatedCopy();
- copy.tlsProtocol = tlsProtocol.isolatedCopy();
- copy.tlsCipher = tlsCipher.isolatedCopy();
- copy.priority = priority;
- copy.privacyStance = privacyStance;
- copy.requestHeaders = requestHeaders.isolatedCopy();
+ static Ref<AdditionalNetworkLoadMetricsForWebInspector> create() { return adoptRef(*new AdditionalNetworkLoadMetricsForWebInspector()); }
+ Ref<AdditionalNetworkLoadMetricsForWebInspector> isolatedCopy() const;
- copy.requestHeaderBytesSent = requestHeaderBytesSent;
- copy.requestBodyBytesSent = requestBodyBytesSent;
- copy.responseHeaderBytesReceived = responseHeaderBytesReceived;
- copy.responseBodyBytesReceived = responseBodyBytesReceived;
- copy.responseBodyDecodedSize = responseBodyDecodedSize;
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static RefPtr<AdditionalNetworkLoadMetricsForWebInspector> decode(Decoder&);
+ Ref<AdditionalNetworkLoadMetricsForWebInspector> isolatedCopy();
- return copy;
- }
+ NetworkLoadPriority priority { NetworkLoadPriority::Unknown };
- bool operator==(const NetworkLoadMetrics& other) const
- {
- return redirectStart == other.redirectStart
- && fetchStart == other.fetchStart
- && domainLookupStart == other.domainLookupStart
- && domainLookupEnd == other.domainLookupEnd
- && connectStart == other.connectStart
- && secureConnectionStart == other.secureConnectionStart
- && connectEnd == other.connectEnd
- && requestStart == other.requestStart
- && responseStart == other.responseStart
- && responseEnd == other.responseEnd
- && complete == other.complete
- && cellular == other.cellular
- && expensive == other.expensive
- && constrained == other.constrained
- && multipath == other.multipath
- && isReusedConnection == other.isReusedConnection
- && failsTAOCheck == other.failsTAOCheck
- && hasCrossOriginRedirect == other.hasCrossOriginRedirect
- && protocol == other.protocol
- && redirectCount == other.redirectCount
- && remoteAddress == other.remoteAddress
- && connectionIdentifier == other.connectionIdentifier
- && tlsProtocol == other.tlsProtocol
- && tlsCipher == other.tlsCipher
- && priority == other.priority
- && privacyStance == other.privacyStance
- && requestHeaders == other.requestHeaders
- && requestHeaderBytesSent == other.requestHeaderBytesSent
- && requestBodyBytesSent == other.requestBodyBytesSent
- && responseHeaderBytesReceived == other.responseHeaderBytesReceived
- && responseBodyBytesReceived == other.responseBodyBytesReceived
- && responseBodyDecodedSize == other.responseBodyDecodedSize;
- }
-
- bool operator!=(const NetworkLoadMetrics& other) const
- {
- return !(*this == other);
- }
-
- template<class Encoder> void encode(Encoder&) const;
- template<class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, NetworkLoadMetrics&);
-
String remoteAddress;
String connectionIdentifier;
@@ -193,16 +126,13 @@
String tlsProtocol;
String tlsCipher;
- NetworkLoadPriority priority { NetworkLoadPriority::Unknown };
- PrivacyStance privacyStance { PrivacyStance::Unknown };
-
HTTPHeaderMap requestHeaders;
uint64_t requestHeaderBytesSent { std::numeric_limits<uint64_t>::max() };
uint64_t responseHeaderBytesReceived { std::numeric_limits<uint64_t>::max() };
uint64_t requestBodyBytesSent { std::numeric_limits<uint64_t>::max() };
- uint64_t responseBodyBytesReceived { std::numeric_limits<uint64_t>::max() };
- uint64_t responseBodyDecodedSize { std::numeric_limits<uint64_t>::max() };
+private:
+ AdditionalNetworkLoadMetricsForWebInspector() { }
};
#if PLATFORM(COCOA)
@@ -225,6 +155,11 @@
encoder << requestStart;
encoder << responseStart;
encoder << responseEnd;
+
+ encoder << protocol;
+
+ encoder << redirectCount;
+
encoder << complete;
encoder << cellular;
encoder << expensive;
@@ -233,28 +168,26 @@
encoder << isReusedConnection;
encoder << failsTAOCheck;
encoder << hasCrossOriginRedirect;
- encoder << protocol;
- encoder << redirectCount;
- encoder << remoteAddress;
- encoder << connectionIdentifier;
- encoder << tlsProtocol;
- encoder << tlsCipher;
- encoder << priority;
+
encoder << privacyStance;
- encoder << requestHeaders;
- encoder << requestHeaderBytesSent;
- encoder << requestBodyBytesSent;
- encoder << responseHeaderBytesReceived;
+
encoder << responseBodyBytesReceived;
encoder << responseBodyDecodedSize;
+
+ if (additionalNetworkLoadMetricsForWebInspector) {
+ encoder << true;
+ encoder << *additionalNetworkLoadMetricsForWebInspector;
+ } else
+ encoder << false;
}
template<class Decoder>
-bool NetworkLoadMetrics::decode(Decoder& decoder, NetworkLoadMetrics& metrics)
+std::optional<NetworkLoadMetrics> NetworkLoadMetrics::decode(Decoder& decoder)
{
static_assert(Decoder::isIPCDecoder, "NetworkLoadMetrics should not be stored by the WTF::Persistence::Encoder");
- return decoder.decode(metrics.redirectStart)
+ NetworkLoadMetrics metrics;
+ if (!(decoder.decode(metrics.redirectStart)
&& decoder.decode(metrics.fetchStart)
&& decoder.decode(metrics.domainLookupStart)
&& decoder.decode(metrics.domainLookupEnd)
@@ -264,30 +197,153 @@
&& decoder.decode(metrics.requestStart)
&& decoder.decode(metrics.responseStart)
&& decoder.decode(metrics.responseEnd)
- && decoder.decode(metrics.complete)
- && decoder.decode(metrics.cellular)
- && decoder.decode(metrics.expensive)
- && decoder.decode(metrics.constrained)
- && decoder.decode(metrics.multipath)
- && decoder.decode(metrics.isReusedConnection)
- && decoder.decode(metrics.failsTAOCheck)
- && decoder.decode(metrics.hasCrossOriginRedirect)
&& decoder.decode(metrics.protocol)
- && decoder.decode(metrics.redirectCount)
- && decoder.decode(metrics.remoteAddress)
- && decoder.decode(metrics.connectionIdentifier)
- && decoder.decode(metrics.tlsProtocol)
- && decoder.decode(metrics.tlsCipher)
- && decoder.decode(metrics.priority)
- && decoder.decode(metrics.privacyStance)
- && decoder.decode(metrics.requestHeaders)
- && decoder.decode(metrics.requestHeaderBytesSent)
- && decoder.decode(metrics.requestBodyBytesSent)
- && decoder.decode(metrics.responseHeaderBytesReceived)
+ && decoder.decode(metrics.redirectCount)))
+ return std::nullopt;
+
+ std::optional<bool> complete;
+ decoder >> complete;
+ if (!complete)
+ return std::nullopt;
+ metrics.complete = WTFMove(*complete);
+
+ std::optional<bool> cellular;
+ decoder >> cellular;
+ if (!cellular)
+ return std::nullopt;
+ metrics.cellular = WTFMove(*cellular);
+
+ std::optional<bool> expensive;
+ decoder >> expensive;
+ if (!expensive)
+ return std::nullopt;
+ metrics.expensive = WTFMove(*expensive);
+
+ std::optional<bool> constrained;
+ decoder >> constrained;
+ if (!constrained)
+ return std::nullopt;
+ metrics.constrained = WTFMove(*constrained);
+
+ std::optional<bool> multipath;
+ decoder >> multipath;
+ if (!multipath)
+ return std::nullopt;
+ metrics.multipath = WTFMove(*multipath);
+
+ std::optional<bool> isReusedConnection;
+ decoder >> isReusedConnection;
+ if (!isReusedConnection)
+ return std::nullopt;
+ metrics.isReusedConnection = WTFMove(*isReusedConnection);
+
+ std::optional<bool> failsTAOCheck;
+ decoder >> failsTAOCheck;
+ if (!failsTAOCheck)
+ return std::nullopt;
+ metrics.failsTAOCheck = WTFMove(*failsTAOCheck);
+
+ std::optional<bool> hasCrossOriginRedirect;
+ decoder >> hasCrossOriginRedirect;
+ if (!hasCrossOriginRedirect)
+ return std::nullopt;
+ metrics.hasCrossOriginRedirect = WTFMove(*hasCrossOriginRedirect);
+
+ if (!(decoder.decode(metrics.privacyStance)
&& decoder.decode(metrics.responseBodyBytesReceived)
- && decoder.decode(metrics.responseBodyDecodedSize);
+ && decoder.decode(metrics.responseBodyDecodedSize)))
+ return std::nullopt;
+
+ std::optional<bool> hasAdditionalNetworkLoadMetricsForWebInspector;
+ decoder >> hasAdditionalNetworkLoadMetricsForWebInspector;
+ if (!hasAdditionalNetworkLoadMetricsForWebInspector)
+ return std::nullopt;
+ if (*hasAdditionalNetworkLoadMetricsForWebInspector) {
+ metrics.additionalNetworkLoadMetricsForWebInspector = AdditionalNetworkLoadMetricsForWebInspector::decode(decoder);
+ if (!metrics.additionalNetworkLoadMetricsForWebInspector)
+ return std::nullopt;
+ }
+ return metrics;
}
+template<class Encoder>
+void AdditionalNetworkLoadMetricsForWebInspector::encode(Encoder& encoder) const
+{
+ encoder << priority;
+ encoder << remoteAddress;
+ encoder << connectionIdentifier;
+
+ encoder << tlsProtocol;
+ encoder << tlsCipher;
+
+ encoder << requestHeaders;
+
+ encoder << requestHeaderBytesSent;
+ encoder << responseHeaderBytesReceived;
+ encoder << requestBodyBytesSent;
+}
+
+template<class Decoder>
+RefPtr<AdditionalNetworkLoadMetricsForWebInspector> AdditionalNetworkLoadMetricsForWebInspector::decode(Decoder& decoder)
+{
+ std::optional<NetworkLoadPriority> priority;
+ decoder >> priority;
+ if (!priority)
+ return nullptr;
+
+ std::optional<String> remoteAddress;
+ decoder >> remoteAddress;
+ if (!remoteAddress)
+ return nullptr;
+
+ std::optional<String> connectionIdentifier;
+ decoder >> connectionIdentifier;
+ if (!connectionIdentifier)
+ return nullptr;
+
+ std::optional<String> tlsProtocol;
+ decoder >> tlsProtocol;
+ if (!tlsProtocol)
+ return nullptr;
+
+ std::optional<String> tlsCipher;
+ decoder >> tlsCipher;
+ if (!tlsCipher)
+ return nullptr;
+
+ std::optional<HTTPHeaderMap> requestHeaders;
+ decoder >> requestHeaders;
+ if (!requestHeaders)
+ return nullptr;
+
+ std::optional<uint64_t> requestHeaderBytesSent;
+ decoder >> requestHeaderBytesSent;
+ if (!requestHeaderBytesSent)
+ return nullptr;
+
+ std::optional<uint64_t> responseHeaderBytesReceived;
+ decoder >> responseHeaderBytesReceived;
+ if (!responseHeaderBytesReceived)
+ return nullptr;
+
+ std::optional<uint64_t> requestBodyBytesSent;
+ decoder >> requestBodyBytesSent;
+ if (!requestBodyBytesSent)
+ return nullptr;
+
+ auto decoded = AdditionalNetworkLoadMetricsForWebInspector::create();
+ decoded->priority = WTFMove(*priority);
+ decoded->remoteAddress = WTFMove(*remoteAddress);
+ decoded->connectionIdentifier = WTFMove(*connectionIdentifier);
+ decoded->tlsProtocol = WTFMove(*tlsProtocol);
+ decoded->tlsCipher = WTFMove(*tlsCipher);
+ decoded->requestHeaders = WTFMove(*requestHeaders);
+ decoded->requestHeaderBytesSent = WTFMove(*requestHeaderBytesSent);
+ decoded->responseHeaderBytesReceived = WTFMove(*responseHeaderBytesReceived);
+ decoded->requestBodyBytesSent = WTFMove(*requestBodyBytesSent);
+ return decoded;
+}
+
} // namespace WebCore
namespace WTF {
@@ -303,4 +359,14 @@
>;
};
+template<> struct EnumTraits<WebCore::NetworkLoadPriority> {
+ using values = EnumValues<
+ WebCore::NetworkLoadPriority,
+ WebCore::NetworkLoadPriority::Low,
+ WebCore::NetworkLoadPriority::Medium,
+ WebCore::NetworkLoadPriority::High,
+ WebCore::NetworkLoadPriority::Unknown
+ >;
+};
+
}
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -802,7 +802,7 @@
const_cast<ResourceResponse*>(static_cast<const ResourceResponse*>(this))->platformLazyInit(initLevel);
}
-bool ResourceResponseBase::compare(const ResourceResponse& a, const ResourceResponse& b)
+bool ResourceResponseBase::equalForWebKitLegacyChallengeComparison(const ResourceResponse& a, const ResourceResponse& b)
{
if (a.isNull() != b.isNull())
return false;
@@ -822,16 +822,6 @@
return false;
if (a.httpHeaderFields() != b.httpHeaderFields())
return false;
- if (a.m_networkLoadMetrics.get() != b.m_networkLoadMetrics.get()) {
- if (!a.m_networkLoadMetrics) {
- if (NetworkLoadMetrics() != *b.m_networkLoadMetrics.get())
- return false;
- } else if (!b.m_networkLoadMetrics) {
- if (NetworkLoadMetrics() != *a.m_networkLoadMetrics.get())
- return false;
- } else if (*a.m_networkLoadMetrics.get() != *b.m_networkLoadMetrics.get())
- return false;
- }
return ResourceResponse::platformCompare(a, b);
}
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (282852 => 282853)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2021-09-22 00:27:22 UTC (rev 282853)
@@ -209,7 +209,7 @@
WEBCORE_EXPORT static ResourceResponse syntheticRedirectResponse(const URL& fromURL, const URL& toURL);
- static bool compare(const ResourceResponse&, const ResourceResponse&);
+ static bool equalForWebKitLegacyChallengeComparison(const ResourceResponse&, const ResourceResponse&);
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder&, ResourceResponseBase&);
@@ -285,9 +285,6 @@
short m_httpStatusCode { 0 };
};
-inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); }
-inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
-
template<class Encoder>
void ResourceResponseBase::encode(Encoder& encoder) const
{
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -413,7 +413,7 @@
LOG(Network, "CFNet - receivedCredential()");
ASSERT(!challenge.isNull());
ASSERT(challenge.cfURLAuthChallengeRef());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
// FIXME: Support empty credentials. Currently, an empty credential cannot be stored in WebCore credential storage, as that's empty value for its map.
@@ -450,7 +450,7 @@
LOG(Network, "CFNet - receivedRequestToContinueWithoutCredential()");
ASSERT(!challenge.isNull());
ASSERT(challenge.cfURLAuthChallengeRef());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (d->m_connection)
@@ -462,7 +462,7 @@
void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challenge)
{
LOG(Network, "CFNet - receivedCancellation()");
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (client())
@@ -474,7 +474,7 @@
LOG(Network, "CFNet - receivedRequestToPerformDefaultHandling()");
ASSERT(!challenge.isNull());
ASSERT(challenge.cfURLAuthChallengeRef());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (d->m_connection)
@@ -488,7 +488,7 @@
LOG(Network, "CFNet - receivedChallengeRejection()");
ASSERT(!challenge.isNull());
ASSERT(challenge.cfURLAuthChallengeRef());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (d->m_connection)
Modified: trunk/Source/WebCore/platform/network/curl/CurlContext.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/curl/CurlContext.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/curl/CurlContext.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -862,16 +862,20 @@
if (errorCode != CURLE_OK)
return;
- networkLoadMetrics.requestHeaderBytesSent = requestHeaderSize;
- networkLoadMetrics.requestBodyBytesSent = requestBodySize;
- networkLoadMetrics.responseHeaderBytesReceived = responseHeaderSize;
networkLoadMetrics.responseBodyBytesReceived = responseBodySize;
+ auto additionalMetrics = AdditionalNetworkLoadMetricsForWebInspector::create();
+ additionalMetrics->requestHeaderBytesSent = requestHeaderSize;
+ additionalMetrics->requestBodyBytesSent = requestBodySize;
+ additionalMetrics->responseHeaderBytesReceived = responseHeaderSize;
+
if (ip) {
- networkLoadMetrics.remoteAddress = String(ip);
+ additionalMetrics->remoteAddress = String(ip);
if (port)
- networkLoadMetrics.remoteAddress.append(":" + String::number(port));
+ additionalMetrics->remoteAddress.append(":" + String::number(port));
}
+
+ networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WTFMove(additionalMetrics);
}
std::optional<CertificateInfo> CurlHandle::certificateInfo() const
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -757,7 +757,8 @@
if (m_captureExtraMetrics) {
m_curlHandle->addExtraNetworkLoadMetrics(*networkLoadMetrics);
- networkLoadMetrics->requestHeaders = m_requestHeaders;
+ if (auto* additionalMetrics = networkLoadMetrics->additionalNetworkLoadMetricsForWebInspector.get())
+ additionalMetrics->requestHeaders = m_requestHeaders;
networkLoadMetrics->responseBodyDecodedSize = m_totalReceivedSize;
}
Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (282852 => 282853)
--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -264,7 +264,7 @@
{
ASSERT(isMainThread());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (credential.isEmpty()) {
@@ -290,7 +290,7 @@
{
ASSERT(isMainThread());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
clearAuthentication();
@@ -304,7 +304,7 @@
{
ASSERT(isMainThread());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (client()) {
Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (282852 => 282853)
--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2021-09-22 00:27:22 UTC (rev 282853)
@@ -577,7 +577,7 @@
LOG(Network, "Handle %p receivedCredential", this);
ASSERT(!challenge.isNull());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
// FIXME: Support empty credentials. Currently, an empty credential cannot be stored in WebCore credential storage, as that's empty value for its map.
@@ -607,7 +607,7 @@
LOG(Network, "Handle %p receivedRequestToContinueWithoutCredential", this);
ASSERT(!challenge.isNull());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
[[d->m_currentMacChallenge sender] continueWithoutCredentialForAuthenticationChallenge:d->m_currentMacChallenge];
@@ -619,7 +619,7 @@
{
LOG(Network, "Handle %p receivedCancellation", this);
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
if (client())
@@ -631,7 +631,7 @@
LOG(Network, "Handle %p receivedRequestToPerformDefaultHandling", this);
ASSERT(!challenge.isNull());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
[[d->m_currentMacChallenge sender] performDefaultHandlingForAuthenticationChallenge:d->m_currentMacChallenge];
@@ -644,7 +644,7 @@
LOG(Network, "Handle %p receivedChallengeRejection", this);
ASSERT(!challenge.isNull());
- if (challenge != d->m_currentWebChallenge)
+ if (!AuthenticationChallengeBase::equalForWebKitLegacyChallengeComparison(challenge, d->m_currentWebChallenge))
return;
[[d->m_currentMacChallenge sender] rejectProtectionSpaceAndContinueWithChallenge:d->m_currentMacChallenge];
Modified: trunk/Source/WebKit/ChangeLog (282852 => 282853)
--- trunk/Source/WebKit/ChangeLog 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/ChangeLog 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1,3 +1,23 @@
+2021-09-21 Alex Christensen <[email protected]>
+
+ Reduce sizeof(NetworkLoadMetrics)
+ https://bugs.webkit.org/show_bug.cgi?id=226982
+
+ Reviewed by Chris Dumez.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
+ * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+ (WebKit::NetworkDataTaskSoup::additionalNetworkLoadMetricsForWebInspector):
+ (WebKit::NetworkDataTaskSoup::didGetHeaders):
+ (WebKit::NetworkDataTaskSoup::wroteHeadersCallback):
+ (WebKit::NetworkDataTaskSoup::wroteBodyCallback):
+ (WebKit::NetworkDataTaskSoup::networkEvent):
+ (WebKit::NetworkDataTaskSoup::didRestart):
+ * Shared/WebCoreArgumentCoders.h:
+
2021-09-21 David Kilzer <[email protected]>
Follow-up: WebKit::WebProcessPool should use a weak observer with CFNotificationCenter
Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (282852 => 282853)
--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1286,9 +1286,13 @@
WebCore::NetworkLoadMetrics networkLoadMetrics;
networkLoadMetrics.markComplete();
- networkLoadMetrics.requestHeaderBytesSent = 0;
- networkLoadMetrics.requestBodyBytesSent = 0;
- networkLoadMetrics.responseHeaderBytesReceived = 0;
+ if (shouldCaptureExtraNetworkLoadMetrics()) {
+ auto additionalMetrics = WebCore::AdditionalNetworkLoadMetricsForWebInspector::create();
+ additionalMetrics->requestHeaderBytesSent = 0;
+ additionalMetrics->requestBodyBytesSent = 0;
+ additionalMetrics->responseHeaderBytesReceived = 0;
+ networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WTFMove(additionalMetrics);
+ }
networkLoadMetrics.responseBodyBytesReceived = 0;
networkLoadMetrics.responseBodyDecodedSize = 0;
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (282852 => 282853)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2021-09-22 00:27:22 UTC (rev 282853)
@@ -878,28 +878,29 @@
#endif
if (networkDataTask->shouldCaptureExtraNetworkLoadMetrics()) {
- networkLoadMetrics.priority = toNetworkLoadPriority(task.priority);
+ auto additionalMetrics = WebCore::AdditionalNetworkLoadMetricsForWebInspector::create();
+ additionalMetrics->priority = toNetworkLoadPriority(task.priority);
#if HAVE(CFNETWORK_METRICS_APIS_V4)
if (auto port = [m.remotePort unsignedIntValue])
- networkLoadMetrics.remoteAddress = makeString(String(m.remoteAddress), ':', port);
+ additionalMetrics->remoteAddress = makeString(String(m.remoteAddress), ':', port);
else
- networkLoadMetrics.remoteAddress = m.remoteAddress;
+ additionalMetrics->remoteAddress = m.remoteAddress;
#else
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- networkLoadMetrics.remoteAddress = String(m._remoteAddressAndPort);
+ additionalMetrics->remoteAddress = String(m._remoteAddressAndPort);
ALLOW_DEPRECATED_DECLARATIONS_END
#endif
- networkLoadMetrics.connectionIdentifier = String([m._connectionIdentifier UUIDString]);
+ additionalMetrics->connectionIdentifier = String([m._connectionIdentifier UUIDString]);
#if HAVE(CFNETWORK_NEGOTIATED_SSL_PROTOCOL_CIPHER)
#if HAVE(CFNETWORK_METRICS_APIS_V4)
- networkLoadMetrics.tlsProtocol = stringForTLSProtocolVersion((tls_protocol_version_t)[m.negotiatedTLSProtocolVersion unsignedShortValue]);
- networkLoadMetrics.tlsCipher = stringForTLSCipherSuite((tls_ciphersuite_t)[m.negotiatedTLSCipherSuite unsignedShortValue]);
+ additionalMetrics->tlsProtocol = stringForTLSProtocolVersion((tls_protocol_version_t)[m.negotiatedTLSProtocolVersion unsignedShortValue]);
+ additionalMetrics->tlsCipher = stringForTLSCipherSuite((tls_ciphersuite_t)[m.negotiatedTLSCipherSuite unsignedShortValue]);
#else
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- networkLoadMetrics.tlsProtocol = stringForSSLProtocol(m._negotiatedTLSProtocol);
- networkLoadMetrics.tlsCipher = stringForSSLCipher(m._negotiatedTLSCipher);
+ additionalMetrics->tlsProtocol = stringForSSLProtocol(m._negotiatedTLSProtocol);
+ additionalMetrics->tlsCipher = stringForSSLCipher(m._negotiatedTLSCipher);
ALLOW_DEPRECATED_DECLARATIONS_END
#endif
#endif
@@ -908,7 +909,7 @@
[m.request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSString *value, BOOL *) {
requestHeaders.set(String(name), String(value));
}];
- networkLoadMetrics.requestHeaders = WTFMove(requestHeaders);
+ additionalMetrics->requestHeaders = WTFMove(requestHeaders);
uint64_t requestHeaderBytesSent = 0;
uint64_t responseHeaderBytesReceived = 0;
@@ -925,9 +926,10 @@
#endif
}
- networkLoadMetrics.requestHeaderBytesSent = requestHeaderBytesSent;
- networkLoadMetrics.requestBodyBytesSent = task.countOfBytesSent;
- networkLoadMetrics.responseHeaderBytesReceived = responseHeaderBytesReceived;
+ additionalMetrics->requestHeaderBytesSent = requestHeaderBytesSent;
+ additionalMetrics->requestBodyBytesSent = task.countOfBytesSent;
+ additionalMetrics->responseHeaderBytesReceived = responseHeaderBytesReceived;
+ networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WTFMove(additionalMetrics);
}
#if HAVE(CFNETWORK_METRICS_APIS_V4)
networkLoadMetrics.responseBodyBytesReceived = m.countOfResponseBodyBytesReceived;
Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp (282852 => 282853)
--- trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp 2021-09-22 00:27:22 UTC (rev 282853)
@@ -1210,6 +1210,13 @@
}
#endif
+WebCore::AdditionalNetworkLoadMetricsForWebInspector& NetworkDataTaskSoup::additionalNetworkLoadMetricsForWebInspector()
+{
+ if (!m_networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector)
+ m_networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector = WebCore::AdditionalNetworkLoadMetricsForWebInspector::create();
+ return *m_networkLoadMetrics.additionalNetworkLoadMetricsForWebInspector;
+}
+
void NetworkDataTaskSoup::didGetHeaders()
{
// We are a bit more conservative with the persistent credential storage than the session store,
@@ -1233,6 +1240,8 @@
// is the first one we receive after starting, so we use it also to get information about the
// request headers.
if (shouldCaptureExtraNetworkLoadMetrics()) {
+ auto& additionalMetrics = additionalNetworkLoadMetricsForWebInspector();
+
HTTPHeaderMap requestHeaders;
SoupMessageHeadersIter headersIter;
soup_message_headers_iter_init(&headersIter, soup_message_get_request_headers(m_soupMessage.get()));
@@ -1240,19 +1249,19 @@
const char* headerValue;
while (soup_message_headers_iter_next(&headersIter, &headerName, &headerValue))
requestHeaders.set(String(headerName), String(headerValue));
- m_networkLoadMetrics.requestHeaders = WTFMove(requestHeaders);
+ additionalMetrics.requestHeaders = WTFMove(requestHeaders);
- m_networkLoadMetrics.priority = toNetworkLoadPriority(soup_message_get_priority(m_soupMessage.get()));
+ additionalMetrics.priority = toNetworkLoadPriority(soup_message_get_priority(m_soupMessage.get()));
#if !USE(SOUP2)
- m_networkLoadMetrics.connectionIdentifier = String::number(soup_message_get_connection_id(m_soupMessage.get()));
+ additionalMetrics.connectionIdentifier = String::number(soup_message_get_connection_id(m_soupMessage.get()));
auto* address = soup_message_get_remote_address(m_soupMessage.get());
if (G_IS_INET_SOCKET_ADDRESS(address)) {
GUniquePtr<char> ipAddress(g_inet_address_to_string(g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(address))));
- m_networkLoadMetrics.remoteAddress = makeString(ipAddress.get(), ':', g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(address)));
+ additionalMetrics.remoteAddress = makeString(ipAddress.get(), ':', g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(address)));
}
- m_networkLoadMetrics.tlsProtocol = tlsProtocolVersionToString(soup_message_get_tls_protocol_version(m_soupMessage.get()));
- m_networkLoadMetrics.tlsCipher = String::fromUTF8(soup_message_get_tls_ciphersuite_name(m_soupMessage.get()));
- m_networkLoadMetrics.responseHeaderBytesReceived = soup_message_metrics_get_response_header_bytes_received(metrics);
+ additionalMetrics.tlsProtocol = tlsProtocolVersionToString(soup_message_get_tls_protocol_version(m_soupMessage.get()));
+ additionalMetrics.tlsCipher = String::fromUTF8(soup_message_get_tls_ciphersuite_name(m_soupMessage.get()));
+ additionalMetrics.responseHeaderBytesReceived = soup_message_metrics_get_response_header_bytes_received(metrics);
#endif
}
@@ -1268,7 +1277,7 @@
}
ASSERT(task->m_soupMessage.get() == soupMessage);
auto* metrics = soup_message_get_metrics(soupMessage);
- task->m_networkLoadMetrics.requestHeaderBytesSent = soup_message_metrics_get_request_header_bytes_sent(metrics);
+ task->additionalNetworkLoadMetricsForWebInspector().requestHeaderBytesSent = soup_message_metrics_get_request_header_bytes_sent(metrics);
}
void NetworkDataTaskSoup::wroteBodyCallback(SoupMessage* soupMessage, NetworkDataTaskSoup* task)
@@ -1279,7 +1288,7 @@
}
ASSERT(task->m_soupMessage.get() == soupMessage);
auto* metrics = soup_message_get_metrics(soupMessage);
- task->m_networkLoadMetrics.requestBodyBytesSent = soup_message_metrics_get_request_body_bytes_sent(metrics);
+ task->additionalNetworkLoadMetricsForWebInspector().requestBodyBytesSent = soup_message_metrics_get_request_body_bytes_sent(metrics);
}
void NetworkDataTaskSoup::gotBodyCallback(SoupMessage* soupMessage, NetworkDataTaskSoup* task)
@@ -1515,7 +1524,7 @@
GRefPtr<GSocketAddress> address = adoptGRef(g_socket_connection_get_remote_address(G_SOCKET_CONNECTION(stream), nullptr));
if (G_IS_INET_SOCKET_ADDRESS(address.get())) {
GUniquePtr<char> ipAddress(g_inet_address_to_string(g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(address.get()))));
- m_networkLoadMetrics.remoteAddress = makeString(ipAddress.get(), ':', g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(address.get())));
+ additionalNetworkLoadMetricsForWebInspector().remoteAddress = makeString(ipAddress.get(), ':', g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(address.get())));
}
}
// Web Timing considers that connection time involves dns, proxy & TLS negotiation...
@@ -1634,7 +1643,7 @@
void NetworkDataTaskSoup::didRestart()
{
- m_networkLoadMetrics = { };
+ m_networkLoadMetrics = NetworkLoadMetrics::emptyMetrics();
#if USE(SOUP2)
m_networkLoadMetrics.fetchStart = MonotonicTime::now();
#else
Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.h (282852 => 282853)
--- trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.h 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.h 2021-09-22 00:27:22 UTC (rev 282853)
@@ -181,6 +181,8 @@
void didReadDataURL(std::optional<WebCore::DataURLDecoder::Result>&&);
+ WebCore::AdditionalNetworkLoadMetricsForWebInspector& additionalNetworkLoadMetricsForWebInspector();
+
WebCore::FrameIdentifier m_frameID;
WebCore::PageIdentifier m_pageID;
State m_state { State::Suspended };
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (282852 => 282853)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2021-09-22 00:11:35 UTC (rev 282852)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2021-09-22 00:27:22 UTC (rev 282853)
@@ -905,16 +905,6 @@
>;
};
-template<> struct EnumTraits<WebCore::NetworkLoadPriority> {
- using values = EnumValues<
- WebCore::NetworkLoadPriority,
- WebCore::NetworkLoadPriority::Low,
- WebCore::NetworkLoadPriority::Medium,
- WebCore::NetworkLoadPriority::High,
- WebCore::NetworkLoadPriority::Unknown
- >;
-};
-
template<> struct EnumTraits<WebCore::NotificationDirection> {
using values = EnumValues<
WebCore::NotificationDirection,