@@ -29,11 +29,6 @@ pub const Interfaces = .{
2929 PerformanceMark ,
3030};
3131
32- const MarkOptions = struct {
33- detail : ? Env.JsObject = null ,
34- start_time : ? f64 = null ,
35- };
36-
3732// https://developer.mozilla.org/en-US/docs/Web/API/Performance
3833pub const Performance = struct {
3934 pub const prototype = * EventTarget ;
@@ -66,11 +61,21 @@ pub const Performance = struct {
6661 return limitedResolutionMs (self .time_origin .read ());
6762 }
6863
69- pub fn _mark (_ : * Performance , name : []const u8 , _options : ? MarkOptions , page : * Page ) ! PerformanceMark {
64+ pub fn _mark (_ : * Performance , name : []const u8 , _options : ? PerformanceMark.Options , page : * Page ) ! PerformanceMark {
7065 const mark : PerformanceMark = try .constructor (name , _options , page );
7166 // TODO: Should store this in an entries list
7267 return mark ;
7368 }
69+
70+ // TODO: fn _mark should record the marks in a lookup
71+ pub fn _clearMarks (_ : * Performance , name : ? []const u8 ) void {
72+ _ = name ;
73+ }
74+
75+ // TODO: fn _measures should record the marks in a lookup
76+ pub fn _clearMeasures (_ : * Performance , name : ? []const u8 ) void {
77+ _ = name ;
78+ }
7479};
7580
7681// https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry
@@ -132,17 +137,23 @@ pub const PerformanceMark = struct {
132137 proto : PerformanceEntry ,
133138 detail : ? Env.JsObject ,
134139
135- pub fn constructor (name : []const u8 , _options : ? MarkOptions , page : * Page ) ! PerformanceMark {
140+ const Options = struct {
141+ detail : ? Env.JsObject = null ,
142+ start_time : ? f64 = null ,
143+ };
144+
145+ pub fn constructor (name : []const u8 , _options : ? Options , page : * Page ) ! PerformanceMark {
136146 const perf = & page .window .performance ;
137147
138- const options = _options orelse MarkOptions {};
148+ const options = _options orelse Options {};
139149 const start_time = options .start_time orelse perf ._now ();
140- const detail = if (options .detail ) | d | try d .persist () else null ;
141150
142151 if (start_time < 0.0 ) {
143152 return error .TypeError ;
144153 }
145154
155+ const detail = if (options .detail ) | d | try d .persist () else null ;
156+
146157 const duped_name = try page .arena .dupe (u8 , name );
147158 const proto = PerformanceEntry { .name = duped_name , .entry_type = .mark , .start_time = start_time };
148159
0 commit comments