Coverage Report

Created: 2025-08-28 06:26

/src/serenity/Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <AK/ByteBuffer.h>
10
#include <LibJS/Heap/Cell.h>
11
#include <LibJS/Heap/GCPtr.h>
12
#include <LibWeb/HighResolutionTime/DOMHighResTimeStamp.h>
13
14
namespace Web::Fetch::Infrastructure {
15
16
// https://fetch.spec.whatwg.org/#connection-timing-info
17
class ConnectionTimingInfo : public JS::Cell {
18
    JS_CELL(ConnectionTimingInfo, JS::Cell);
19
    JS_DECLARE_ALLOCATOR(ConnectionTimingInfo);
20
21
public:
22
    [[nodiscard]] static JS::NonnullGCPtr<ConnectionTimingInfo> create(JS::VM&);
23
24
0
    [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp domain_lookup_start_time() const { return m_domain_lookup_start_time; }
25
0
    void set_domain_lookup_start_time(HighResolutionTime::DOMHighResTimeStamp domain_lookup_start_time) { m_domain_lookup_start_time = domain_lookup_start_time; }
26
27
0
    [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp domain_lookup_end_time() const { return m_domain_lookup_end_time; }
28
0
    void set_domain_lookup_end_time(HighResolutionTime::DOMHighResTimeStamp domain_lookup_end_time) { m_domain_lookup_end_time = domain_lookup_end_time; }
29
30
0
    [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp connection_start_time() const { return m_connection_start_time; }
31
0
    void set_connection_start_time(HighResolutionTime::DOMHighResTimeStamp connection_start_time) { m_connection_start_time = connection_start_time; }
32
33
0
    [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp connection_end_time() const { return m_connection_end_time; }
34
0
    void set_connection_end_time(HighResolutionTime::DOMHighResTimeStamp connection_end_time) { m_connection_end_time = connection_end_time; }
35
36
0
    [[nodiscard]] HighResolutionTime::DOMHighResTimeStamp secure_connection_start_time() const { return m_secure_connection_start_time; }
37
0
    void set_secure_connection_start_time(HighResolutionTime::DOMHighResTimeStamp secure_connection_start_time) { m_secure_connection_start_time = secure_connection_start_time; }
38
39
0
    [[nodiscard]] ReadonlyBytes lpn_negotiated_protocol() const { return m_lpn_negotiated_protocol; }
40
0
    void set_lpn_negotiated_protocol(ByteBuffer lpn_negotiated_protocol) { m_lpn_negotiated_protocol = move(lpn_negotiated_protocol); }
41
42
private:
43
    ConnectionTimingInfo();
44
45
    // https://fetch.spec.whatwg.org/#connection-timing-info-domain-lookup-start-time
46
    // domain lookup start time (default 0)
47
    //     A DOMHighResTimeStamp.
48
    HighResolutionTime::DOMHighResTimeStamp m_domain_lookup_start_time { 0 };
49
50
    // https://fetch.spec.whatwg.org/#connection-timing-info-domain-lookup-end-time
51
    // domain lookup end time (default 0)
52
    //     A DOMHighResTimeStamp.
53
    HighResolutionTime::DOMHighResTimeStamp m_domain_lookup_end_time { 0 };
54
55
    // https://fetch.spec.whatwg.org/#connection-timing-info-connection-start-time
56
    // connection start time (default 0)
57
    //     A DOMHighResTimeStamp.
58
    HighResolutionTime::DOMHighResTimeStamp m_connection_start_time { 0 };
59
60
    // https://fetch.spec.whatwg.org/#connection-timing-info-connection-end-time
61
    // connection end time (default 0)
62
    //     A DOMHighResTimeStamp.
63
    HighResolutionTime::DOMHighResTimeStamp m_connection_end_time { 0 };
64
65
    // https://fetch.spec.whatwg.org/#connection-timing-info-secure-connection-start-time
66
    // secure connection start time (default 0)
67
    //     A DOMHighResTimeStamp.
68
    HighResolutionTime::DOMHighResTimeStamp m_secure_connection_start_time { 0 };
69
70
    // https://fetch.spec.whatwg.org/#connection-timing-info-alpn-negotiated-protocol
71
    // ALPN negotiated protocol (default the empty byte sequence)
72
    //     A byte sequence.
73
    ByteBuffer m_lpn_negotiated_protocol;
74
};
75
76
}