diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 6 | ||||
-rw-r--r-- | src/components/script/dom/bindings/trace.rs | 12 | ||||
-rw-r--r-- | src/components/script/dom/bindings/utils.rs | 6 |
3 files changed, 7 insertions, 17 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 58e805a0c19..17001fd734a 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -1757,7 +1757,8 @@ def CreateBindingJSObject(descriptor, parent=None): assert not descriptor.createGlobal create += """ let js_info = aScope.deref().page().js_info(); -let handler = js_info.get_ref().dom_static.proxy_handlers.deref().get(&(PrototypeList::id::%s as uint)); +let mut handlers = js_info.get_ref().dom_static.proxy_handlers.deref().borrow_mut(); +let handler = handlers.get(&(PrototypeList::id::%s as uint)); let mut private = PrivateValue(squirrel_away_unique(aObject) as *libc::c_void); let obj = with_compartment(aCx, proto, || { NewProxyObject(aCx, *handler, @@ -2080,7 +2081,8 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod): getPrototypeOf: None, trace: Some(%s) }; -js_info.dom_static.proxy_handlers.insert(PrototypeList::id::%s as uint, +let mut handlers = js_info.dom_static.proxy_handlers.deref().borrow_mut(); +handlers.insert(PrototypeList::id::%s as uint, CreateProxyHandler(&traps, &Class as *_ as *_)); """ % (FINALIZE_HOOK_NAME, diff --git a/src/components/script/dom/bindings/trace.rs b/src/components/script/dom/bindings/trace.rs index 1c3655bbde3..8cbf32e0cbd 100644 --- a/src/components/script/dom/bindings/trace.rs +++ b/src/components/script/dom/bindings/trace.rs @@ -104,12 +104,6 @@ impl<T> Deref<T> for Untraceable<T> { } } -impl<T> DerefMut<T> for Untraceable<T> { - fn deref_mut<'a>(&'a mut self) -> &'a mut T { - &mut self.inner - } -} - /// Encapsulates a type that can be traced but is boxed in a type we don't control /// (such as RefCell). Wrap a field in Traceable and implement the Encodable trait /// for that new concrete type to achieve magic compiler-derived trace hooks. @@ -135,12 +129,6 @@ impl<T> Deref<T> for Traceable<T> { } } -impl<T> DerefMut<T> for Traceable<T> { - fn deref_mut<'a>(&'a mut self) -> &'a mut T { - &mut self.inner - } -} - impl<S: Encoder<E>, E, T: Encodable<S, E>> Encodable<S, E> for Traceable<RefCell<T>> { fn encode(&self, s: &mut S) -> Result<(), E> { self.borrow().encode(s) diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index d2c1a43ccf8..2c494c2008e 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -14,7 +14,7 @@ use servo_util::str::DOMString; use std::collections::hashmap::HashMap; use libc; use libc::c_uint; -use std::cell::Cell; +use std::cell::{Cell, RefCell}; use std::mem; use std::cmp::PartialEq; use std::ptr; @@ -52,13 +52,13 @@ use js; #[allow(raw_pointer_deriving)] #[deriving(Encodable)] pub struct GlobalStaticData { - pub proxy_handlers: Untraceable<HashMap<uint, *libc::c_void>>, + pub proxy_handlers: Untraceable<RefCell<HashMap<uint, *libc::c_void>>>, pub windowproxy_handler: Untraceable<*libc::c_void>, } pub fn GlobalStaticData() -> GlobalStaticData { GlobalStaticData { - proxy_handlers: Untraceable::new(HashMap::new()), + proxy_handlers: Untraceable::new(RefCell::new(HashMap::new())), windowproxy_handler: Untraceable::new(browsercontext::new_window_proxy_handler()), } } |