script/dom/
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;
6
7use crate::dom::bindings::codegen::Bindings::DebuggerAddDebuggeeEventBinding::PipelineIdMethods;
8use crate::dom::bindings::reflector::{Reflector, reflect_dom_object};
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::globalscope::GlobalScope;
11use crate::script_runtime::CanGc;
12
13#[dom_struct]
14pub(crate) struct PipelineId {
15    reflector_: Reflector,
16    #[no_trace]
17    inner: base::id::PipelineId,
18}
19
20impl PipelineId {
21    pub(crate) fn new(
22        global: &GlobalScope,
23        pipeline_id: base::id::PipelineId,
24        can_gc: CanGc,
25    ) -> DomRoot<Self> {
26        reflect_dom_object(
27            Box::new(Self {
28                reflector_: Reflector::new(),
29                inner: pipeline_id,
30            }),
31            global,
32            can_gc,
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}