示例#1
0
def attribute_context(interface, attribute):
    # Call v8's implementation.
    context = v8_attributes.attribute_context(interface, attribute)

    extended_attributes = attribute.extended_attributes

    # Augment's Dart's information to context.
    idl_type = attribute.idl_type
    base_idl_type = idl_type.base_type
    # TODO(terry): Work around for DOMString[] base should be IDLTypeArray
    if base_idl_type == None:
        # Returns Array or Sequence.
        base_idl_type = idl_type.inner_name

    # [Custom]
    has_custom_getter = ('Custom' in extended_attributes and
                          extended_attributes['Custom'] in [None, 'Getter'])
    has_custom_setter = (not attribute.is_read_only and
                         (('Custom' in extended_attributes and
                          extended_attributes['Custom'] in [None, 'Setter'])))

    is_call_with_script_state = DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState')

    is_auto_scope = not 'DartNoAutoScope' in extended_attributes

    context.update({
      'has_custom_getter': has_custom_getter,
      'has_custom_setter': has_custom_setter,
      'is_auto_scope': is_auto_scope,   # Used internally (outside of templates).
      'is_call_with_script_state': is_call_with_script_state,
      'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope),
      'dart_type': dart_types.idl_type_to_dart_type(idl_type),
    })

    if v8_attributes.is_constructor_attribute(attribute):
        v8_attributes.constructor_getter_context(interface, attribute, context)
        return context
    if not v8_attributes.has_custom_getter(attribute):
        getter_context(interface, attribute, context)
    if (not attribute.is_read_only):
        # FIXME: We did not previously support the PutForwards attribute, so I am
        # disabling it here for now to get things compiling.
        # We may wish to revisit this.
        # if (not has_custom_setter(attribute) and
        # (not attribute.is_read_only or 'PutForwards' in extended_attributes)):
        setter_context(interface, attribute, context)

    native_entry_getter = \
        DartUtilities.generate_native_entry(
            interface.name, attribute.name, 'Getter', attribute.is_static, 0)
    native_entry_setter = \
        DartUtilities.generate_native_entry(
            interface.name, attribute.name, 'Setter', attribute.is_static, 1)
    context.update({
        'native_entry_getter': native_entry_getter,
        'native_entry_setter': native_entry_setter,
    })

    return context
示例#2
0
def attribute_context(interface, attribute):
    # Call v8's implementation.
    context = v8_attributes.attribute_context(interface, attribute)

    extended_attributes = attribute.extended_attributes

    # Augment's Dart's information to context.
    idl_type = attribute.idl_type
    base_idl_type = idl_type.base_type
    # TODO(terry): Work around for DOMString[] base should be IDLTypeArray
    if base_idl_type == None:
        # Returns Array or Sequence.
        base_idl_type = idl_type.inner_name

    # [Custom]
    has_custom_getter = ('Custom' in extended_attributes and
                          extended_attributes['Custom'] in [None, 'Getter'])
    has_custom_setter = (not attribute.is_read_only and
                         (('Custom' in extended_attributes and
                          extended_attributes['Custom'] in [None, 'Setter'])))

    is_call_with_script_state = DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState')

    is_auto_scope = not 'DartNoAutoScope' in extended_attributes

    context.update({
      'has_custom_getter': has_custom_getter,
      'has_custom_setter': has_custom_setter,
      'is_auto_scope': is_auto_scope,   # Used internally (outside of templates).
      'is_call_with_script_state': is_call_with_script_state,
      'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope),
      'dart_type': dart_types.idl_type_to_dart_type(idl_type),
    })

    if v8_attributes.is_constructor_attribute(attribute):
        v8_attributes.constructor_getter_context(interface, attribute, context)
        return context
    if not v8_attributes.has_custom_getter(attribute):
        getter_context(interface, attribute, context)
    if (not attribute.is_read_only):
        # FIXME: We did not previously support the PutForwards attribute, so I am
        # disabling it here for now to get things compiling.
        # We may wish to revisit this.
        # if (not has_custom_setter(attribute) and
        # (not attribute.is_read_only or 'PutForwards' in extended_attributes)):
        setter_context(interface, attribute, context)

    native_entry_getter = \
        DartUtilities.generate_native_entry(
            interface.name, attribute.name, 'Getter', attribute.is_static, 0)
    native_entry_setter = \
        DartUtilities.generate_native_entry(
            interface.name, attribute.name, 'Setter', attribute.is_static, 1)
    context.update({
        'native_entry_getter': native_entry_getter,
        'native_entry_setter': native_entry_setter,
    })

    return context
