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

Side by Side Diff: lib/dom/scripts/generator.py

Issue 10868067: dart2js dart:html conversions for serialized script values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/html/dart2js/html_dart2js.dart » ('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 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 re 10 import re
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 Conversion('_convertNativeToDart_Dictionary', 'Dynamic', 'Map'), 497 Conversion('_convertNativeToDart_Dictionary', 'Dynamic', 'Map'),
498 'set': 498 'set':
499 Conversion('_convertDartToNative_Dictionary', 'Map', 'Dynamic'), 499 Conversion('_convertDartToNative_Dictionary', 'Map', 'Dynamic'),
500 }, 500 },
501 501
502 'DOMString[]': { 502 'DOMString[]': {
503 'set': 503 'set':
504 Conversion( 504 Conversion(
505 '_convertDartToNative_StringArray', 'List<String>', 'List'), 505 '_convertDartToNative_StringArray', 'List<String>', 'List'),
506 }, 506 },
507
508 'SerializedScriptValue': {
509 'set IDBObjectStore.add':
510 Conversion('_convertDartToNative_SerializedScriptValue',
511 'Dynamic', 'Dynamic'),
512 'set IDBObjectStore.put':
513 Conversion('_convertDartToNative_SerializedScriptValue',
514 'Dynamic', 'Dynamic'),
515 'set IDBCursor.update':
516 Conversion('_convertDartToNative_SerializedScriptValue',
517 'Dynamic', 'Dynamic'),
518 },
519
520
521 # IDBAny is problematic. Some uses are just a union of other IDB types,
522 # which need no conversion.. Others include data values which require
523 # serialized script value processing.
524 'IDBAny': {
525 'get IDBCursorWithValue.value':
526 Conversion('_convertNativeToDart_IDBAny', 'Dynamic', 'Dynamic'),
527
528 # This is problematic. The result property of IDBRequest is used for
529 # all requests. Read requests like IDBDataStore.getObject need
530 # conversion, but other requests like opening a database return
531 # something that does not need conversion.
532 'get IDBRequest.result':
533 Conversion('_convertNativeToDart_IDBAny', 'Dynamic', 'Dynamic'),
534
535 # "source: On getting, returns the IDBObjectStore or IDBIndex that the
536 # cursor is iterating. ...". So we should not try to convert it.
537 'get IDBCursor.source': None,
538
539 # Should be either a DOMString, an Array of DOMStrings or null.
540 'get IDBObjectStore.keyPath': None
541 },
507 } 542 }
508 543
509 def FindConversion(idl_type, direction, interface, member): 544 def FindConversion(idl_type, direction, interface, member):
510 table = dart2js_conversions.get(idl_type) 545 table = dart2js_conversions.get(idl_type)
511 if table: 546 if table:
512 return (table.get('%s %s.%s' % (direction, interface, member)) or 547 return (table.get('%s %s.%s' % (direction, interface, member)) or
513 table.get('%s %s.*' % (direction, interface)) or 548 table.get('%s %s.*' % (direction, interface)) or
514 table.get(direction)) 549 table.get(direction))
515 return None 550 return None
516 551
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 if match: 875 if match:
841 if type_name == 'DOMString[]': 876 if type_name == 'DOMString[]':
842 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt ring')) 877 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt ring'))
843 item_info = self.TypeInfo(match.group(1) or match.group(2)) 878 item_info = self.TypeInfo(match.group(1) or match.group(2))
844 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) 879 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info)
845 if not type_name in _idl_type_registry: 880 if not type_name in _idl_type_registry:
846 return InterfaceIDLTypeInfo(type_name, TypeData('Interface')) 881 return InterfaceIDLTypeInfo(type_name, TypeData('Interface'))
847 type_data = _idl_type_registry.get(type_name) 882 type_data = _idl_type_registry.get(type_name)
848 class_name = '%sIDLTypeInfo' % type_data.clazz 883 class_name = '%sIDLTypeInfo' % type_data.clazz
849 return globals()[class_name](type_name, type_data) 884 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « no previous file | lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698