OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 """This module provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
8 | 8 |
9 import copy | 9 import copy |
10 import json | 10 import json |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 def bindings_class(self): | 659 def bindings_class(self): |
660 return 'Dart%s' % self.idl_type() | 660 return 'Dart%s' % self.idl_type() |
661 | 661 |
662 def vector_to_dart_template_parameter(self): | 662 def vector_to_dart_template_parameter(self): |
663 return self.native_type() | 663 return self.native_type() |
664 | 664 |
665 def to_native_info(self, idl_node, interface_name): | 665 def to_native_info(self, idl_node, interface_name): |
666 cls = self.bindings_class() | 666 cls = self.bindings_class() |
667 | 667 |
668 if 'Callback' in idl_node.ext_attrs: | 668 if 'Callback' in idl_node.ext_attrs: |
669 return '%s', 'RefPtr<%s>' % self.native_type(), cls, 'create' | 669 return '%s.release()', 'OwnPtr<%s>' % self.native_type(), cls, 'create' |
670 | 670 |
671 if self.custom_to_native(): | 671 if self.custom_to_native(): |
672 type = 'RefPtr<%s>' % self.native_type() | 672 type = 'RefPtr<%s>' % self.native_type() |
673 argument_expression_template = '%s.get()' | 673 argument_expression_template = '%s.get()' |
674 else: | 674 else: |
675 type = '%s*' % self.native_type() | 675 type = '%s*' % self.native_type() |
676 if isinstance(self, SVGTearOffIDLTypeInfo) and not interface_name.endswith
('List'): | 676 if isinstance(self, SVGTearOffIDLTypeInfo) and not interface_name.endswith
('List'): |
677 argument_expression_template = '%s->propertyReference()' | 677 argument_expression_template = '%s->propertyReference()' |
678 else: | 678 else: |
679 argument_expression_template = '%s' | 679 argument_expression_template = '%s' |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 if type_data.clazz == 'BasicTypedList': | 1269 if type_data.clazz == 'BasicTypedList': |
1270 if type_name == 'ArrayBuffer': | 1270 if type_name == 'ArrayBuffer': |
1271 dart_interface_name = 'ByteBuffer' | 1271 dart_interface_name = 'ByteBuffer' |
1272 else: | 1272 else: |
1273 dart_interface_name = self._renamer.RenameInterfaceId(type_name) | 1273 dart_interface_name = self._renamer.RenameInterfaceId(type_name) |
1274 return BasicTypedListIDLTypeInfo( | 1274 return BasicTypedListIDLTypeInfo( |
1275 type_name, type_data, dart_interface_name, self) | 1275 type_name, type_data, dart_interface_name, self) |
1276 | 1276 |
1277 class_name = '%sIDLTypeInfo' % type_data.clazz | 1277 class_name = '%sIDLTypeInfo' % type_data.clazz |
1278 return globals()[class_name](type_name, type_data) | 1278 return globals()[class_name](type_name, type_data) |
OLD | NEW |