示例#3
0
def setter_callback_name(interface, attribute):
    cpp_class_name = DartUtilities.cpp_name(interface)
    extended_attributes = attribute.extended_attributes
    if (('Replaceable' in extended_attributes and
         'PutForwards' not in extended_attributes) or
        v8_attributes.is_constructor_attribute(attribute)):
        # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors
        return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name)
    # FIXME:disabling PutForwards for now since we didn't support it before
    #    if attribute.is_read_only and 'PutForwards' not in extended_attributes:
    if attribute.is_read_only:
        return '0'
    return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name)
示例#4
0
def setter_callback_name(interface, attribute):
    cpp_class_name = DartUtilities.cpp_name(interface)
    extended_attributes = attribute.extended_attributes
    if (('Replaceable' in extended_attributes and
         'PutForwards' not in extended_attributes) or
        v8_attributes.is_constructor_attribute(attribute)):
        # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors
        return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name)
    # FIXME:disabling PutForwards for now since we didn't support it before
    #    if attribute.is_read_only and 'PutForwards' not in extended_attributes:
    if attribute.is_read_only:
        return '0'
    return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name)
示例#5
0
def interface_context(interface):
    context = v8_interface.interface_context(interface)

    includes.clear()

    includes.update(INTERFACE_CPP_INCLUDES)
    header_includes = set(INTERFACE_H_INCLUDES)

    parent_interface = interface.parent
    if parent_interface:
        header_includes.update(dart_types.includes_for_interface(parent_interface))
    extended_attributes = interface.extended_attributes

    if inherits_interface(interface.name, 'EventTarget'):
        includes.update(['bindings/dart_event_listener.h'])

    # [SetWrapperReferenceTo]
    set_wrapper_reference_to_list = [{
        'name': argument.name,
        # FIXME: properly should be:
        # 'cpp_type': argument.idl_type.cpp_type_args(used_as_rvalue_type=True),
        # (if type is non-wrapper type like NodeFilter, normally RefPtr)
        # Raw pointers faster though, and NodeFilter hacky anyway.
        'cpp_type': argument.idl_type.implemented_as + '*',
        'idl_type': argument.idl_type,
    } for argument in extended_attributes.get('SetWrapperReferenceTo', [])]
    for set_wrapper_reference_to in set_wrapper_reference_to_list:
        set_wrapper_reference_to['idl_type'].add_includes_for_type()

    context.update({
        'cpp_class': DartUtilities.cpp_name(interface),
        'header_includes': header_includes,
         'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
        'dart_class': dart_types.dart_type(interface.name),
    })

    # Constructors
    constructors = [constructor_context(interface, constructor)
                    for constructor in interface.constructors
                    # FIXME: shouldn't put named constructors with constructors
                    # (currently needed for Perl compatibility)
                    # Handle named constructors separately
                    if constructor.name == 'Constructor']
    if len(constructors) > 1:
        context.update({'constructor_overloads': overloads_context(constructors)})

    # [CustomConstructor]
    custom_constructors = [custom_constructor_context(interface, constructor)
                           for constructor in interface.custom_constructors]

    # [NamedConstructor]
    named_constructor = generate_named_constructor(interface)

    generate_method_native_entries(interface, constructors, 'Constructor')
    generate_method_native_entries(interface, custom_constructors, 'Constructor')
    if named_constructor:
        generate_method_native_entries(interface, [named_constructor],
                                       'Constructor')
    event_constructor = None
    if context['has_event_constructor']:
        event_constructor = {
            'native_entries': [
                DartUtilities.generate_native_entry(
                    interface.name, None, 'Constructor', False, 2)],
        }

    if (context['constructors'] or custom_constructors or context['has_event_constructor'] or
        named_constructor):
        includes.add('core/frame/LocalDOMWindow.h')

    context.update({
        'constructors': constructors,
        'custom_constructors': custom_constructors,
        'event_constructor': event_constructor,
        'has_custom_constructor': bool(custom_constructors),
        'interface_length':
            v8_interface.interface_length(interface, constructors + custom_constructors),
        'is_constructor_call_with_document': DartUtilities.has_extended_attribute_value(
            interface, 'ConstructorCallWith', 'Document'),  # [ConstructorCallWith=Document]
        'is_constructor_call_with_execution_context': DartUtilities.has_extended_attribute_value(
            interface, 'ConstructorCallWith', 'ExecutionContext'),  # [ConstructorCallWith=ExeuctionContext]
        'named_constructor': named_constructor,
    })

    # Attributes
    attributes = [dart_attributes.attribute_context(interface, attribute)
                  for attribute in interface.attributes
                      if not v8_attributes.is_constructor_attribute(attribute)]
    context.update({
        'attributes': attributes,
        'has_constructor_attributes': any(attribute['constructor_type'] for attribute in attributes),
        'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes),
    })

    # Methods
    methods = [dart_methods.method_context(interface, method)
               for method in interface.operations
               # Skip anonymous special operations (methods name empty).
               if (method.name and
                   # detect unnamed getters from v8_interface.
                   method.name != 'anonymousNamedGetter')]
    compute_method_overloads_context(methods)
    for method in methods:
        method['do_generate_method_configuration'] = (
            # For overloaded methods, only generate one accessor
            ('overload_index' not in method or method['overload_index'] == 1))

    for method in methods:
        assert 'overloads' not in method, 'Dart does not support overloads, %s in %s' % (method['name'], interface.name)

    generate_method_native_entries(interface, methods, 'Method')

    context.update({
        'has_method_configuration': any(method['do_generate_method_configuration'] for method in methods),
        'methods': methods,
    })

    context.update({
        'indexed_property_getter': indexed_property_getter(interface),
        'indexed_property_setter': indexed_property_setter(interface),
        'indexed_property_deleter': v8_interface.indexed_property_deleter(interface),
        'is_override_builtins': 'OverrideBuiltins' in extended_attributes,
        'named_property_getter': named_property_getter(interface),
        'named_property_setter': named_property_setter(interface),
        'named_property_deleter': v8_interface.named_property_deleter(interface),
    })

    generate_native_entries_for_specials(interface, context)

    native_entries = generate_interface_native_entries(context)

    context.update({
        'native_entries': native_entries,
    })

    return context
