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

Unified Diff: tools/dom/scripts/systemnative.py

Issue 1330163010: Revert "Dartium w/ JsInterop enabled" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/src/CssRectangle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemnative.py
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index 38a9ec025fb4bde64e5dc563a12034ee68f998d3..99e511a1f1d6052b50475248076f0fb26596f0f6 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -394,8 +394,8 @@ class DartiumBackend(HtmlDartGenerator):
def CustomJSMembers(self):
return {}
- def _InputConversion(self, idl_type, member):
- return FindConversion(idl_type, 'set', self._interface.id, member)
+ def _InputConversion(self, type_name, info):
+ return None
def GenerateCallback(self, info):
if IsPureInterface(self._interface.id) or IsCustomType(self._interface.id):
@@ -645,7 +645,7 @@ class DartiumBackend(HtmlDartGenerator):
self._members_emitter.Emit(
'\n @DocsEditable()\n'
' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) => '
- 'wrap_jso($TOPLEVEL_NAME($OUTPARAMETERS));\n',
+ '$TOPLEVEL_NAME($OUTPARAMETERS);\n',
INTERFACE_NAME=self._interface_type_info.interface_name(),
FACTORY_METHOD_NAME=factory_method_name,
PARAMETERS=typed_formals,
@@ -914,7 +914,7 @@ class DartiumBackend(HtmlDartGenerator):
if self._interface.id == 'ImageData' and html_name == 'data':
html_name = '_data'
type_info = self._TypeInfo(attr.type.id)
- return_type = self.SecureOutputType(attr.type.id, False, False if self._dart_use_blink else True)
+ return_type = self.SecureOutputType(attr.type.id, False, read_only)
parameters = []
dart_declaration = '%s get %s' % (return_type, html_name)
is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or
@@ -932,7 +932,8 @@ class DartiumBackend(HtmlDartGenerator):
# - type is Object
#
# JsObject maybe stored in the Dart class.
- return_wrap_jso = wrap_return_type_blink(return_type, attr.type.id, self._type_registry)
+ return_wrap_jso = (isinstance(type_info, InterfaceIDLTypeInfo) or
+ not(type_info) or attr.type.id == 'Object')
wrap_unwrap_list.append(return_wrap_jso) # wrap_jso the returned object
wrap_unwrap_list.append(self._dart_use_blink) # this must be unwrap_jso
@@ -995,7 +996,7 @@ class DartiumBackend(HtmlDartGenerator):
not(attr.type.id) or ptype == 'Object')
else 'value']
- dart_declaration = 'set %s(%s value)' % (html_name, ptype)
+ dart_declaration = 'void set %s(%s value)' % (html_name, ptype)
is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or
_IsCustomValue(attr, 'Setter'))
# This seems to have been replaced with Custom=Setter (see above), but
@@ -1085,8 +1086,7 @@ class DartiumBackend(HtmlDartGenerator):
# Does nativeIndexGetter return a DartClass (JsObject) if so wrap_jso.
wrap_jso_start = ''
wrap_jso_end = ''
- if (isinstance(type_info, InterfaceIDLTypeInfo) or
- wrap_type_blink(type_info.narrow_dart_type(), self._type_registry)):
+ if isinstance(type_info, InterfaceIDLTypeInfo):
wrap_jso_start = 'wrap_jso('
wrap_jso_end = ')'
blinkNativeIndexed = """
@@ -1097,7 +1097,7 @@ class DartiumBackend(HtmlDartGenerator):
}
$TYPE _nativeIndexedGetter(int index) => %s$(DART_NATIVE_NAME)(unwrap_jso(this), index)%s;
-""" % (wrap_jso_start, wrap_jso_end, wrap_jso_start, wrap_jso_end)
+ """ % (wrap_jso_start, wrap_jso_end, wrap_jso_start, wrap_jso_end)
# Wrap the type to store the JsObject if Type is:
#
# - known IDL type
@@ -1189,13 +1189,11 @@ class DartiumBackend(HtmlDartGenerator):
Arguments:
info: An OperationInfo object.
"""
- return_type = self.SecureOutputType(info.type_name, False, False if dart_js_interop else True)
+ return_type = self.SecureOutputType(info.type_name, False, True)
formals = info.ParametersAsDeclaration(self._DartType)
- parameters = info.ParametersAsListOfVariables(None,
- self._type_registry if self._dart_use_blink else None,
- dart_js_interop)
+ parameters = info.ParametersAsListOfVariables(None, self._type_registry if self._dart_use_blink else None, dart_js_interop)
dart_declaration = '%s%s %s(%s)' % (
'static ' if info.IsStatic() else '',
return_type,
@@ -1221,15 +1219,11 @@ class DartiumBackend(HtmlDartGenerator):
# - type is Object
#
# JsObject maybe stored in the Dart class.
- return_wrap_jso = wrap_return_type_blink(return_type, info.type_name, self._type_registry)
- return_type_info = self._type_registry.TypeInfo(info.type_name)
- if (isinstance(return_type_info, SequenceIDLTypeInfo) and
- not isinstance(return_type_info._item_info, PrimitiveIDLTypeInfo)):
- return_wrap_jso = True
- # wrap_jso the returned object
- wrap_unwrap_list.append(return_wrap_jso)
- # The 'this' parameter must be unwrap_jso
- wrap_unwrap_list.append(self._dart_use_blink)
+ return_wrap_jso = (info.wrap_unwrap_type_blink(return_type, self._type_registry) or
+ return_type == 'Rectangle' or
+ info.wrap_unwrap_list_blink(return_type, self._type_registry))
+ wrap_unwrap_list.append(return_wrap_jso) # wrap_jso the returned object
+ wrap_unwrap_list.append(self._dart_use_blink) # The 'this' parameter must be unwrap_jso
if info.callback_args:
self._AddFutureifiedOperation(info, html_name)
@@ -1265,7 +1259,7 @@ class DartiumBackend(HtmlDartGenerator):
return_wrap_jso = False
if self._dart_use_blink:
- return_wrap_jso = wrap_return_type_blink(return_type, info.type_name, self._type_registry)
+ return_wrap_jso = self._type_registry.HasInterface(return_type)
native_suffix = 'Callback'
is_custom = _IsCustom(operation)
@@ -1748,19 +1742,19 @@ class DartiumBackend(HtmlDartGenerator):
'''
if return_type == 'Rectangle':
jso_util_method = 'make_dart_rectangle'
- elif wrap_unwrap_list[0]:
+ # TODO(terry): More checks that the return is a List<Node>.
+ elif return_type.startswith('List<'):
+ jso_util_method = 'wrap_jso_list'
+ else:
jso_util_method = 'wrap_jso'
-
# Always return List<String> unwrapped.
if return_type != 'List<String>':
emit_template = emit_jso_template % jso_util_method
-
- if caller_emitter:
- caller_emitter.Emit(emit_template,
- METADATA=metadata,
- DART_DECLARATION=dart_declaration,
- DART_NAME=full_dart_name,
- ACTUALS=actuals)
+ caller_emitter.Emit(emit_template,
+ METADATA=metadata,
+ DART_DECLARATION=dart_declaration,
+ DART_NAME=full_dart_name,
+ ACTUALS=actuals)
cpp_callback_name = '%s%s' % (idl_name, native_suffix)
self._cpp_resolver_emitter.Emit(
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/src/CssRectangle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698