Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prototypes of interface objects (fixes #2665) #8954

Merged
merged 8 commits into from Jan 12, 2016
Next

Remove NativePropertyHooks

  • Loading branch information
nox committed Jan 12, 2016
commit 967948be06327997f7c1a6e3c9291e75753ced85
@@ -276,34 +276,6 @@ def define(self):
raise NotImplementedError # Override me!


class CGNativePropertyHooks(CGThing):
"""
Generate a NativePropertyHooks for a given descriptor
"""
def __init__(self, descriptor, properties):
CGThing.__init__(self)
self.descriptor = descriptor
self.properties = properties

def define(self):
parent = self.descriptor.interface.parent
if parent:
parentHooks = ("Some(&::dom::bindings::codegen::Bindings::%sBinding::sNativePropertyHooks)"
% parent.identifier.name)
else:
parentHooks = "None"

substitutions = {
"parentHooks": parentHooks
}

return string.Template(
"pub static sNativePropertyHooks: NativePropertyHooks = NativePropertyHooks {\n"
" native_properties: &sNativeProperties,\n"
" proto_hooks: ${parentHooks},\n"
"};\n").substitute(substitutions)


class CGMethodCall(CGThing):
"""
A class to generate selection of a method signature from a set of
@@ -1760,7 +1732,6 @@ def DOMClass(descriptor):
return """\
DOMClass {
interface_chain: [ %s ],
native_hooks: &sNativePropertyHooks,
type_id: %s,
heap_size_of: %s as unsafe fn(_) -> _,
}""" % (prototypeChainString, DOMClassTypeId(descriptor), heapSizeOf)
@@ -4913,7 +4884,6 @@ def __init__(self, descriptor):
properties = PropertyArrays(descriptor)
cgThings.append(CGGeneric(str(properties)))
cgThings.append(CGNativeProperties(descriptor, properties))
cgThings.append(CGNativePropertyHooks(descriptor, properties))
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))

cgThings.append(CGNamespace.build([descriptor.name + "Constants"],
@@ -5331,8 +5301,8 @@ def __init__(self, config, prefix, webIDLFile):
'dom::bindings::reflector::{Reflectable}',
'dom::bindings::utils::{ConstantSpec, DOMClass, DOMJSClass}',
'dom::bindings::utils::{DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL}',
'dom::bindings::utils::{NativeProperties, NativePropertyHooks, NonNullJSNative}',
'dom::bindings::utils::{create_dom_global, do_create_interface_objects, finalize_global}',
'dom::bindings::utils::{NativeProperties, NonNullJSNative, create_dom_global}',
'dom::bindings::utils::{do_create_interface_objects, finalize_global}',
'dom::bindings::utils::{find_enum_string_index, generic_getter}',
'dom::bindings::utils::{generic_lenient_getter, generic_lenient_setter}',
'dom::bindings::utils::{generic_method, generic_setter, get_array_index_from_id}',
@@ -129,15 +129,6 @@ impl ConstantSpec {
}
}

/// Helper structure for cross-origin wrappers for DOM binding objects.
pub struct NativePropertyHooks {
/// The property arrays for this interface.
pub native_properties: &'static NativeProperties,

/// The NativePropertyHooks instance for the parent interface, if any.
pub proto_hooks: Option<&'static NativePropertyHooks>,
}

/// The struct that holds inheritance information for DOM object reflectors.
#[derive(Copy, Clone)]
pub struct DOMClass {
@@ -148,9 +139,6 @@ pub struct DOMClass {
/// The type ID of that interface.
pub type_id: TopTypeId,

/// The NativePropertyHooks for the interface associated with this class.
pub native_hooks: &'static NativePropertyHooks,

/// The HeapSizeOf function wrapper for that interface.
pub heap_size_of: unsafe fn(*const libc::c_void) -> usize,
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.