script/dom/
debuggerframeevent.rs1use std::fmt::Debug;
6
7use dom_struct::dom_struct;
8
9use crate::dom::bindings::codegen::Bindings::DebuggerFrameEventBinding::DebuggerFrameEventMethods;
10use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
11use crate::dom::bindings::reflector::reflect_dom_object;
12use crate::dom::bindings::root::{Dom, DomRoot};
13use crate::dom::event::Event;
14use crate::dom::types::{GlobalScope, PipelineId};
15use crate::script_runtime::CanGc;
16
17#[dom_struct]
18pub(crate) struct DebuggerFrameEvent {
20 event: Event,
21 pipeline_id: Dom<PipelineId>,
22 start: u32,
23 count: u32,
24}
25
26impl DebuggerFrameEvent {
27 pub(crate) fn new(
28 debugger_global: &GlobalScope,
29 pipeline_id: &PipelineId,
30 start: u32,
31 count: u32,
32 can_gc: CanGc,
33 ) -> DomRoot<Self> {
34 let result = Box::new(Self {
35 event: Event::new_inherited(),
36 pipeline_id: Dom::from_ref(pipeline_id),
37 start,
38 count,
39 });
40 let result = reflect_dom_object(result, debugger_global, can_gc);
41 result.event.init_event("frames".into(), false, false);
42
43 result
44 }
45}
46
47impl DebuggerFrameEventMethods<crate::DomTypeHolder> for DebuggerFrameEvent {
48 fn PipelineId(
50 &self,
51 ) -> DomRoot<<crate::DomTypeHolder as script_bindings::DomTypes>::PipelineId> {
52 DomRoot::from_ref(&self.pipeline_id)
53 }
54
55 fn Start(&self) -> u32 {
56 self.start
57 }
58
59 fn Count(&self) -> u32 {
60 self.count
61 }
62
63 fn IsTrusted(&self) -> bool {
64 self.event.IsTrusted()
65 }
66}
67
68impl Debug for DebuggerFrameEvent {
69 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
70 f.debug_struct("DebuggerFrameEvent").finish()
71 }
72}