| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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 // WARNING: Do not edit - generated code. |
| 6 |
| 7 #include "sky/engine/config.h" |
| 8 #include "{{dart_class}}.h" |
| 9 |
| 10 {% for filename in cpp_includes %} |
| 11 #include "{{filename}}" |
| 12 {% endfor %} |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 static void RefObject(DartWrappable* impl) { |
| 17 static_cast<{{cpp_class}}*>(impl)->ref(); |
| 18 } |
| 19 |
| 20 static void DerefObject(DartWrappable* impl) { |
| 21 static_cast<{{cpp_class}}*>(impl)->deref(); |
| 22 } |
| 23 |
| 24 static const DartWrapperInfo kDartWrapperInfo = { |
| 25 "{{interface_name}}", |
| 26 sizeof({{cpp_class}}), |
| 27 &RefObject, |
| 28 &DerefObject, |
| 29 }; |
| 30 |
| 31 const DartWrapperInfo& {{cpp_class}}::dart_wrapper_info_ = kDartWrapperInfo; |
| 32 |
| 33 namespace {{dart_class}}Internal { |
| 34 |
| 35 {% from 'methods_cpp.template' import generate_constructor, generate_event_const
ructor, generate_method, method_callback, overload_resolution_method with contex
t %} |
| 36 |
| 37 {# Constructors #} |
| 38 {% for constructor in constructors %} |
| 39 {{generate_constructor(constructor, constructor.number_of_arguments)}} |
| 40 {% endfor %} |
| 41 {% block overloaded_constructor %}{% endblock %} |
| 42 {% if named_constructor %} |
| 43 {{generate_constructor(named_constructor, named_constructor.number_of_arguments)
}} |
| 44 {% endif %} |
| 45 {% if has_event_constructor %} |
| 46 {{generate_event_constructor()}} |
| 47 {% endif %} |
| 48 |
| 49 {# Attributes getters/setters. #} |
| 50 {% from 'attributes_cpp.template' import attribute_getter, attribute_getter_call
back, |
| 51 attribute_setter, attribute_setter_callback |
| 52 with context %} |
| 53 {% for attribute in attributes %} |
| 54 {% if not attribute.has_custom_getter %} |
| 55 {{attribute_getter(cpp_class, attribute)}} |
| 56 {% endif %} |
| 57 {# FIXME I'm disabling put_forwards for now since we didn't support it before #} |
| 58 {# https://code.google.com/p/dart/issues/detail?id=18784 #} |
| 59 {# {% if not attribute.has_custom_setter and (not attribute.is_read_only or attr
ibute.put_forwards) %}#} |
| 60 {% if not attribute.has_custom_setter and not attribute.is_read_only %} |
| 61 {{attribute_setter(cpp_class, attribute)}} |
| 62 {% endif %} |
| 63 {% endfor %} |
| 64 |
| 65 {# Methods #} |
| 66 {% for method in methods %} |
| 67 {% if not method.is_custom and not method.suppressed %} |
| 68 {{generate_method(method, method.number_of_arguments)}} |
| 69 {% endif %} |
| 70 {% if method.overloads %} |
| 71 {{overload_resolution_method(method)}} |
| 72 {% endif %} |
| 73 {% endfor %} |
| 74 |
| 75 {# Special operations (methods) #} |
| 76 {% block indexed_property_getter %}{% endblock %} |
| 77 } |
| 78 |
| 79 Dart_NativeFunction {{dart_class}}::Resolver(Dart_Handle nameHandle, int argumen
tCount, bool* autoSetupScope) |
| 80 { |
| 81 String name = StringFromDart(nameHandle); |
| 82 {% from 'methods_cpp.template' import generate_resolver_constructor with con
text %} |
| 83 {% from 'methods_cpp.template' import generate_resolver_event_constructor wi
th context %} |
| 84 {# Resolver Constructors #} |
| 85 {% for constructor in constructors %} |
| 86 {{generate_resolver_constructor(dart_class, interface_name, constructor) | inden
t(4)}} |
| 87 {% endfor %} |
| 88 {% from 'methods_cpp.template' import generate_resolver_custom_constructor w
ith context %} |
| 89 {# Resolver Custom Constructors #} |
| 90 {% for constructor in custom_constructors %} |
| 91 {{generate_resolver_constructor(dart_class, interface_name, constructor) | inden
t(4)}} |
| 92 {% endfor %} |
| 93 {% if named_constructor %} |
| 94 {{generate_resolver_constructor(dart_class, interface_name, named_constructor) |
indent(4)}} |
| 95 {% endif %} |
| 96 {% if has_event_constructor %} |
| 97 {{generate_resolver_event_constructor(dart_class, interface_name) | indent(4)}} |
| 98 {% endif %} |
| 99 {# Resolver Attributes #} |
| 100 {% from 'attributes_cpp.template' import generate_attribute_resolver_body %} |
| 101 {% for attribute in attributes %} |
| 102 {{generate_attribute_resolver_body(dart_class, interface_name, attribute) | inde
nt(4)}} |
| 103 {% endfor %} |
| 104 {# Resolver Methods #} |
| 105 {% from 'methods_cpp.template' import generate_resolver_body with context %} |
| 106 {% for method in methods if not method.suppressed %} |
| 107 {{generate_resolver_body(dart_class, interface_name, method) | indent(4)}} |
| 108 {% endfor %} |
| 109 {# Special operations (methods) #} |
| 110 {# TODO(terry): Only emit indexed getter for DataTransferItemList; emit for
interfaces. #} |
| 111 {% block indexed_property_getter_resolver %}{% endblock %} |
| 112 {% if dart_class == 'DartCSSStyleDeclaration' %} |
| 113 {% block named_property_getter_resolver %}{% endblock %} |
| 114 {% endif %} |
| 115 return 0; |
| 116 } |
| 117 |
| 118 const uint8_t* {{dart_class}}::Symbolizer(Dart_NativeFunction native_function) |
| 119 { |
| 120 {% from 'methods_cpp.template' import generate_symbolizer_constructor with c
ontext %} |
| 121 {% for constructor in constructors %} |
| 122 {{generate_symbolizer_constructor(dart_class, interface_name, constructor) | ind
ent(4)}} |
| 123 {% endfor %} |
| 124 {% for constructor in custom_constructors %} |
| 125 {{generate_symbolizer_constructor(dart_class, interface_name, constructor) | ind
ent(4)}} |
| 126 {% endfor %} |
| 127 {% if named_constructor %} |
| 128 {{generate_symbolizer_constructor(dart_class, interface_name, named_constructor)
| indent(4)}} |
| 129 {% endif %} |
| 130 {% from 'attributes_cpp.template' import generate_attribute_symbolizer_body
%} |
| 131 {% for attribute in attributes %} |
| 132 {{generate_attribute_symbolizer_body(dart_class, interface_name, attribute) | in
dent(4)}} |
| 133 {% endfor %} |
| 134 {% from 'methods_cpp.template' import generate_symbolizer_body with context
%} |
| 135 {% for method in methods if not method.suppressed %} |
| 136 {{generate_symbolizer_body(dart_class, interface_name, method) | indent(4)}} |
| 137 {% endfor %} |
| 138 {% if dart_class == 'DartCSSStyleDeclaration' %} |
| 139 {% block generate_symbolizer_named_property_getter %}{% endblock %} |
| 140 {% endif %} |
| 141 {% block generate_symbolizer_indexed_property_getter %}{% endblock %} |
| 142 return 0; |
| 143 } |
| 144 |
| 145 } // namespace blink |
| OLD | NEW |