From 291a131dd8c73e4cc00044ce1f4cc93eb9b0a501 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 6 Dec 2016 11:56:37 -1000 Subject: [PATCH] Properly trace HashSet --- components/script/dom/bindings/trace.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index b0d4621e36b..766556efd16 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -32,8 +32,7 @@ use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle}; use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle}; use cssparser::RGBA; -use devtools_traits::CSSError; -use devtools_traits::WorkerId; +use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use dom::abstractworker::SharedRt; use dom::bindings::cell::DOMRefCell; use dom::bindings::js::{JS, Root}; @@ -268,6 +267,18 @@ unsafe impl JSTraceable for HashMap } } +unsafe impl JSTraceable for HashSet + where T: Hash + Eq + JSTraceable, + S: BuildHasher +{ + #[inline] + unsafe fn trace(&self, trc: *mut JSTracer) { + for v in &*self { + v.trace(trc); + } + } +} + unsafe impl JSTraceable for BTreeMap { #[inline] unsafe fn trace(&self, trc: *mut JSTracer) { @@ -313,11 +324,11 @@ unsafe_no_jsmanaged_fields!(Atom, Prefix, LocalName, Namespace, QualName); unsafe_no_jsmanaged_fields!(Trusted); unsafe_no_jsmanaged_fields!(TrustedPromise); unsafe_no_jsmanaged_fields!(PropertyDeclarationBlock); -unsafe_no_jsmanaged_fields!(HashSet); // These three are interdependent, if you plan to put jsmanaged data // in one of these make sure it is propagated properly to containing structs unsafe_no_jsmanaged_fields!(FrameId, FrameType, WindowSizeData, WindowSizeType, PipelineId); unsafe_no_jsmanaged_fields!(TimerEventId, TimerSource); +unsafe_no_jsmanaged_fields!(TimelineMarkerType); unsafe_no_jsmanaged_fields!(WorkerId); unsafe_no_jsmanaged_fields!(BufferQueue, QuirksMode); unsafe_no_jsmanaged_fields!(Runtime);