mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +00:00 
			
		
		
		
	 9b79a686eb
			
		
	
	
		9b79a686eb
		
	
	
	
	
		
			
			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.
		
			
				
	
	
		
			51 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/Bindings/Intrinsics.h>
 | |
| #include <LibWeb/Bindings/PerformanceMeasurePrototype.h>
 | |
| #include <LibWeb/HTML/StructuredSerialize.h>
 | |
| #include <LibWeb/HTML/Window.h>
 | |
| #include <LibWeb/HighResolutionTime/TimeOrigin.h>
 | |
| #include <LibWeb/NavigationTiming/EntryNames.h>
 | |
| #include <LibWeb/PerformanceTimeline/EntryTypes.h>
 | |
| #include <LibWeb/UserTiming/PerformanceMeasure.h>
 | |
| #include <LibWeb/WebIDL/ExceptionOr.h>
 | |
| 
 | |
| namespace Web::UserTiming {
 | |
| 
 | |
| JS_DEFINE_ALLOCATOR(PerformanceMeasure);
 | |
| 
 | |
| PerformanceMeasure::PerformanceMeasure(JS::Realm& realm, String const& name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail)
 | |
|     : PerformanceTimeline::PerformanceEntry(realm, name, start_time, duration)
 | |
|     , m_detail(detail)
 | |
| {
 | |
| }
 | |
| 
 | |
| PerformanceMeasure::~PerformanceMeasure() = default;
 | |
| 
 | |
| JS::NonnullGCPtr<PerformanceMeasure> PerformanceMeasure::create(JS::Realm& realm, String const& measure_name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail)
 | |
| {
 | |
|     return realm.create<PerformanceMeasure>(realm, measure_name, start_time, duration, detail);
 | |
| }
 | |
| 
 | |
| FlyString const& PerformanceMeasure::entry_type() const
 | |
| {
 | |
|     return PerformanceTimeline::EntryTypes::measure;
 | |
| }
 | |
| 
 | |
| void PerformanceMeasure::initialize(JS::Realm& realm)
 | |
| {
 | |
|     Base::initialize(realm);
 | |
|     WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceMeasure);
 | |
| }
 | |
| 
 | |
| void PerformanceMeasure::visit_edges(JS::Cell::Visitor& visitor)
 | |
| {
 | |
|     Base::visit_edges(visitor);
 | |
|     visitor.visit(m_detail);
 | |
| }
 | |
| 
 | |
| }
 |