Loading dom/bindings/Bindings.conf +2 −0 Changes for dom/bindings/Bindings.conf: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ # interfaces. Defaults to True otherwise. # * workers - Indicates whether the descriptor is intended to be used for # worker threads (defaults to false). # * customTrace - The native class will use a custom trace hook (defaults to # true for workers, false otherwise). # * customFinalize - The native class will use a custom finalize hook # (defaults to true for workers, false otherwise). # * wantsQI - Indicates whether the interface should have a QueryInterface Loading dom/bindings/Codegen.py +20 −4 Changes for dom/bindings/Codegen.py: 20 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ AUTOGENERATED_WARNING_COMMENT = \ "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n" ADDPROPERTY_HOOK_NAME = '_addProperty' FINALIZE_HOOK_NAME = '_finalize' TRACE_HOOK_NAME = '_trace' CONSTRUCT_HOOK_NAME = '_constructor' LEGACYCALLER_HOOK_NAME = '_legacycaller' HASINSTANCE_HOOK_NAME = '_hasInstance' Loading Loading @@ -175,10 +176,7 @@ class CGDOMJSClass(CGThing): def declare(self): return "" def define(self): # Custom tracehooks are a footgun, so avoid supporting them. For instance, # you have to be careful about barriers, and if you don't set a JSClass flag, # then you'll end up permanently disabling incremental GC. traceHook = 'nullptr' traceHook = TRACE_HOOK_NAME if self.descriptor.customTrace else 'nullptr' callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr' classFlags = "JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3)" if self.descriptor.interface.getExtendedAttribute("NeedNewResolve"): Loading Loading @@ -1071,6 +1069,20 @@ class CGClassFinalizeHook(CGAbstractClassHook): def generate_code(self): return CGIndenter(finalizeHook(self.descriptor, self.name, self.args[0].name)).define() class CGClassTraceHook(CGAbstractClassHook): """ A hook to trace through our native object; used for GC and CC """ def __init__(self, descriptor): args = [Argument('JSTracer*', 'trc'), Argument('JSObject*', 'obj')] CGAbstractClassHook.__init__(self, descriptor, TRACE_HOOK_NAME, 'void', args) def generate_code(self): return """ if (self) { self->%s(%s); }""" % (self.name, self.args[0].name) class CGClassConstructor(CGAbstractStaticMethod): """ JS-visible constructor for our objects Loading Loading @@ -8011,6 +8023,10 @@ class CGDescriptor(CGThing): # wants a custom hook. cgThings.append(CGClassFinalizeHook(descriptor)) # Only generate a trace hook if the class wants a custom hook. if (descriptor.customTrace): cgThings.append(CGClassTraceHook(descriptor)) properties = PropertyArrays(descriptor) cgThings.append(CGGeneric(define=str(properties))) cgThings.append(CGNativeProperties(descriptor, properties)) Loading dom/bindings/Configuration.py +1 −0 Changes for dom/bindings/Configuration.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ class Descriptor(DescriptorProvider): raise TypeError("Descriptor for %s has unrecognized value (%s) " "for nativeOwnership" % (self.interface.identifier.name, self.nativeOwnership)) self.customTrace = desc.get('customTrace', self.workers) self.customFinalize = desc.get('customFinalize', self.workers) if desc.get('wantsQI', None) != None: self._wantsQI = desc.get('wantsQI', None) Loading Loading
dom/bindings/Bindings.conf +2 −0 Changes for dom/bindings/Bindings.conf: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ # interfaces. Defaults to True otherwise. # * workers - Indicates whether the descriptor is intended to be used for # worker threads (defaults to false). # * customTrace - The native class will use a custom trace hook (defaults to # true for workers, false otherwise). # * customFinalize - The native class will use a custom finalize hook # (defaults to true for workers, false otherwise). # * wantsQI - Indicates whether the interface should have a QueryInterface Loading
dom/bindings/Codegen.py +20 −4 Changes for dom/bindings/Codegen.py: 20 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ AUTOGENERATED_WARNING_COMMENT = \ "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n" ADDPROPERTY_HOOK_NAME = '_addProperty' FINALIZE_HOOK_NAME = '_finalize' TRACE_HOOK_NAME = '_trace' CONSTRUCT_HOOK_NAME = '_constructor' LEGACYCALLER_HOOK_NAME = '_legacycaller' HASINSTANCE_HOOK_NAME = '_hasInstance' Loading Loading @@ -175,10 +176,7 @@ class CGDOMJSClass(CGThing): def declare(self): return "" def define(self): # Custom tracehooks are a footgun, so avoid supporting them. For instance, # you have to be careful about barriers, and if you don't set a JSClass flag, # then you'll end up permanently disabling incremental GC. traceHook = 'nullptr' traceHook = TRACE_HOOK_NAME if self.descriptor.customTrace else 'nullptr' callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr' classFlags = "JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3)" if self.descriptor.interface.getExtendedAttribute("NeedNewResolve"): Loading Loading @@ -1071,6 +1069,20 @@ class CGClassFinalizeHook(CGAbstractClassHook): def generate_code(self): return CGIndenter(finalizeHook(self.descriptor, self.name, self.args[0].name)).define() class CGClassTraceHook(CGAbstractClassHook): """ A hook to trace through our native object; used for GC and CC """ def __init__(self, descriptor): args = [Argument('JSTracer*', 'trc'), Argument('JSObject*', 'obj')] CGAbstractClassHook.__init__(self, descriptor, TRACE_HOOK_NAME, 'void', args) def generate_code(self): return """ if (self) { self->%s(%s); }""" % (self.name, self.args[0].name) class CGClassConstructor(CGAbstractStaticMethod): """ JS-visible constructor for our objects Loading Loading @@ -8011,6 +8023,10 @@ class CGDescriptor(CGThing): # wants a custom hook. cgThings.append(CGClassFinalizeHook(descriptor)) # Only generate a trace hook if the class wants a custom hook. if (descriptor.customTrace): cgThings.append(CGClassTraceHook(descriptor)) properties = PropertyArrays(descriptor) cgThings.append(CGGeneric(define=str(properties))) cgThings.append(CGNativeProperties(descriptor, properties)) Loading
dom/bindings/Configuration.py +1 −0 Changes for dom/bindings/Configuration.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ class Descriptor(DescriptorProvider): raise TypeError("Descriptor for %s has unrecognized value (%s) " "for nativeOwnership" % (self.interface.identifier.name, self.nativeOwnership)) self.customTrace = desc.get('customTrace', self.workers) self.customFinalize = desc.get('customFinalize', self.workers) if desc.get('wantsQI', None) != None: self._wantsQI = desc.get('wantsQI', None) Loading