mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Convert ConnectionTimingInfo to a standard layout struct
There's nothing about this type that requires it to be GC allocated
This commit is contained in:
parent
47716a4e11
commit
8e3798b25e
Notes:
github-actions[bot]
2025-02-18 18:36:45 +00:00
Author: https://github.com/ADKaster
Commit: 8e3798b25e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3346
Reviewed-by: https://github.com/AtkinsSJ
6 changed files with 12 additions and 64 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2025, Andrew Kaster <andrew@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -7,70 +8,41 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibWeb/HighResolutionTime/DOMHighResTimeStamp.h>
|
||||
|
||||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info
|
||||
class ConnectionTimingInfo : public JS::Cell {
|
||||
GC_CELL(ConnectionTimingInfo, JS::Cell);
|
||||
GC_DECLARE_ALLOCATOR(ConnectionTimingInfo);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<ConnectionTimingInfo> create(JS::VM&);
|
||||
|
||||
[[nodiscard]] HighResolutionTime::DOMHighResTimeStamp domain_lookup_start_time() const { return m_domain_lookup_start_time; }
|
||||
void set_domain_lookup_start_time(HighResolutionTime::DOMHighResTimeStamp domain_lookup_start_time) { m_domain_lookup_start_time = domain_lookup_start_time; }
|
||||
|
||||
[[nodiscard]] HighResolutionTime::DOMHighResTimeStamp domain_lookup_end_time() const { return m_domain_lookup_end_time; }
|
||||
void set_domain_lookup_end_time(HighResolutionTime::DOMHighResTimeStamp domain_lookup_end_time) { m_domain_lookup_end_time = domain_lookup_end_time; }
|
||||
|
||||
[[nodiscard]] HighResolutionTime::DOMHighResTimeStamp connection_start_time() const { return m_connection_start_time; }
|
||||
void set_connection_start_time(HighResolutionTime::DOMHighResTimeStamp connection_start_time) { m_connection_start_time = connection_start_time; }
|
||||
|
||||
[[nodiscard]] HighResolutionTime::DOMHighResTimeStamp connection_end_time() const { return m_connection_end_time; }
|
||||
void set_connection_end_time(HighResolutionTime::DOMHighResTimeStamp connection_end_time) { m_connection_end_time = connection_end_time; }
|
||||
|
||||
[[nodiscard]] HighResolutionTime::DOMHighResTimeStamp secure_connection_start_time() const { return m_secure_connection_start_time; }
|
||||
void set_secure_connection_start_time(HighResolutionTime::DOMHighResTimeStamp secure_connection_start_time) { m_secure_connection_start_time = secure_connection_start_time; }
|
||||
|
||||
[[nodiscard]] ReadonlyBytes lpn_negotiated_protocol() const { return m_lpn_negotiated_protocol; }
|
||||
void set_lpn_negotiated_protocol(ByteBuffer lpn_negotiated_protocol) { m_lpn_negotiated_protocol = move(lpn_negotiated_protocol); }
|
||||
|
||||
private:
|
||||
ConnectionTimingInfo();
|
||||
|
||||
struct ConnectionTimingInfo {
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-domain-lookup-start-time
|
||||
// domain lookup start time (default 0)
|
||||
// A DOMHighResTimeStamp.
|
||||
HighResolutionTime::DOMHighResTimeStamp m_domain_lookup_start_time { 0 };
|
||||
HighResolutionTime::DOMHighResTimeStamp domain_lookup_start_time { 0 };
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-domain-lookup-end-time
|
||||
// domain lookup end time (default 0)
|
||||
// A DOMHighResTimeStamp.
|
||||
HighResolutionTime::DOMHighResTimeStamp m_domain_lookup_end_time { 0 };
|
||||
HighResolutionTime::DOMHighResTimeStamp domain_lookup_end_time { 0 };
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-connection-start-time
|
||||
// connection start time (default 0)
|
||||
// A DOMHighResTimeStamp.
|
||||
HighResolutionTime::DOMHighResTimeStamp m_connection_start_time { 0 };
|
||||
HighResolutionTime::DOMHighResTimeStamp connection_start_time { 0 };
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-connection-end-time
|
||||
// connection end time (default 0)
|
||||
// A DOMHighResTimeStamp.
|
||||
HighResolutionTime::DOMHighResTimeStamp m_connection_end_time { 0 };
|
||||
HighResolutionTime::DOMHighResTimeStamp connection_end_time { 0 };
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-secure-connection-start-time
|
||||
// secure connection start time (default 0)
|
||||
// A DOMHighResTimeStamp.
|
||||
HighResolutionTime::DOMHighResTimeStamp m_secure_connection_start_time { 0 };
|
||||
HighResolutionTime::DOMHighResTimeStamp secure_connection_start_time { 0 };
|
||||
|
||||
// https://fetch.spec.whatwg.org/#connection-timing-info-alpn-negotiated-protocol
|
||||
// ALPN negotiated protocol (default the empty byte sequence)
|
||||
// A byte sequence.
|
||||
ByteBuffer m_lpn_negotiated_protocol;
|
||||
ByteBuffer alpn_negotiated_protocol;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue