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

Unified Diff: lib/html/scripts/generator.py

Issue 10905265: Support sequence<T> as native bindings arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | lib/html/scripts/systemnative.py » ('j') | lib/html/scripts/systemnative.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/scripts/generator.py
diff --git a/lib/html/scripts/generator.py b/lib/html/scripts/generator.py
index 3d45e49a145717039cd916ac981d4054a75548c1..e501a0f7cf4a8ec5f31ed65f2c2ec60ba8854a2a 100644
--- a/lib/html/scripts/generator.py
+++ b/lib/html/scripts/generator.py
@@ -571,6 +571,8 @@ class IDLTypeInfo(object):
argument_expression_template = '%s'
return argument_expression_template, type, cls, 'toNative'
+ def pass_native_by_ref(self): return False
+
def custom_to_native(self):
return self._data.custom_to_native
@@ -633,6 +635,18 @@ class SequenceIDLTypeInfo(IDLTypeInfo):
def dart_type(self):
return 'List<%s>' % self._item_info.dart_type()
+ def to_native_info(self, idl_node, interface_name):
+ item_info = self._item_info
+ item_native_type = item_info.native_type()
+ # Ugly hack. Usually IDLs floats are treated as C++ doubles, however
+ # sequence<float> should map to Vector<float>
+ if item_native_type == 'double' and item_info.idl_type() == 'float':
+ item_native_type = 'float'
+
+ return '%s', 'Vector<%s>' % item_native_type, 'DartUtilities', 'toNativeVector<%s>' % item_native_type
+
+ def pass_native_by_ref(self): return True
+
def to_dart_conversion(self, value, interface_name=None, attributes=None):
return 'DartDOMWrapper::vectorToDart<Dart%s>(%s)' % (self._item_info.native_type(), value)
@@ -647,6 +661,8 @@ class DOMStringArrayTypeInfo(SequenceIDLTypeInfo):
def to_native_info(self, idl_node, interface_name):
return '%s', 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative'
+ def pass_native_by_ref(self): return False
+
class PrimitiveIDLTypeInfo(IDLTypeInfo):
def __init__(self, idl_type, data):
« no previous file with comments | « no previous file | lib/html/scripts/systemnative.py » ('j') | lib/html/scripts/systemnative.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698