def interface_context(interface):
    context = v8_interface.interface_context(interface)

    includes.clear()

    includes.update(INTERFACE_CPP_INCLUDES)
    header_includes = set(INTERFACE_H_INCLUDES)

    parent_interface = interface.parent
    if parent_interface:
        header_includes.update(
            dart_types.includes_for_interface(parent_interface))
    extended_attributes = interface.extended_attributes

    if inherits_interface(interface.name, 'EventTarget'):
        includes.update(['bindings/dart_event_listener.h'])

    # [SetWrapperReferenceTo]
    set_wrapper_reference_to_list = [
        {
            'name': argument.name,
            # FIXME: properly should be:
            # 'cpp_type': argument.idl_type.cpp_type_args(used_as_rvalue_type=True),
            # (if type is non-wrapper type like NodeFilter, normally RefPtr)
            # Raw pointers faster though, and NodeFilter hacky anyway.
            'cpp_type': argument.idl_type.implemented_as + '*',
            'idl_type': argument.idl_type,
        } for argument in extended_attributes.get('SetWrapperReferenceTo', [])
    ]
    for set_wrapper_reference_to in set_wrapper_reference_to_list:
        set_wrapper_reference_to['idl_type'].add_includes_for_type()

    context.update({
        'cpp_class': DartUtilities.cpp_name(interface),
        'header_includes': header_includes,
        'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
        'dart_class': dart_types.dart_type(interface.name),
    })

    # Constructors
    constructors = [
        constructor_context(interface, constructor)
        for constructor in interface.constructors
        # FIXME: shouldn't put named constructors with constructors
        # (currently needed for Perl compatibility)
        # Handle named constructors separately
        if constructor.name == 'Constructor'
    ]
    if len(constructors) > 1:
        context.update(
            {'constructor_overloads': overloads_context(constructors)})

    # [CustomConstructor]
    custom_constructors = [
        custom_constructor_context(interface, constructor)
        for constructor in interface.custom_constructors
    ]

    # [NamedConstructor]
    named_constructor = generate_named_constructor(interface)

    generate_method_native_entries(interface, constructors, 'Constructor')
    generate_method_native_entries(interface, custom_constructors,
                                   'Constructor')
    if named_constructor:
        generate_method_native_entries(interface, [named_constructor],
                                       'Constructor')
    event_constructor = None
    if context['has_event_constructor']:
        event_constructor = {
            'native_entries': [
                DartUtilities.generate_native_entry(interface.name, None,
                                                    'Constructor', False, 2)
            ],
        }

    context.update({
        'constructors':
        constructors,
        'custom_constructors':
        custom_constructors,
        'event_constructor':
        event_constructor,
        'has_custom_constructor':
        bool(custom_constructors),
        'interface_length':
        v8_interface.interface_length(interface,
                                      constructors + custom_constructors),
        'is_constructor_call_with_execution_context':
        DartUtilities.has_extended_attribute_value(
            interface, 'ConstructorCallWith',
            'ExecutionContext'),  # [ConstructorCallWith=ExeuctionContext]
        'named_constructor':
        named_constructor,
    })

    # Attributes
    attributes = [
        dart_attributes.attribute_context(interface, attribute)
        for attribute in interface.attributes
        if not v8_attributes.is_constructor_attribute(attribute)
    ]
    context.update({
        'attributes':
        attributes,
        'has_constructor_attributes':
        any(attribute['constructor_type'] for attribute in attributes),
        'has_replaceable_attributes':
        any(attribute['is_replaceable'] for attribute in attributes),
    })

    # Methods
    methods = [
        dart_methods.method_context(interface, method)
        for method in interface.operations
        # Skip anonymous special operations (methods name empty).
        if (method.name and
            # detect unnamed getters from v8_interface.
            method.name != 'anonymousNamedGetter')
    ]
    compute_method_overloads_context(methods)
    for method in methods:
        method['do_generate_method_configuration'] = (
            # For overloaded methods, only generate one accessor
            ('overload_index' not in method or method['overload_index'] == 1))

    for method in methods:
        assert 'overloads' not in method, 'Dart does not support overloads, %s in %s' % (
            method['name'], interface.name)

    generate_method_native_entries(interface, methods, 'Method')

    context.update({
        'has_method_configuration':
        any(method['do_generate_method_configuration'] for method in methods),
        'methods':
        methods,
    })

    context.update({
        'indexed_property_getter':
        indexed_property_getter(interface),
        'indexed_property_setter':
        indexed_property_setter(interface),
        'indexed_property_deleter':
        v8_interface.indexed_property_deleter(interface),
        'is_override_builtins':
        'OverrideBuiltins' in extended_attributes,
        'named_property_getter':
        named_property_getter(interface),
        'named_property_setter':
        named_property_setter(interface),
        'named_property_deleter':
        v8_interface.named_property_deleter(interface),
    })

    generate_native_entries_for_specials(interface, context)

    native_entries = generate_interface_native_entries(context)

    context.update({
        'native_entries': native_entries,
    })

    return context
