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

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 14619013: Explicitly implementing some DOM iterable APIs for performance (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/immutable_list_mixin.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 # and 421 # and
422 # 422 #
423 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; } 423 # class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
424 # 424 #
425 dart_element_type = self._DartType(element_type) 425 dart_element_type = self._DartType(element_type)
426 if self._HasNativeIndexGetter(): 426 if self._HasNativeIndexGetter():
427 self._EmitNativeIndexGetter(dart_element_type) 427 self._EmitNativeIndexGetter(dart_element_type)
428 else: 428 else:
429 self._members_emitter.Emit( 429 self._members_emitter.Emit(
430 '\n' 430 '\n'
431 ' $TYPE operator[](int index) native "$(INTERFACE)_item_Callback";\n' , 431 ' $TYPE operator[](int index) {\n'
432 ' if (index < 0 || index >= length)\n'
433 ' throw new RangeError.range(index, 0, length);\n'
434 ' return _nativeIndexedGetter(index);\n'
435 ' }\n'
436 ' $TYPE _nativeIndexedGetter(int index) native "$(INTERFACE)_item_Cal lback";\n',
432 TYPE=self.SecureOutputType(element_type), 437 TYPE=self.SecureOutputType(element_type),
433 INTERFACE=self._interface.id) 438 INTERFACE=self._interface.id)
434 439
435 if self._HasNativeIndexSetter(): 440 if self._HasNativeIndexSetter():
436 self._EmitNativeIndexSetter(dart_element_type) 441 self._EmitNativeIndexSetter(dart_element_type)
437 else: 442 else:
438 self._members_emitter.Emit( 443 self._members_emitter.Emit(
439 '\n' 444 '\n'
440 ' void operator[]=(int index, $TYPE value) {\n' 445 ' void operator[]=(int index, $TYPE value) {\n'
441 ' throw new UnsupportedError("Cannot assign element of immutable Li st.");\n' 446 ' throw new UnsupportedError("Cannot assign element of immutable Li st.");\n'
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 952 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
948 ' return func;\n', 953 ' return func;\n',
949 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 954 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
950 955
951 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 956 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
952 return ( 957 return (
953 interface.id.endswith('Event') and 958 interface.id.endswith('Event') and
954 operation.id.startswith('init') and 959 operation.id.startswith('init') and
955 argument.ext_attrs.get('Default') == 'Undefined' and 960 argument.ext_attrs.get('Default') == 'Undefined' and
956 argument.type.id == 'DOMString') 961 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/immutable_list_mixin.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698