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

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

Issue 10155027: Support custom to native conversions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/dom/scripts/systemnative.py » ('j') | lib/dom/scripts/systemnative.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/generator.py
diff --git a/lib/dom/scripts/generator.py b/lib/dom/scripts/generator.py
index 66ea4a6480adc42b4d2b9cd34f7ead20f137832b..275bae51e362ecbd00f5ea98b33133f2651dacdf 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -427,13 +427,13 @@ def TypeName(type_ids, interface):
class IDLTypeInfo(object):
def __init__(self, idl_type, dart_type=None,
native_type=None, ref_counted=True,
- has_dart_wrapper=True,
+ custom_to_native=False,
custom_to_dart=False, conversion_includes=[]):
self._idl_type = idl_type
self._dart_type = dart_type
self._native_type = native_type
self._ref_counted = ref_counted
- self._has_dart_wrapper = has_dart_wrapper
+ self._custom_to_native = custom_to_native
self._custom_to_dart = custom_to_dart
self._conversion_includes = conversion_includes + [idl_type]
@@ -450,11 +450,12 @@ class IDLTypeInfo(object):
native_type = self.native_type()
if self._ref_counted:
native_type = 'RefPtr< %s >' % native_type
- if self._has_dart_wrapper:
- wrapper_type = 'Dart%s' % self.idl_type()
- adapter_type = 'ParameterAdapter<%s, %s>' % (native_type, wrapper_type)
- return (adapter_type, '"%s.h"' % wrapper_type)
- return ('ParameterAdapter< %s >' % native_type, '"%s.h"' % self._idl_type)
+ wrapper_type = 'Dart%s' % self.idl_type()
+ adapter_type = 'ParameterAdapter<%s, %s>' % (native_type, wrapper_type)
+ return (adapter_type, '"%s.h"' % wrapper_type)
+
+ def custom_to_native(self):
+ return self._custom_to_native
def parameter_type(self):
return '%s*' % self.native_type()
@@ -642,13 +643,13 @@ _idl_type_registry = {
'DOMStringMap': IDLTypeInfo('DOMStringMap', dart_type='Map<String, String>'),
'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True),
'Element': IDLTypeInfo('Element', custom_to_dart=True),
- 'EventListener': IDLTypeInfo('EventListener', has_dart_wrapper=False),
- 'EventTarget': IDLTypeInfo('EventTarget', has_dart_wrapper=False),
+ 'EventListener': IDLTypeInfo('EventListener', custom_to_native=True),
+ 'EventTarget': IDLTypeInfo('EventTarget', custom_to_native=True),
'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True),
- 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', has_dart_wrapper=False),
- 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', has_dart_wrapper=False),
- 'MediaQueryListListener': IDLTypeInfo('MediaQueryListListener', has_dart_wrapper=False),
- 'OptionsObject': IDLTypeInfo('OptionsObject', has_dart_wrapper=False),
+ 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', custom_to_native=True),
+ 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', custom_to_native=True),
+ 'MediaQueryListListener': IDLTypeInfo('MediaQueryListListener', custom_to_native=True),
+ 'OptionsObject': IDLTypeInfo('OptionsObject', custom_to_native=True),
'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet']),
'SVGElement': IDLTypeInfo('SVGElement', custom_to_dart=True),
« no previous file with comments | « no previous file | lib/dom/scripts/systemnative.py » ('j') | lib/dom/scripts/systemnative.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698