mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
// 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 "{{dart_class}}.h"
|
|
|
|
{% for filename in cpp_includes %}
|
|
#include "{{filename}}"
|
|
{% endfor %}
|
|
|
|
#include "sky/engine/tonic/dart_api_scope.h"
|
|
#include "sky/engine/tonic/dart_converter.h"
|
|
#include "sky/engine/tonic/dart_isolate_scope.h"
|
|
|
|
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 (!callback_.IsIsolateAlive())
|
|
{{return_default}};
|
|
DartIsolateScope scope(callback_.GetIsolate());
|
|
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}}))
|
|
{{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}} callback_.handleEvent({{method.arguments | length}}, arguments);
|
|
}
|
|
|
|
{% endfor %}
|
|
} // namespace blink
|