Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4b377ac567badb50a448d4ff2f7039a9e788107
      
https://github.com/WebKit/WebKit/commit/a4b377ac567badb50a448d4ff2f7039a9e788107
  Author: Alex Christensen <[email protected]>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.serviceworker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.sharedworker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.worker-expected.txt
    M Source/WebCore/Modules/webtransport/WebTransport.cpp
    M Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.cpp
    M Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.h
    M
Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.messages.in
    M Source/WebKit/NetworkProcess/webtransport/NetworkTransportStream.h
    M 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportSessionCocoa.mm
    M Source/WebKit/WebProcess/Network/WebTransportSession.cpp

  Log Message:
  -----------
  Begin implementing WebTransport.getStats
https://bugs.webkit.org/show_bug.cgi?id=319926
rdar://182852612

Reviewed by Basuke Suzuki.

This required a few things to get right:
1. We need to be able to get stats after a connection has closed, so we can't 
null out m_session
   because that's our only way to communicate with the network process.  We 
need to keep it non-null
   and use m_state for any JS-visible early returns.  I audited use of 
m_session to make sure
   that the early returns from m_session being null are not JS-visible.
2. getStats can be called before the WebTransport session has been initialized 
over the network.
   To
implement this, I added a Vector<CompletionHandler> on NetworkTransportSession 
to keep the
   completion handlers that we receive before initialization has completed.
3. I keep some more statistics on NetworkTransportSession to be able to provide 
stats that we can
   keep without asking the networking implementation to provide more stats, 
which hasn't been implemented
   yet.  The trickiest one was m_initializationTime which is the amount of time 
it took to initialize
   over the network, which is the one API call we have that we know did a 
roundtrip over the network.
   I use this as the basis for my bad implementation of rtt stats, to be 
improved upon once we have
   support in Network.framework.
4. When network setup fails, we need to fail any stats requests we've already 
received before it failed
   with DOMException.INVALID_STATE_ERR.  To make this possible, I need to 
change the promised async
   return type from WebTransportConnectionInfo to
std::optional<WebTransportConnectionInfo> to handle failure.

* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.serviceworker-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.sharedworker-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/stats.https.any.worker-expected.txt:
* Source/WebCore/Modules/webtransport/WebTransport.cpp:
(WebCore::WebTransport::initializeOverHTTP):
(WebCore::WebTransport::WebTransport):
(WebCore::WebTransport::receiveIncomingUnidirectionalStream):
(WebCore::WebTransport::receiveBidirectionalStream):
(WebCore::WebTransport::getStats):
(WebCore::WebTransport::cleanupContext):
(WebCore::WebTransport::close):
(WebCore::WebTransport::cleanup):
*
Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.cpp:
(WebKit::NetworkTransportSession::~NetworkTransportSession):
(WebKit::NetworkTransportSession::receiveDatagram):
(WebKit::NetworkTransportSession::destroyStream):
(WebKit::NetworkTransportSession::getSendGroupStats):
(WebKit::NetworkTransportSession::getStats):
(WebKit::NetworkTransportSession::completeStatsRequestsAfterInitialization):
* Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.h:
* Source/WebKit/NetworkProcess/webtransport/NetworkTransportSession.messages.in:
* Source/WebKit/NetworkProcess/webtransport/NetworkTransportStream.h:
(WebKit::NetworkTransportStream::bytesSent const):
(WebKit::NetworkTransportStream::bytesReceived const):
* 
Source/WebKit/NetworkProcess/webtransport/cocoa/NetworkTransportSessionCocoa.mm:
(WebKit::NetworkTransportSession::initialize):
(WebKit::NetworkTransportSession::sendDatagram):
(WebKit::NetworkTransportSession::getStats): Deleted.
*
Source/WebKit/WebProcess/Network/WebTransportSession.cpp:
(WebKit::WebTransportSession::getStats):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DA2w4m8mH0&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE3Njc5QG1haW4=&emid=5543c893-bb76-4ca5-a9cd-5eede4755db6&c=11



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to