diff options
author | Jack Moffitt <jack@metajack.im> | 2014-07-21 07:37:24 -0600 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-08-02 21:11:47 -0600 |
commit | b91e6f30e063cbcea4ffd750da8385ce448de797 (patch) | |
tree | 3e762f7866e29379810ac1e612f7942979e21b87 /src/components/script/dom/bindings/trace.rs | |
parent | 8b6f62c195dd7e42d0b6a18f2ced6fa16bc29faa (diff) | |
download | servo-b91e6f30e063cbcea4ffd750da8385ce448de797.tar.gz servo-b91e6f30e063cbcea4ffd750da8385ce448de797.zip |
Upgrade Rust.
Diffstat (limited to 'src/components/script/dom/bindings/trace.rs')
-rw-r--r-- | src/components/script/dom/bindings/trace.rs | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/src/components/script/dom/bindings/trace.rs b/src/components/script/dom/bindings/trace.rs index b9865eeec91..f26af087796 100644 --- a/src/components/script/dom/bindings/trace.rs +++ b/src/components/script/dom/bindings/trace.rs @@ -73,13 +73,12 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: JSVal) { } unsafe { - description.to_c_str().with_ref(|name| { - (*tracer).debugPrinter = None; - (*tracer).debugPrintIndex = -1; - (*tracer).debugPrintArg = name as *libc::c_void; - debug!("tracing value {:s}", description); - JS_CallTracer(tracer, val.to_gcthing(), val.trace_kind()); - }); + let name = description.to_c_str(); + (*tracer).debugPrinter = None; + (*tracer).debugPrintIndex = -1; + (*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void; + debug!("tracing value {:s}", description); + JS_CallTracer(tracer, val.to_gcthing(), val.trace_kind()); } } @@ -91,13 +90,12 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref /// Trace a `JSObject`. pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject) { unsafe { - description.to_c_str().with_ref(|name| { - (*tracer).debugPrinter = None; - (*tracer).debugPrintIndex = -1; - (*tracer).debugPrintArg = name as *libc::c_void; - debug!("tracing {:s}", description); - JS_CallTracer(tracer, obj as *mut libc::c_void, JSTRACE_OBJECT); - }); + let name = description.to_c_str(); + (*tracer).debugPrinter = None; + (*tracer).debugPrintIndex = -1; + (*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void; + debug!("tracing {:s}", description); + JS_CallTracer(tracer, obj as *mut libc::c_void, JSTRACE_OBJECT); } } @@ -185,23 +183,3 @@ impl<S: Encoder<E>, E> Encodable<S, E> for Traceable<JSVal> { Ok(()) } } - -/// for a field which contains DOMType -impl<T: Reflectable+Encodable<S, E>, S: Encoder<E>, E> Encodable<S, E> for Cell<JS<T>> { - fn encode(&self, s: &mut S) -> Result<(), E> { - self.get().encode(s) - } -} - -impl<T: Reflectable+Encodable<S, E>, S: Encoder<E>, E> Encodable<S, E> for Cell<Option<JS<T>>> { - fn encode(&self, s: &mut S) -> Result<(), E> { - self.get().encode(s) - } -} - -/// for a field which contains non-POD type contains DOMType -impl<T: Reflectable+Encodable<S, E>, S: Encoder<E>, E> Encodable<S, E> for RefCell<Vec<JS<T>>> { - fn encode(&self, s: &mut S) -> Result<(), E> { - self.borrow().encode(s) - } -} |