Rename squirrel_away_unboxed to squirrel_away_unique.(fixes #1938)

This commit is contained in:
lpy 2014-03-20 17:14:31 +08:00
parent 6040271db3
commit 34b73837d3
2 changed files with 5 additions and 5 deletions

View file

@ -2068,7 +2068,7 @@ def CreateBindingJSObject(descriptor, parent=None):
let handler = js_info.get().get_ref().dom_static.proxy_handlers.get(&(PrototypeList::id::%s as uint)); let handler = js_info.get().get_ref().dom_static.proxy_handlers.get(&(PrototypeList::id::%s as uint));
""" % descriptor.name """ % descriptor.name
create += handler + """ let obj = NewProxyObject(aCx, *handler, create += handler + """ let obj = NewProxyObject(aCx, *handler,
&PrivateValue(squirrel_away_unboxed(aObject) as *libc::c_void), &PrivateValue(squirrel_away_unique(aObject) as *libc::c_void),
proto, %s, proto, %s,
ptr::null(), ptr::null()); ptr::null(), ptr::null());
assert!(obj.is_not_null()); assert!(obj.is_not_null());
@ -2082,7 +2082,7 @@ def CreateBindingJSObject(descriptor, parent=None):
create += """ assert!(obj.is_not_null()); create += """ assert!(obj.is_not_null());
JS_SetReservedSlot(obj, DOM_OBJECT_SLOT as u32, JS_SetReservedSlot(obj, DOM_OBJECT_SLOT as u32,
PrivateValue(squirrel_away_unboxed(aObject) as *libc::c_void)); PrivateValue(squirrel_away_unique(aObject) as *libc::c_void));
""" """
return create return create
@ -4793,7 +4793,7 @@ class CGBindingRoot(CGThing):
'dom::bindings::utils::{NativePropertyHooks}', 'dom::bindings::utils::{NativePropertyHooks}',
'dom::bindings::utils::global_object_for_js_object', 'dom::bindings::utils::global_object_for_js_object',
'dom::bindings::utils::{Reflectable}', 'dom::bindings::utils::{Reflectable}',
'dom::bindings::utils::{squirrel_away_unboxed}', 'dom::bindings::utils::{squirrel_away_unique}',
'dom::bindings::utils::{ThrowingConstructor, unwrap, unwrap_jsmanaged}', 'dom::bindings::utils::{ThrowingConstructor, unwrap, unwrap_jsmanaged}',
'dom::bindings::utils::{unwrap_object, VoidVal, with_gc_disabled}', 'dom::bindings::utils::{unwrap_object, VoidVal, with_gc_disabled}',
'dom::bindings::utils::{with_gc_enabled, XrayResolveProperty}', 'dom::bindings::utils::{with_gc_enabled, XrayResolveProperty}',

View file

@ -135,7 +135,7 @@ pub fn unwrap_value<T>(val: *JSVal, proto_id: PrototypeList::id::ID, proto_depth
} }
} }
pub unsafe fn squirrel_away_unboxed<T>(x: ~T) -> *T { pub unsafe fn squirrel_away_unique<T>(x: ~T) -> *T {
cast::transmute(x) cast::transmute(x)
} }
@ -409,7 +409,7 @@ pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: c_uint, _vp: *mut JSVa
pub fn initialize_global(global: *JSObject) { pub fn initialize_global(global: *JSObject) {
let protoArray = ~([0 as *JSObject, ..PrototypeList::id::IDCount as uint]); let protoArray = ~([0 as *JSObject, ..PrototypeList::id::IDCount as uint]);
unsafe { unsafe {
let box_ = squirrel_away_unboxed(protoArray); let box_ = squirrel_away_unique(protoArray);
JS_SetReservedSlot(global, JS_SetReservedSlot(global,
DOM_PROTOTYPE_SLOT, DOM_PROTOTYPE_SLOT,
PrivateValue(box_ as *libc::c_void)); PrivateValue(box_ as *libc::c_void));