script/dom/performance/
performancemark.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::PerformanceMarkBinding::PerformanceMarkMethods;
11use crate::script_runtime::JSContext;
12
13impl_performance_entry_struct!(
14    PerformanceMarkBinding,
15    PerformanceMark, EntryType::Mark,
16    {
17        #[ignore_malloc_size_of = "Defined in rust-mozjs"]
18        detail: Heap<JSVal>,
19    }
20);
21
22impl PerformanceMark {
23    pub(crate) fn set_detail(&self, handle: HandleValue<'_>) {
24        self.detail.set(handle.get());
25    }
26}
27
28impl PerformanceMarkMethods<crate::DomTypeHolder> for PerformanceMark {
29    fn Detail(&self, _cx: JSContext, mut retval: MutableHandleValue) {
30        retval.set(self.detail.get())
31    }
32}