| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Dartium 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 // This file has been auto-generated by {{code_generator_dart}}. DO NOT MODIFY! |
| 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 #include "sky/engine/tonic/dart_api_scope.h" |
| 15 #include "sky/engine/tonic/dart_converter.h" |
| 16 #include "sky/engine/tonic/dart_isolate_scope.h" |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 {% for method in methods if not method.custom %} |
| 21 {{method.cpp_type}} {{dart_class}}::{{method.name}}({{method.argument_declaratio
ns | join(', ')}}) |
| 22 { |
| 23 {% set return_default = 'return true' |
| 24 if method.idl_type == 'boolean' else 'return' %}{# void #} |
| 25 if (!callback_.IsIsolateAlive()) |
| 26 {{return_default}}; |
| 27 DartIsolateScope scope(callback_.GetIsolate()); |
| 28 DartApiScope apiScope; |
| 29 {% if method.call_with_this_handle %} |
| 30 // FIXME: we ignore thisValue which may or may not be correct for Dart. |
| 31 {% endif %} |
| 32 {% for argument in method.arguments %} |
| 33 Dart_Handle {{argument.handle}} = {{argument.cpp_value_to_dart_value}}; |
| 34 if (Dart_IsError({{argument.handle}})) |
| 35 {{return_default}}; |
| 36 {% endfor %} |
| 37 {% if method.arguments %} |
| 38 Dart_Handle arguments[] = { {{method.arguments | join(', ', attribute='handl
e')}} }; |
| 39 {% else %} |
| 40 Dart_Handle *arguments = 0; |
| 41 {% endif %} |
| 42 |
| 43 {% set return_with = 'return' |
| 44 if method.idl_type == 'boolean' else '' %}{# void #} |
| 45 {{return_with}} callback_.handleEvent({{method.arguments | length}}, argumen
ts); |
| 46 } |
| 47 |
| 48 {% endfor %} |
| 49 } // namespace blink |
| OLD | NEW |