LibWeb: Add a time origin property for all ESOs

This acts as a baseline for performance related timestamps.
This commit is contained in:
Tim Ledbetter 2025-01-07 10:08:14 +00:00 committed by Alexander Kalenik
parent a8904451ff
commit 8963e62a5e
Notes: github-actions[bot] 2025-01-27 13:54:41 +00:00
9 changed files with 29 additions and 5 deletions

View file

@ -18,9 +18,10 @@ class WorkerEnvironmentSettingsObject final
GC_DECLARE_ALLOCATOR(WorkerEnvironmentSettingsObject);
public:
WorkerEnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> execution_context, GC::Ref<WorkerGlobalScope> global_scope)
WorkerEnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> execution_context, GC::Ref<WorkerGlobalScope> global_scope, HighResolutionTime::DOMHighResTimeStamp unsafe_worker_creation_time)
: EnvironmentSettingsObject(move(execution_context))
, m_global_scope(global_scope)
, m_unsafe_worker_creation_time(unsafe_worker_creation_time)
{
}
@ -34,6 +35,7 @@ public:
URL::Origin origin() const override;
PolicyContainer policy_container() const override;
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() const override;
double time_origin() const override;
private:
virtual void visit_edges(JS::Cell::Visitor&) override;
@ -42,6 +44,8 @@ private:
URL::Origin m_origin;
GC::Ref<WorkerGlobalScope> m_global_scope;
HighResolutionTime::DOMHighResTimeStamp m_unsafe_worker_creation_time { 0 };
};
}