1 {# http://www.chromium.org/blink/coding-style#TOC-License #} 2 /* 3 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * * Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following disclaimer 13 * in the documentation and/or other materials provided with the 14 * distribution. 15 * * Neither the name of Google Inc. nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 {# FIXME: Rename to Python when switch #} 33 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! 34 35 #include "config.h" 36 {% filter conditional(conditional_string) %} 37 #include "{{v8_class}}.h" 38 39 {% for filename in cpp_includes %} 40 #include "{{filename}}" 41 {% endfor %} 42 43 namespace WebCore { 44 45 static void initializeScriptWrappableForInterface({{cpp_class}}* object) 46 { 47 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 48 ScriptWrappable::setTypeInfoInObject(object, &{{v8_class}}::wrapperTypeInfo); 49 else 50 ASSERT_NOT_REACHED(); 51 } 52 53 } // namespace WebCore 54 55 // In ScriptWrappable::init, the use of a local function declaration has an issue on Windows: 56 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 57 // in the global namespace. 58 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c) 59 void webCoreInitializeScriptWrappableForInterface(WebCore::{{cpp_class}}* object) 60 { 61 WebCore::initializeScriptWrappableForInterface(object); 62 } 63 64 namespace WebCore { 65 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 66 if is_active_dom_object else '0' %} 67 {% set to_event_target = '%s::toEventTarget' % v8_class 68 if is_event_target else '0' %} 69 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 70 if has_visit_dom_wrapper else '0' %} 71 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 72 if parent_interface else '0' %} 73 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}}, WrapperTypeObjectPrototype }; 74 75 namespace {{cpp_class}}V8Internal { 76 77 template <typename T> void V8_USE(T) { } 78 79 {# Attributes #} 80 {% from 'attributes.cpp' import attribute_getter, attribute_getter_callback, 81 attribute_setter, attribute_setter_callback 82 with context %} 83 {% for attribute in attributes if not attribute.constructor_type %} 84 {% for world_suffix in attribute.world_suffixes %} 85 {% if not attribute.has_custom_getter %} 86 {{attribute_getter(attribute, world_suffix)}} 87 {% endif %} 88 {{attribute_getter_callback(attribute, world_suffix)}} 89 {% if not attribute.is_read_only %} 90 {% if not attribute.has_custom_setter %} 91 {{attribute_setter(attribute, world_suffix)}} 92 {% endif %} 93 {{attribute_setter_callback(attribute, world_suffix)}} 94 {% endif %} 95 {% endfor %} 96 {% endfor %} 97 {% block constructor_getter %}{% endblock %} 98 {% block replaceable_attribute_setter_and_callback %}{% endblock %} 99 {% block security_check_functions %}{% endblock %} 100 {# Methods #} 101 {% from 'methods.cpp' import generate_method, overload_resolution_method, 102 method_callback, origin_safe_method_getter, generate_constructor 103 with context %} 104 {% for method in methods %} 105 {% for world_suffix in method.world_suffixes %} 106 {% if not method.is_custom %} 107 {{generate_method(method, world_suffix)}} 108 {% endif %} 109 {% if method.overloads %} 110 {{overload_resolution_method(method.overloads, world_suffix)}} 111 {% endif %} 112 {% if not method.overload_index or method.overloads %} 113 {# A single callback is generated for overloaded methods #} 114 {{method_callback(method, world_suffix)}} 115 {% endif %} 116 {% if method.is_do_not_check_security %} 117 {{origin_safe_method_getter(method, world_suffix)}} 118 {% endif %} 119 {% endfor %} 120 {% endfor %} 121 {% block origin_safe_method_setter %}{% endblock %} 122 {# Constructors #} 123 {% for constructor in constructors %} 124 {{generate_constructor(constructor)}} 125 {% endfor %} 126 {% block overloaded_constructor %}{% endblock %} 127 {% block event_constructor %}{% endblock %} 128 } // namespace {{cpp_class}}V8Internal 129 130 {% block visit_dom_wrapper %}{% endblock %} 131 {% block class_attributes %}{% endblock %} 132 {% block class_accessors %}{% endblock %} 133 {% block class_methods %}{% endblock %} 134 {% block named_constructor %}{% endblock %} 135 {% block initialize_event %}{% endblock %} 136 {% block constructor_callback %}{% endblock %} 137 {% block configure_class_template %}{% endblock %} 138 {% block get_template %}{% endblock %} 139 {% block has_instance_and_has_instance_in_any_world %}{% endblock %} 140 {% block install_per_context_attributes %}{% endblock %} 141 {% block install_per_context_methods %}{% endblock %} 142 {% block to_active_dom_object %}{% endblock %} 143 {% block to_event_target %}{% endblock %} 144 {% block wrap %}{% endblock %} 145 {% block create_wrapper %}{% endblock %} 146 {% block deref_object_and_to_v8_no_inline %}{% endblock %} 147 } // namespace WebCore 148 {% endfilter %} 149