Chromium Code Reviews| Index: sdk/lib/html/scripts/generator.py |
| diff --git a/sdk/lib/html/scripts/generator.py b/sdk/lib/html/scripts/generator.py |
| index 89913d2000dd4528423e9e93add3d19c0f90c7e1..4dc60995c8e2830f8d4effd3626565fd61cb68e0 100644 |
| --- a/sdk/lib/html/scripts/generator.py |
| +++ b/sdk/lib/html/scripts/generator.py |
| @@ -541,6 +541,86 @@ def FindConversion(idl_type, direction, interface, member): |
| # ------------------------------------------------------------------------------ |
| +# Annotations to be placed on members. The table is indexed by the IDL |
| +# interface and member name, and by IDL return or field type name. Both are |
| +# used to assemble the annotations: |
| +# |
| +# INTERFACE.MEMBER: annotations for member. |
| +# +TYPE: add annotations only if there are member annotations. |
| +# TYPE: add regardless of member annotations. |
| + |
| +dart2js_annotations = { |
| + |
| + # Rather than have the result of an IDBRequest as a union over all possible |
| + # results, we mark the result as git instantiating any classes, and mark |
|
blois
2012/11/19 20:46:48
git?
sra1
2012/11/19 23:15:07
Done.
|
| + # each operation with the classes that it could cause to be asynchronously |
| + # instantiated. |
| + 'IDBRequest.result': "@Creates('Null')", |
| + |
| + # The source is usually a participant in the operation that generated the |
| + # IDBRequest. |
| + 'IDBRequest.source': "@Creates('Null')", |
| + |
| + 'IDBFactory.open': "@Creates('IDBDatabase')", |
| + |
| + 'IDBObjectStore.put': "@annotation_Creates_IDBKey", |
| + 'IDBObjectStore.add': "@annotation_Creates_IDBKey", |
| + 'IDBObjectStore.get': "@annotation_Creates_SerializedScriptValue", |
| + 'IDBObjectStore.openCursor': "@Creates('IDBCursor')", |
| + |
| + 'IDBIndex.get': "@annotation_Creates_SerializedScriptValue", |
| + 'IDBIndex.getKey': |
| + "@annotation_Creates_SerializedScriptValue " |
| + # The source is the object store behind the index. |
| + "@Creates('IDBObjectStore')", |
| + 'IDBIndex.openCursor': "@Creates('IDBCursor')", |
| + 'IDBIndex.openKeyCursor': "@Creates('IDBCursor')", |
| + |
| + 'IDBCursorWithValue.value': |
| + '@annotation_Creates_SerializedScriptValue ' |
| + '@annotation_Returns_SerializedScriptValue', |
| + |
| + 'IDBCursor.key': "@annotation_Creates_IDBKey @annotation_Returns_IDBKey", |
| + |
| + '+IDBRequest': "@Returns('IDBRequest') @Creates('IDBRequest')", |
| + |
| + '+IDBOpenDBRequest': "@Returns('IDBRequest') @Creates('IDBRequest')", |
| + '+IDBVersionChangeRequest': "@Returns('IDBRequest') @Creates('IDBRequest')", |
| + |
| + |
| + 'FileReader.result': "@Creates('String|ArrayBuffer|Null')", |
| + |
| + 'CanvasRenderingContext2D.createImageData': |
| + "@Creates('ImageData|=Object')", |
| + |
| + 'CanvasRenderingContext2D.getImageData': |
| + "@Creates('ImageData|=Object')", |
| + |
| + 'CanvasRenderingContext2D.webkitGetImageDataHD': |
| + "@Creates('ImageData|=Object')", |
| + |
| + 'XMLHttpRequest.response': |
| + "@Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')", |
| + |
| + 'SQLResultSetRowList.item': "@Creates('=Object')", |
| +} |
| + |
| +def FindAnnotations(idl_type, interface_name, member_name): |
| + ann1 = dart2js_annotations.get("%s.%s" % (interface_name, member_name)) |
| + if ann1: |
| + ann2 = dart2js_annotations.get('+' + idl_type) |
| + if ann2: |
| + return ann2 + ' ' + ann1 |
| + ann2 = dart2js_annotations.get(idl_type) |
| + if ann2: |
| + return ann2 + ' ' + ann1 |
| + return ann1 |
| + |
| + ann2 = dart2js_annotations.get(idl_type) |
| + return ann2 |
| + |
| +# ------------------------------------------------------------------------------ |
| + |
| class IDLTypeInfo(object): |
| def __init__(self, idl_type, data): |
| self._idl_type = idl_type |