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

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

Issue 1832713002: Optimize dartium dart:html bindings so real world application performance is acceptable. Improves d… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: update cached patches Created 4 years, 9 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/htmldartgenerator.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemhtml.py
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index 672d97e7a1faaed2eda62a1fd0b2b10ea104d85f..efceff66ac78b2067fdbd8f14cbe5329cbd014fd 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -586,7 +586,7 @@ class HtmlDartInterfaceGenerator(object):
class_modifiers = ''
else:
# For Dartium w/ JsInterop these suppressed interfaces are needed to
- # instanciate the internal classes when wrap_jso is called for a JS object.
+ # instanciate the internal classes.
if (self._renamer.ShouldSuppressInterface(self._interface) and
not(isinstance(self._backend, Dart2JSBackend)) and
self._options.dart_js_interop):
@@ -600,21 +600,10 @@ class HtmlDartInterfaceGenerator(object):
class_name = self._interface_type_info.implementation_name()
- js_interop_equivalence_op = \
- ' bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical(this, other);\n' \
- + ' int get hashCode => unwrap_jso(this).hashCode;\n'
- # ClientRect overrides the equivalence operator.
- if interface_name == 'ClientRect' or interface_name == 'DomRectReadOnly':
- js_interop_equivalence_op = ''
-
js_interop_wrapper = '''
@Deprecated("Internal Use Only")
- static {0} internalCreate{0}() {{
- return new {0}._internalWrap();
- }}
-
- external factory {0}._internalWrap();
+ external static Type get instanceRuntimeType;
@Deprecated("Internal Use Only")
{0}.internal_() : super.internal_();
@@ -622,19 +611,13 @@ class HtmlDartInterfaceGenerator(object):
'''.format(class_name)
if base_class == 'NativeFieldWrapperClass2' or base_class == 'DartHtmlDomObject':
js_interop_wrapper = '''
- @Deprecated("Internal Use Only")
- static {0} internalCreate{0}() {{
- return new {0}._internalWrap();
- }}
- factory {0}._internalWrap() {{
- return new {0}.internal_();
- }}
+ @Deprecated("Internal Use Only")
+ external static Type get instanceRuntimeType;
@Deprecated("Internal Use Only")
{0}.internal_() {{ }}
-
-{1}'''.format(class_name, js_interop_equivalence_op)
+'''.format(class_name)
# Change to use the synthesized class so we can construct with a mixin
# classes prefixed with name of NativeFieldWrapperClass2 don't have a
# default constructor so classes with mixins can't be new'd.
@@ -1285,13 +1268,9 @@ class DartLibrary():
emitters = library_emitter.Emit(
self._template, AUXILIARY_DIR=massage_path(auxiliary_dir))
if isinstance(emitters, tuple):
- if self._dart_js_interop:
- imports_emitter, map_emitter, function_emitter = emitters
- else:
- imports_emitter, map_emitter = emitters
- function_emitter = None
+ imports_emitter, map_emitter = emitters
else:
- imports_emitter, map_emitter, function_emitter = emitters, None, None
+ imports_emitter, map_emitter = emitters, None
for path in sorted(self._paths):
relpath = os.path.relpath(path, library_file_dir)
@@ -1304,26 +1283,10 @@ class DartLibrary():
items.sort()
for (idl_name, dart_name) in items:
map_emitter.Emit(
- " '$IDL_NAME': () => $DART_NAME,\n",
+ " '$IDL_NAME': () => $DART_NAME.instanceRuntimeType,\n",
IDL_NAME=idl_name,
DART_NAME=dart_name)
- # Emit the $!TYPE_FUNCTION_MAP
- if function_emitter:
- items = self._typeMap.items()
- items.sort()
- for (idl_name, dart_name) in items:
- # DOMStringMap is in the abstract list but is used as a concrete class
- # in Dartium.
- if not IsPureInterface(idl_name):
- # Handle classes that are concrete (abstract can't be instantiated).
- function_emitter.Emit(
- " '$IDL_NAME': () => $DART_NAME.internalCreate$DART_NAME,\n",
- IDL_NAME=idl_name,
- DART_NAME=dart_name)
- if self._dart_path.endswith('html_dartium.dart'):
- function_emitter.Emit(" 'polymer-element': () => HtmlElement.internalCreateHtmlElement,\n")
-
# ------------------------------------------------------------------------------
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698