Skip to main content

script/dom/debugger/
pipelineid.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use dom_struct::dom_struct;
6use js::context::JSContext;
7use script_bindings::reflector::{Reflector, reflect_dom_object_with_cx};
8
9use crate::dom::bindings::codegen::Bindings::DebuggerAddDebuggeeEventBinding::PipelineIdMethods;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::globalscope::GlobalScope;
12
13#[dom_struct]
14pub(crate) struct PipelineId {
15    reflector_: Reflector,
16    #[no_trace]
17    inner: servo_base::id::PipelineId,
18}
19
20impl PipelineId {
21    pub(crate) fn new(
22        cx: &mut JSContext,
23        global: &GlobalScope,
24        pipeline_id: servo_base::id::PipelineId,
25    ) -> DomRoot<Self> {
26        reflect_dom_object_with_cx(
27            Box::new(Self {
28                reflector_: Reflector::new(),
29                inner: pipeline_id,
30            }),
31            global,
32            cx,
33        )
34    }
35}
36
37impl PipelineIdMethods<crate::DomTypeHolder> for PipelineId {
38    // check-tidy: no specs after this line
39    fn NamespaceId(&self) -> u32 {
40        self.inner.namespace_id.0
41    }
42
43    fn Index(&self) -> u32 {
44        self.inner.index.0.get()
45    }
46}