示例#7
0
def interface_context(interface):
    context = v8_interface.interface_context(interface)

    includes.clear()

    includes.update(INTERFACE_CPP_INCLUDES)
    header_includes = set(INTERFACE_H_INCLUDES)

    parent_interface = interface.parent
    if parent_interface:
        header_includes.update(dart_types.includes_for_interface(parent_interface))
    extended_attributes = interface.extended_attributes

    if inherits_interface(interface.name, "EventTarget"):
        includes.update(["bindings/dart_event_listener.h"])

    # [SetWrapperReferenceTo]
    set_wrapper_reference_to_list = [
        {
            "name": argument.name,
            # FIXME: properly should be:
            # 'cpp_type': argument.idl_type.cpp_type_args(used_as_rvalue_type=True),
            # (if type is non-wrapper type like NodeFilter, normally RefPtr)
            # Raw pointers faster though, and NodeFilter hacky anyway.
            "cpp_type": argument.idl_type.implemented_as + "*",
            "idl_type": argument.idl_type,
        }
        for argument in extended_attributes.get("SetWrapperReferenceTo", [])
    ]
    for set_wrapper_reference_to in set_wrapper_reference_to_list:
        set_wrapper_reference_to["idl_type"].add_includes_for_type()

    context.update(
        {
            "cpp_class": DartUtilities.cpp_name(interface),
            "header_includes": header_includes,
            "set_wrapper_reference_to_list": set_wrapper_reference_to_list,
            "dart_class": dart_types.dart_type(interface.name),
        }
    )

    # Constructors
    constructors = [
        constructor_context(interface, constructor)
        for constructor in interface.constructors
        # FIXME: shouldn't put named constructors with constructors
        # (currently needed for Perl compatibility)
        # Handle named constructors separately
        if constructor.name == "Constructor"
    ]
    if len(constructors) > 1:
        context.update({"constructor_overloads": overloads_context(constructors)})

    # [CustomConstructor]
    custom_constructors = [
        custom_constructor_context(interface, constructor) for constructor in interface.custom_constructors
    ]

    # [NamedConstructor]
    named_constructor = generate_named_constructor(interface)

    generate_method_native_entries(interface, constructors, "Constructor")
    generate_method_native_entries(interface, custom_constructors, "Constructor")
    if named_constructor:
        generate_method_native_entries(interface, [named_constructor], "Constructor")
    event_constructor = None
    if context["has_event_constructor"]:
        event_constructor = {
            "native_entries": [DartUtilities.generate_native_entry(interface.name, None, "Constructor", False, 2)]
        }

    context.update(
        {
            "constructors": constructors,
            "custom_constructors": custom_constructors,
            "event_constructor": event_constructor,
            "has_custom_constructor": bool(custom_constructors),
            "interface_length": v8_interface.interface_length(interface, constructors + custom_constructors),
            "is_constructor_call_with_execution_context": DartUtilities.has_extended_attribute_value(
                interface, "ConstructorCallWith", "ExecutionContext"
            ),  # [ConstructorCallWith=ExeuctionContext]
            "named_constructor": named_constructor,
        }
    )

    # Attributes
    attributes = [
        dart_attributes.attribute_context(interface, attribute)
        for attribute in interface.attributes
        if not v8_attributes.is_constructor_attribute(attribute)
    ]
    context.update(
        {
            "attributes": attributes,
            "has_constructor_attributes": any(attribute["constructor_type"] for attribute in attributes),
            "has_replaceable_attributes": any(attribute["is_replaceable"] for attribute in attributes),
        }
    )

    # Methods
    methods = [
        dart_methods.method_context(interface, method)
        for method in interface.operations
        # Skip anonymous special operations (methods name empty).
        if (
            method.name
            and
            # detect unnamed getters from v8_interface.
            method.name != "anonymousNamedGetter"
        )
    ]
    compute_method_overloads_context(methods)
    for method in methods:
        method["do_generate_method_configuration"] = (
            # For overloaded methods, only generate one accessor
            "overload_index" not in method or method["overload_index"] == 1
        )

    for method in methods:
        assert "overloads" not in method, "Dart does not support overloads, %s in %s" % (method["name"], interface.name)

    generate_method_native_entries(interface, methods, "Method")

    context.update(
        {
            "has_method_configuration": any(method["do_generate_method_configuration"] for method in methods),
            "methods": methods,
        }
    )

    context.update(
        {
            "indexed_property_getter": indexed_property_getter(interface),
            "indexed_property_setter": indexed_property_setter(interface),
            "indexed_property_deleter": v8_interface.indexed_property_deleter(interface),
            "is_override_builtins": "OverrideBuiltins" in extended_attributes,
            "named_property_getter": named_property_getter(interface),
            "named_property_setter": named_property_setter(interface),
            "named_property_deleter": v8_interface.named_property_deleter(interface),
        }
    )

    generate_native_entries_for_specials(interface, context)

    native_entries = generate_interface_native_entries(context)

    context.update({"native_entries": native_entries})

    return context
