blob: 38de363a66db33eb95e23f91feecac71cd87fafe [file] [log] [blame]
// Copyright 2014 The Dartium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by {{code_generator_dart}}. DO NOT MODIFY!
#include "config.h"
{% filter conditional(conditional_string) %}
#include "{{dart_class}}.h"
{% for filename in cpp_includes %}
#include "{{filename}}"
{% endfor %}
namespace blink {
{% for method in methods if not method.custom %}
{{method.cpp_type}} {{dart_class}}::{{method.name}}({{method.argument_declarations | join(', ')}})
{
{% set return_default = 'return true'
if method.idl_type == 'boolean' else 'return' %}{# void #}
if (!m_callback.isIsolateAlive())
{{return_default}};
DartIsolateScope scope(m_callback.isolate());
DartApiScope apiScope;
{% if method.call_with_this_handle %}
// FIXME: we ignore thisValue which may or may not be correct for Dart.
{% endif %}
{% for argument in method.arguments %}
Dart_Handle {{argument.handle}} = {{argument.cpp_value_to_dart_value}};
if (Dart_IsError({{argument.handle}})) {
if (!isScriptControllerTerminating())
CRASH();
{{return_default}};
}
{% endfor %}
{% if method.arguments %}
Dart_Handle arguments[] = { {{method.arguments | join(', ', attribute='handle')}} };
{% else %}
Dart_Handle *arguments = 0;
{% endif %}
{% set return_with = 'return'
if method.idl_type == 'boolean' else '' %}{# void #}
{{return_with}} m_callback.handleEvent({{method.arguments | length}}, arguments);
}
{% endfor %}
} // namespace blink
{% endfilter %}