Skip to main content

script/dom/performance/
performancemeasure.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 js::gc::HandleValue;
6use js::jsapi::Heap;
7use js::jsval::JSVal;
8use js::rust::MutableHandleValue;
9
10use crate::dom::bindings::codegen::Bindings::PerformanceMeasureBinding::PerformanceMeasureMethods;
11use crate::script_runtime::JSContext;
12
13impl_performance_entry_struct!(
14    PerformanceMeasureBinding,
15    PerformanceMeasure,
16    EntryType::Measure,
17    {
18        #[ignore_malloc_size_of = "Defined in rust-mozjs"]
19        detail: Heap<JSVal>,
20    }
21);
22
23impl PerformanceMeasure {
24    pub(crate) fn set_detail(&self, handle: HandleValue<'_>) {
25        self.detail.set(handle.get());
26    }
27}
28
29impl PerformanceMeasureMethods<crate::DomTypeHolder> for PerformanceMeasure {
30    fn Detail(&self, _cx: JSContext, mut retval: MutableHandleValue) {
31        retval.set(self.detail.get())
32    }
33}