ladybird/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp
Shannon Booth 1e54003cb1 LibJS+LibWeb: Rename Heap::allocate_without_realm to Heap::allocate
Now that the heap has no knowledge about a JavaScript realm and is
purely for managing the memory of the heap, it does not make sense
to name this function to say that it is a non-realm variant.
2024-11-13 16:51:44 -05:00

39 lines
1.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Heap/Heap.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Fetch/Infrastructure/FetchTimingInfo.h>
namespace Web::Fetch::Infrastructure {
JS_DEFINE_ALLOCATOR(FetchTimingInfo);
FetchTimingInfo::FetchTimingInfo() = default;
JS::NonnullGCPtr<FetchTimingInfo> FetchTimingInfo::create(JS::VM& vm)
{
return vm.heap().allocate<FetchTimingInfo>();
}
void FetchTimingInfo::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_final_connection_timing_info);
}
// https://fetch.spec.whatwg.org/#create-an-opaque-timing-info
JS::NonnullGCPtr<FetchTimingInfo> create_opaque_timing_info(JS::VM& vm, FetchTimingInfo const& timing_info)
{
// To create an opaque timing info, given a fetch timing info timingInfo, return a new fetch timing info whose
// start time and post-redirect start time are timingInfos start time.
auto new_timing_info = FetchTimingInfo::create(vm);
new_timing_info->set_start_time(timing_info.start_time());
new_timing_info->set_post_redirect_start_time(timing_info.start_time());
return new_timing_info;
}
}