Home | History | Annotate | Download | only in templates
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
      6 
      7 #include "config.h"
      8 {% filter conditional(conditional_string) %}
      9 #include "{{v8_class}}.h"
     10 
     11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
     12 #include "{{filename}}"
     13 {% endfor %}
     14 
     15 namespace WebCore {
     16 
     17 static void initializeScriptWrappableForInterface({{cpp_class}}* object)
     18 {
     19     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
     20         ScriptWrappable::fromObject(object)->setTypeInfo(&{{v8_class}}::wrapperTypeInfo);
     21     else
     22         ASSERT_NOT_REACHED();
     23 }
     24 
     25 } // namespace WebCore
     26 
     27 {#
     28 In ScriptWrappable::init, the use of a local function declaration has an
     29 issue on Windows: the local declaration does not pick up the surrounding
     30 namespace. Therefore, we provide this function in the global namespace.
     31 More info on the MSVC bug here (Bug 664619):
     32 The namespace of local function declarations in C++ by Uray M. Jnos
     33 http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c
     34 #}
     35 void webCoreInitializeScriptWrappableForInterface(WebCore::{{cpp_class}}* object)
     36 {
     37     WebCore::initializeScriptWrappableForInterface(object);
     38 }
     39 
     40 namespace WebCore {
     41 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
     42                               if is_active_dom_object else '0' %}
     43 {% set to_event_target = '%s::toEventTarget' % v8_class
     44                          if is_event_target else '0' %}
     45 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
     46                            if has_visit_dom_wrapper else '0' %}
     47 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
     48                                   if parent_interface else '0' %}
     49 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
     50                                 'WrapperTypeObjectPrototype' %}
     51 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}::domTemplate, {{v8_class}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installPerContextEnabledMethods, {{parent_wrapper_type_info}}, {{wrapper_type_prototype}}, {{gc_type}} };
     52 
     53 namespace {{cpp_class}}V8Internal {
     54 
     55 template <typename T> void V8_USE(T) { }
     56 
     57 {# Attributes #}
     58 {% from 'attributes.cpp' import constructor_getter_callback,
     59        attribute_getter, attribute_getter_callback,
     60        attribute_setter, attribute_setter_callback
     61    with context %}
     62 {% for attribute in attributes if not attribute.constructor_type %}
     63 {% for world_suffix in attribute.world_suffixes %}
     64 {% if not attribute.has_custom_getter %}
     65 {{attribute_getter(attribute, world_suffix)}}
     66 {% endif %}
     67 {{attribute_getter_callback(attribute, world_suffix)}}
     68 {% if not attribute.is_read_only or attribute.put_forwards %}
     69 {% if not attribute.has_custom_setter %}
     70 {{attribute_setter(attribute, world_suffix)}}
     71 {% endif %}
     72 {{attribute_setter_callback(attribute, world_suffix)}}
     73 {% endif %}
     74 {% endfor %}
     75 {% endfor %}
     76 {% block constructor_getter %}{% endblock %}
     77 {% for attribute in attributes if attribute.needs_constructor_getter_callback %}
     78 {% for world_suffix in attribute.world_suffixes %}
     79 {{constructor_getter_callback(attribute, world_suffix)}}
     80 {% endfor %}
     81 {% endfor %}
     82 {% block replaceable_attribute_setter_and_callback %}{% endblock %}
     83 {% block security_check_functions %}{% endblock %}
     84 {# Methods #}
     85 {% from 'methods.cpp' import generate_method, overload_resolution_method,
     86        method_callback, origin_safe_method_getter, generate_constructor
     87        with context %}
     88 {% for method in methods %}
     89 {% for world_suffix in method.world_suffixes %}
     90 {% if not method.is_custom %}
     91 {{generate_method(method, world_suffix)}}
     92 {% endif %}
     93 {% if method.overloads %}
     94 {{overload_resolution_method(method.overloads, world_suffix)}}
     95 {% endif %}
     96 {% if not method.overload_index or method.overloads %}
     97 {# A single callback is generated for overloaded methods #}
     98 {{method_callback(method, world_suffix)}}
     99 {% endif %}
    100 {% if method.is_do_not_check_security %}
    101 {{origin_safe_method_getter(method, world_suffix)}}
    102 {% endif %}
    103 {% endfor %}
    104 {% endfor %}
    105 {% block origin_safe_method_setter %}{% endblock %}
    106 {# Constructors #}
    107 {% for constructor in constructors %}
    108 {{generate_constructor(constructor)}}
    109 {% endfor %}
    110 {% block overloaded_constructor %}{% endblock %}
    111 {% block event_constructor %}{% endblock %}
    112 {# Special operations (methods) #}
    113 {% block indexed_property_getter %}{% endblock %}
    114 {% block indexed_property_getter_callback %}{% endblock %}
    115 {% block indexed_property_setter %}{% endblock %}
    116 {% block indexed_property_setter_callback %}{% endblock %}
    117 {% block indexed_property_deleter %}{% endblock %}
    118 {% block indexed_property_deleter_callback %}{% endblock %}
    119 {% block named_property_getter %}{% endblock %}
    120 {% block named_property_getter_callback %}{% endblock %}
    121 {% block named_property_setter %}{% endblock %}
    122 {% block named_property_setter_callback %}{% endblock %}
    123 {% block named_property_query %}{% endblock %}
    124 {% block named_property_query_callback %}{% endblock %}
    125 {% block named_property_deleter %}{% endblock %}
    126 {% block named_property_deleter_callback %}{% endblock %}
    127 {% block named_property_enumerator %}{% endblock %}
    128 {% block named_property_enumerator_callback %}{% endblock %}
    129 } // namespace {{cpp_class}}V8Internal
    130 
    131 {% block visit_dom_wrapper %}{% endblock %}
    132 {% block shadow_attributes %}{% endblock %}
    133 {% block class_attributes %}{% endblock %}
    134 {% block class_accessors %}{% endblock %}
    135 {% block class_methods %}{% endblock %}
    136 {% block named_constructor %}{% endblock %}
    137 {% block initialize_event %}{% endblock %}
    138 {% block constructor_callback %}{% endblock %}
    139 {% block configure_shadow_object_template %}{% endblock %}
    140 {% block configure_class_template %}{% endblock %}
    141 {% block get_template %}{% endblock %}
    142 {% block has_instance %}{% endblock %}
    143 {% block to_native_with_type_check %}{% endblock %}
    144 {% block install_per_context_attributes %}{% endblock %}
    145 {% block install_per_context_methods %}{% endblock %}
    146 {% block to_active_dom_object %}{% endblock %}
    147 {% block to_event_target %}{% endblock %}
    148 {% block get_shadow_object_template %}{% endblock %}
    149 {% block wrap %}{% endblock %}
    150 {% block create_wrapper %}{% endblock %}
    151 {% block deref_object_and_to_v8_no_inline %}{% endblock %}
    152 } // namespace WebCore
    153 {% endfilter %}
    154