1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS+LibWeb: Use realm.create<T> instead of heap.allocate<T>

The main motivation behind this is to remove JS specifics of the Realm
from the implementation of the Heap.

As a side effect of this change, this is a bit nicer to read than the
previous approach, and in my opinion, also makes it a little more clear
that this method is specific to a JavaScript Realm.
This commit is contained in:
Shannon Booth 2024-11-14 05:50:17 +13:00 committed by Tim Flynn
parent 2a5dbedad4
commit 9b79a686eb
Notes: github-actions[bot] 2024-11-13 21:52:48 +00:00
326 changed files with 697 additions and 714 deletions

View file

@ -48,7 +48,7 @@ JS::GCPtr<NavigationTiming::PerformanceTiming> Performance::timing()
{
auto& realm = this->realm();
if (!m_timing)
m_timing = heap().allocate<NavigationTiming::PerformanceTiming>(realm, realm);
m_timing = realm.create<NavigationTiming::PerformanceTiming>(realm);
return m_timing;
}
@ -60,7 +60,7 @@ JS::GCPtr<NavigationTiming::PerformanceNavigation> Performance::navigation()
u16 type = 0;
u16 redirect_count = 0;
m_navigation = heap().allocate<NavigationTiming::PerformanceNavigation>(realm, realm, type, redirect_count);
m_navigation = realm.create<NavigationTiming::PerformanceNavigation>(realm, type, redirect_count);
}
return m_navigation;
}
@ -305,7 +305,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<UserTiming::PerformanceMeasure>> Performanc
// NOTE: Already the default value of `detail`.
// 4. Create a new PerformanceMeasure object (entry) with this's relevant realm.
auto entry = realm.heap().allocate<UserTiming::PerformanceMeasure>(realm, realm, measure_name, start_time, duration, detail);
auto entry = realm.create<UserTiming::PerformanceMeasure>(realm, measure_name, start_time, duration, detail);
// 10. Queue entry.
window_or_worker().queue_performance_entry(entry);