| Index: sky/engine/bindings2/scripts/templates/interface_base_cpp.template
|
| diff --git a/sky/engine/bindings2/scripts/templates/interface_base_cpp.template b/sky/engine/bindings2/scripts/templates/interface_base_cpp.template
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b1d7f11fe53da96b7552b14026b13a6174f19bd0
|
| --- /dev/null
|
| +++ b/sky/engine/bindings2/scripts/templates/interface_base_cpp.template
|
| @@ -0,0 +1,145 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// WARNING: Do not edit - generated code.
|
| +
|
| +#include "sky/engine/config.h"
|
| +#include "{{dart_class}}.h"
|
| +
|
| +{% for filename in cpp_includes %}
|
| +#include "{{filename}}"
|
| +{% endfor %}
|
| +
|
| +namespace blink {
|
| +
|
| +static void RefObject(DartWrappable* impl) {
|
| + static_cast<{{cpp_class}}*>(impl)->ref();
|
| +}
|
| +
|
| +static void DerefObject(DartWrappable* impl) {
|
| + static_cast<{{cpp_class}}*>(impl)->deref();
|
| +}
|
| +
|
| +static const DartWrapperInfo kDartWrapperInfo = {
|
| + "{{interface_name}}",
|
| + sizeof({{cpp_class}}),
|
| + &RefObject,
|
| + &DerefObject,
|
| +};
|
| +
|
| +const DartWrapperInfo& {{cpp_class}}::dart_wrapper_info_ = kDartWrapperInfo;
|
| +
|
| +namespace {{dart_class}}Internal {
|
| +
|
| +{% from 'methods_cpp.template' import generate_constructor, generate_event_constructor, generate_method, method_callback, overload_resolution_method with context %}
|
| +
|
| +{# Constructors #}
|
| +{% for constructor in constructors %}
|
| +{{generate_constructor(constructor, constructor.number_of_arguments)}}
|
| +{% endfor %}
|
| +{% block overloaded_constructor %}{% endblock %}
|
| +{% if named_constructor %}
|
| +{{generate_constructor(named_constructor, named_constructor.number_of_arguments)}}
|
| +{% endif %}
|
| +{% if has_event_constructor %}
|
| +{{generate_event_constructor()}}
|
| +{% endif %}
|
| +
|
| +{# Attributes getters/setters. #}
|
| +{% from 'attributes_cpp.template' import attribute_getter, attribute_getter_callback,
|
| + attribute_setter, attribute_setter_callback
|
| + with context %}
|
| +{% for attribute in attributes %}
|
| +{% if not attribute.has_custom_getter %}
|
| +{{attribute_getter(cpp_class, attribute)}}
|
| +{% endif %}
|
| +{# FIXME I'm disabling put_forwards for now since we didn't support it before #}
|
| +{# https://code.google.com/p/dart/issues/detail?id=18784 #}
|
| +{# {% if not attribute.has_custom_setter and (not attribute.is_read_only or attribute.put_forwards) %}#}
|
| +{% if not attribute.has_custom_setter and not attribute.is_read_only %}
|
| +{{attribute_setter(cpp_class, attribute)}}
|
| +{% endif %}
|
| +{% endfor %}
|
| +
|
| +{# Methods #}
|
| +{% for method in methods %}
|
| + {% if not method.is_custom and not method.suppressed %}
|
| +{{generate_method(method, method.number_of_arguments)}}
|
| + {% endif %}
|
| + {% if method.overloads %}
|
| +{{overload_resolution_method(method)}}
|
| + {% endif %}
|
| +{% endfor %}
|
| +
|
| +{# Special operations (methods) #}
|
| + {% block indexed_property_getter %}{% endblock %}
|
| +}
|
| +
|
| +Dart_NativeFunction {{dart_class}}::Resolver(Dart_Handle nameHandle, int argumentCount, bool* autoSetupScope)
|
| +{
|
| + String name = StringFromDart(nameHandle);
|
| + {% from 'methods_cpp.template' import generate_resolver_constructor with context %}
|
| + {% from 'methods_cpp.template' import generate_resolver_event_constructor with context %}
|
| + {# Resolver Constructors #}
|
| + {% for constructor in constructors %}
|
| +{{generate_resolver_constructor(dart_class, interface_name, constructor) | indent(4)}}
|
| + {% endfor %}
|
| + {% from 'methods_cpp.template' import generate_resolver_custom_constructor with context %}
|
| + {# Resolver Custom Constructors #}
|
| + {% for constructor in custom_constructors %}
|
| +{{generate_resolver_constructor(dart_class, interface_name, constructor) | indent(4)}}
|
| + {% endfor %}
|
| + {% if named_constructor %}
|
| +{{generate_resolver_constructor(dart_class, interface_name, named_constructor) | indent(4)}}
|
| + {% endif %}
|
| + {% if has_event_constructor %}
|
| +{{generate_resolver_event_constructor(dart_class, interface_name) | indent(4)}}
|
| + {% endif %}
|
| + {# Resolver Attributes #}
|
| + {% from 'attributes_cpp.template' import generate_attribute_resolver_body %}
|
| + {% for attribute in attributes %}
|
| +{{generate_attribute_resolver_body(dart_class, interface_name, attribute) | indent(4)}}
|
| + {% endfor %}
|
| + {# Resolver Methods #}
|
| + {% from 'methods_cpp.template' import generate_resolver_body with context %}
|
| + {% for method in methods if not method.suppressed %}
|
| +{{generate_resolver_body(dart_class, interface_name, method) | indent(4)}}
|
| + {% endfor %}
|
| + {# Special operations (methods) #}
|
| + {# TODO(terry): Only emit indexed getter for DataTransferItemList; emit for interfaces. #}
|
| + {% block indexed_property_getter_resolver %}{% endblock %}
|
| + {% if dart_class == 'DartCSSStyleDeclaration' %}
|
| + {% block named_property_getter_resolver %}{% endblock %}
|
| + {% endif %}
|
| + return 0;
|
| +}
|
| +
|
| +const uint8_t* {{dart_class}}::Symbolizer(Dart_NativeFunction native_function)
|
| +{
|
| + {% from 'methods_cpp.template' import generate_symbolizer_constructor with context %}
|
| + {% for constructor in constructors %}
|
| +{{generate_symbolizer_constructor(dart_class, interface_name, constructor) | indent(4)}}
|
| + {% endfor %}
|
| + {% for constructor in custom_constructors %}
|
| +{{generate_symbolizer_constructor(dart_class, interface_name, constructor) | indent(4)}}
|
| + {% endfor %}
|
| + {% if named_constructor %}
|
| +{{generate_symbolizer_constructor(dart_class, interface_name, named_constructor) | indent(4)}}
|
| + {% endif %}
|
| + {% from 'attributes_cpp.template' import generate_attribute_symbolizer_body %}
|
| + {% for attribute in attributes %}
|
| +{{generate_attribute_symbolizer_body(dart_class, interface_name, attribute) | indent(4)}}
|
| + {% endfor %}
|
| + {% from 'methods_cpp.template' import generate_symbolizer_body with context %}
|
| + {% for method in methods if not method.suppressed %}
|
| +{{generate_symbolizer_body(dart_class, interface_name, method) | indent(4)}}
|
| + {% endfor %}
|
| + {% if dart_class == 'DartCSSStyleDeclaration' %}
|
| +{% block generate_symbolizer_named_property_getter %}{% endblock %}
|
| + {% endif %}
|
| +{% block generate_symbolizer_indexed_property_getter %}{% endblock %}
|
| + return 0;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|