mirror of
https://github.com/servo/servo.git
synced 2025-06-17 12:54:28 +00:00
Make proxy bindings generate trace and finalization hooks.
This commit is contained in:
parent
74c3859548
commit
cb826f9920
4 changed files with 16 additions and 9 deletions
|
@ -2867,14 +2867,17 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||||
//regexp_toShared: ptr::null(),
|
//regexp_toShared: ptr::null(),
|
||||||
defaultValue: ptr::null(),
|
defaultValue: ptr::null(),
|
||||||
iteratorNext: ptr::null(),
|
iteratorNext: ptr::null(),
|
||||||
finalize: ptr::null(),
|
finalize: %s,
|
||||||
getElementIfPresent: ptr::null(),
|
getElementIfPresent: ptr::null(),
|
||||||
getPrototypeOf: ptr::null()
|
getPrototypeOf: ptr::null(),
|
||||||
|
trace: %s
|
||||||
};
|
};
|
||||||
(*page).js_info.get_mut_ref().dom_static.proxy_handlers.insert(PrototypeList::id::%s as uint,
|
(*page).js_info.get_mut_ref().dom_static.proxy_handlers.insert(PrototypeList::id::%s as uint,
|
||||||
CreateProxyHandler(ptr::to_unsafe_ptr(&traps), ptr::to_unsafe_ptr(&Class) as *libc::c_void));
|
CreateProxyHandler(ptr::to_unsafe_ptr(&traps), ptr::to_unsafe_ptr(&Class) as *libc::c_void));
|
||||||
|
|
||||||
""" % self.descriptor.name
|
""" % (FINALIZE_HOOK_NAME,
|
||||||
|
('Some(%s)' % TRACE_HOOK_NAME) if self.descriptor.customTrace else 'None',
|
||||||
|
self.descriptor.name)
|
||||||
else:
|
else:
|
||||||
body += """ (*page).js_info.get_ref().dom_static.attribute_ids.insert(PrototypeList::id::%s as uint,
|
body += """ (*page).js_info.get_ref().dom_static.attribute_ids.insert(PrototypeList::id::%s as uint,
|
||||||
vec::cast_to_mut(vec::from_slice(sAttributes_ids)));
|
vec::cast_to_mut(vec::from_slice(sAttributes_ids)));
|
||||||
|
@ -4196,7 +4199,7 @@ class CGDescriptor(CGThing):
|
||||||
#if hasLenientSetter: cgThings.append(CGGenericSetter(descriptor,
|
#if hasLenientSetter: cgThings.append(CGGenericSetter(descriptor,
|
||||||
# lenientThis=True))
|
# lenientThis=True))
|
||||||
|
|
||||||
if descriptor.concrete and not descriptor.proxy:
|
if descriptor.concrete:
|
||||||
if not descriptor.workers and descriptor.wrapperCache:
|
if not descriptor.workers and descriptor.wrapperCache:
|
||||||
#cgThings.append(CGAddPropertyHook(descriptor))
|
#cgThings.append(CGAddPropertyHook(descriptor))
|
||||||
pass
|
pass
|
||||||
|
@ -4208,7 +4211,6 @@ class CGDescriptor(CGThing):
|
||||||
# Only generate a trace hook if the class wants a custom hook.
|
# Only generate a trace hook if the class wants a custom hook.
|
||||||
if (descriptor.customTrace):
|
if (descriptor.customTrace):
|
||||||
cgThings.append(CGClassTraceHook(descriptor))
|
cgThings.append(CGClassTraceHook(descriptor))
|
||||||
pass
|
|
||||||
|
|
||||||
if descriptor.interface.hasInterfaceObject():
|
if descriptor.interface.hasInterfaceObject():
|
||||||
cgThings.append(CGClassConstructHook(descriptor))
|
cgThings.append(CGClassConstructHook(descriptor))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::codegen::HTMLDocumentBinding;
|
use dom::bindings::codegen::HTMLDocumentBinding;
|
||||||
use dom::bindings::utils::{DOMString, ErrorResult, Fallible};
|
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Traceable};
|
||||||
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache};
|
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache};
|
||||||
use dom::document::{AbstractDocument, Document, WrappableDocument, HTML};
|
use dom::document::{AbstractDocument, Document, WrappableDocument, HTML};
|
||||||
use dom::element::HTMLHeadElementTypeId;
|
use dom::element::HTMLHeadElementTypeId;
|
||||||
|
@ -11,7 +11,7 @@ use dom::htmlcollection::HTMLCollection;
|
||||||
use dom::node::{AbstractNode, ScriptView, ElementNodeTypeId};
|
use dom::node::{AbstractNode, ScriptView, ElementNodeTypeId};
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
|
|
||||||
use js::jsapi::{JSObject, JSContext};
|
use js::jsapi::{JSObject, JSContext, JSTracer};
|
||||||
|
|
||||||
use servo_util::tree::TreeNodeRef;
|
use servo_util::tree::TreeNodeRef;
|
||||||
|
|
||||||
|
@ -212,3 +212,8 @@ impl BindingObject for HTMLDocument {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Traceable for HTMLDocument {
|
||||||
|
fn trace(&self, tracer: *mut JSTracer) {
|
||||||
|
self.parent.trace(tracer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
Subproject commit 15c494b9204bb4ecdfbeab142c0ea01e5f0c9a1b
|
Subproject commit 81aeed0b6159acdedf7dd530fb6c3bde5ddbb70a
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b83f5f77a6215864738a5636a9bc9db2a097070
|
Subproject commit 1a9a5c3c1462bd3b3e7905ee2834a5ba906f0214
|
Loading…
Add table
Add a link
Reference in a new issue