Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2103)

Unified Diff: sky/engine/bindings-dart/dart/scripts/templates/callback_interface_cpp.template

Issue 875013003: Import Dart bindings as of Blink r188698. This merely copies the files over and does not attach any… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/bindings-dart/dart/scripts/templates/callback_interface_cpp.template
diff --git a/sky/engine/bindings-dart/dart/scripts/templates/callback_interface_cpp.template b/sky/engine/bindings-dart/dart/scripts/templates/callback_interface_cpp.template
new file mode 100644
index 0000000000000000000000000000000000000000..38de363a66db33eb95e23f91feecac71cd87fafe
--- /dev/null
+++ b/sky/engine/bindings-dart/dart/scripts/templates/callback_interface_cpp.template
@@ -0,0 +1,50 @@
+// 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 %}

Powered by Google App Engine
This is Rietveld 408576698