示例#8
0
 def attribute_context(self, interface, attribute, definitions):
     """Create template values for attribute bindings."""
     cobalt_name = attribute.extended_attributes.get(
         'ImplementedAs', convert_to_cobalt_name(attribute.name))
     context = {
         'idl_name':
         attribute.name,
         'getter_function_name':
         cobalt_name,
         'setter_function_name':
         'set_' + cobalt_name,
         'type':
         self.typed_object_to_cobalt_type(interface, attribute),
         'is_static':
         attribute.is_static,
         'on_instance':
         v8_utilities.on_instance(interface, attribute),
         'on_interface':
         v8_utilities.on_interface(interface, attribute),
         'on_prototype':
         v8_utilities.on_prototype(interface, attribute),
         'is_read_only':
         attribute.is_read_only,
         'call_with':
         attribute.extended_attributes.get('CallWith', None),
         'raises_exception':
         attribute.extended_attributes.has_key('RaisesException'),
         'conversion_flags':
         get_conversion_flags(self.resolve_typedef(attribute.idl_type),
                              attribute.extended_attributes),
         'conditional':
         attribute.extended_attributes.get('Conditional', None),
         'unsupported':
         'NotSupported' in attribute.extended_attributes,
     }
     forwarded_attribute_name = attribute.extended_attributes.get(
         'PutForwards')
     if forwarded_attribute_name:
         assert attribute.idl_type.is_interface_type, (
             'PutForwards must be declared on a property of interface type.'
         )
         assert attribute.is_read_only, (
             'PutForwards must be on a readonly attribute.')
         forwarded_interface = definitions.interfaces[get_interface_name(
             attribute.idl_type)]
         matching_attributes = [
             a for a in forwarded_interface.attributes
             if a.name == forwarded_attribute_name
         ]
         assert len(matching_attributes) == 1
         context['put_forwards'] = self.attribute_context(
             forwarded_interface, matching_attributes[0], definitions)
     context[
         'has_setter'] = not attribute.is_read_only or forwarded_attribute_name
     if is_constructor_attribute(attribute):
         context['is_constructor_attribute'] = True
         context['interface_name'] = get_interface_name(attribute.idl_type)
         # Blink's IDL parser uses the convention that attributes ending with
         # 'ConstructorConstructor' are for Named Constructors.
         context['is_named_constructor_attribute'] = (
             attribute.idl_type.name.endswith('ConstructorConstructor'))
     return context
示例#9
0
def interface_context(interface):
    context = v8_interface.interface_context(interface)

    includes.clear()

    includes.update(INTERFACE_CPP_INCLUDES)
    header_includes = set(INTERFACE_H_INCLUDES)

    parent_interface = interface.parent
    if parent_interface:
        header_includes.update(
            dart_types.includes_for_interface(parent_interface))
    extended_attributes = interface.extended_attributes

    is_document = inherits_interface(interface.name, 'Document')
    if is_document:
        # FIXME(vsm): We probably need bindings/dart/DartController and
        # core/frame/LocalFrame.h here.
        includes.update(['DartDocument.h'])

    if inherits_interface(interface.name, 'DataTransferItemList'):
        # FIXME(jacobr): this is a hack.
        includes.update(['core/html/HTMLCollection.h'])

    if inherits_interface(interface.name, 'EventTarget'):
        includes.update(['bindings/core/dart/DartEventListener.h'])

    # [SetWrapperReferenceTo]
    set_wrapper_reference_to_list = [
        {
            'name': argument.name,
            # FIXME: properly should be:
            # 'cpp_type': argument.idl_type.cpp_type_args(used_as_rvalue_type=True),
            # (if type is non-wrapper type like NodeFilter, normally RefPtr)
            # Raw pointers faster though, and NodeFilter hacky anyway.
            'cpp_type': argument.idl_type.implemented_as + '*',
            'idl_type': argument.idl_type,
            'v8_type': dart_types.v8_type(argument.idl_type.name),
        } for argument in extended_attributes.get('SetWrapperReferenceTo', [])
    ]
    for set_wrapper_reference_to in set_wrapper_reference_to_list:
        set_wrapper_reference_to['idl_type'].add_includes_for_type()

    context.update({
        'conditional_string':
        DartUtilities.conditional_string(interface),  # [Conditional]
        'cpp_class':
        DartUtilities.cpp_name(interface),
        'header_includes':
        header_includes,
        'is_garbage_collected':
        context['gc_type'] == 'GarbageCollectedObject',
        'is_will_be_garbage_collected':
        context['gc_type'] == 'WillBeGarbageCollectedObject',
        'measure_as':
        DartUtilities.measure_as(interface),  # [MeasureAs]
        'pass_cpp_type':
        dart_types.cpp_template_type(
            dart_types.cpp_ptr_type('PassRefPtr', 'RawPtr',
                                    context['gc_type']),
            DartUtilities.cpp_name(interface)),
        'runtime_enabled_function':
        DartUtilities.runtime_enabled_function_name(
            interface),  # [RuntimeEnabled]
        'set_wrapper_reference_to_list':
        set_wrapper_reference_to_list,
        'dart_class':
        dart_types.dart_type(interface.name),
        'v8_class':
        DartUtilities.v8_class_name(interface),
    })

    # Constructors
    constructors = [
        constructor_context(interface, constructor)
        for constructor in interface.constructors
        # FIXME: shouldn't put named constructors with constructors
        # (currently needed for Perl compatibility)
        # Handle named constructors separately
        if constructor.name == 'Constructor'
    ]
    if len(constructors) > 1:
        context.update(
            {'constructor_overloads': overloads_context(constructors)})

    # [CustomConstructor]
    custom_constructors = [
        custom_constructor_context(interface, constructor)
        for constructor in interface.custom_constructors
    ]

    # [NamedConstructor]
    named_constructor = generate_named_constructor(interface)

    generate_method_native_entries(interface, constructors, 'Constructor')
    generate_method_native_entries(interface, custom_constructors,
                                   'Constructor')
    if named_constructor:
        generate_method_native_entries(interface, [named_constructor],
                                       'Constructor')
    event_constructor = None
    if context['has_event_constructor']:
        event_constructor = {
            'native_entries': [
                DartUtilities.generate_native_entry(interface.name, None,
                                                    'Constructor', False, 2)
            ],
        }

    if (context['constructors'] or custom_constructors
            or context['has_event_constructor'] or named_constructor):
        includes.add('core/frame/LocalDOMWindow.h')

    context.update({
        'constructors':
        constructors,
        'custom_constructors':
        custom_constructors,
        'event_constructor':
        event_constructor,
        'has_custom_constructor':
        bool(custom_constructors),
        'interface_length':
        v8_interface.interface_length(interface,
                                      constructors + custom_constructors),
        'is_constructor_call_with_document':
        DartUtilities.has_extended_attribute_value(
            interface, 'ConstructorCallWith',
            'Document'),  # [ConstructorCallWith=Document]
        'is_constructor_call_with_execution_context':
        DartUtilities.has_extended_attribute_value(
            interface, 'ConstructorCallWith',
            'ExecutionContext'),  # [ConstructorCallWith=ExeuctionContext]
        'named_constructor':
        named_constructor,
    })

    # Attributes
    attributes = [
        dart_attributes.attribute_context(interface, attribute)
        for attribute in interface.attributes
        # Skip attributes in the IGNORE_MEMBERS list or if an
        # extended attribute is in the IGNORE_EXTENDED_ATTRIBUTES.
        if
        (not _suppress_attribute(interface.name, attribute.name)
         and not v8_attributes.is_constructor_attribute(attribute)
         and not _suppress_extended_attributes(attribute.extended_attributes)
         and not ('DartSuppress' in attribute.extended_attributes and
                  attribute.extended_attributes.get('DartSuppress') == None))
    ]
    context.update({
        'attributes':
        attributes,
        'has_accessors':
        any(attribute['is_expose_js_accessors'] for attribute in attributes),
        'has_attribute_configuration':
        any(not (attribute['is_expose_js_accessors'] or attribute['is_static']
                 or attribute['runtime_enabled_function']
                 or attribute['per_context_enabled_function'])
            for attribute in attributes),
        'has_constructor_attributes':
        any(attribute['constructor_type'] for attribute in attributes),
        'has_per_context_enabled_attributes':
        any(attribute['per_context_enabled_function']
            for attribute in attributes),
        'has_replaceable_attributes':
        any(attribute['is_replaceable'] for attribute in attributes),
    })

    # Methods
    methods = [
        dart_methods.method_context(interface, method)
        for method in interface.operations
        # Skip anonymous special operations (methods name empty).
        # Skip methods in our IGNORE_MEMBERS list.
        # Skip methods w/ extended attributes in IGNORE_EXTENDED_ATTRIBUTES list.
        if
        (method.name and
         # detect unnamed getters from v8_interface.
         method.name != 'anonymousNamedGetter' and
         # TODO(terry): Eventual eliminate the IGNORE_MEMBERS in favor of DartSupress.
         not _suppress_method(interface.name, method.name)
         and not _suppress_extended_attributes(method.extended_attributes)
         and not 'DartSuppress' in method.extended_attributes)
    ]
    compute_method_overloads_context(methods)
    for method in methods:
        method['do_generate_method_configuration'] = (
            method['do_not_check_signature']
            and not method['per_context_enabled_function'] and
            # For overloaded methods, only generate one accessor
            ('overload_index' not in method or method['overload_index'] == 1))

    generate_method_native_entries(interface, methods, 'Method')

    context.update({
        'has_origin_safe_method_setter':
        any(method['is_check_security_for_frame']
            and not method['is_read_only'] for method in methods),
        'has_method_configuration':
        any(method['do_generate_method_configuration'] for method in methods),
        'has_per_context_enabled_methods':
        any(method['per_context_enabled_function'] for method in methods),
        'methods':
        methods,
    })

    context.update({
        'indexed_property_getter':
        indexed_property_getter(interface),
        'indexed_property_setter':
        indexed_property_setter(interface),
        'indexed_property_deleter':
        v8_interface.indexed_property_deleter(interface),
        'is_override_builtins':
        'OverrideBuiltins' in extended_attributes,
        'named_property_getter':
        named_property_getter(interface),
        'named_property_setter':
        named_property_setter(interface),
        'named_property_deleter':
        v8_interface.named_property_deleter(interface),
    })

    generate_native_entries_for_specials(interface, context)

    native_entries = generate_interface_native_entries(context)

    context.update({
        'native_entries': native_entries,
    })

    return context