| OLD | NEW |
| 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 json | 10 import json |
| 11 import monitored | 11 import monitored |
| 12 import os | 12 import os |
| 13 import re | 13 import re |
| 14 from htmlrenamer import custom_html_constructors, html_interface_renames, \ | 14 from htmlrenamer import custom_html_constructors, html_interface_renames, \ |
| 15 typed_array_renames | 15 typed_array_renames |
| 16 | 16 |
| 17 _pure_interfaces = monitored.Set('generator._pure_interfaces', [ |
| 18 'AbstractWorker', |
| 19 'CanvasPathMethods', |
| 20 'ChildNode', |
| 21 'DocumentAnimation', |
| 22 'DocumentFontFaceSet', |
| 23 'DocumentFullscreen', |
| 24 'DocumentXPathEvaluator', |
| 25 'ElementAnimation', |
| 26 'ElementFullscreen', |
| 27 'EventListener', |
| 28 'GlobalEventHandlers', |
| 29 'ImageBitmapFactories', |
| 30 'MediaQueryListListener', |
| 31 'MouseEventHitRegion', |
| 32 'MutationCallback', |
| 33 'NavigatorCPU', |
| 34 'NavigatorEvents', |
| 35 'NavigatorID', |
| 36 'NavigatorLanguage', |
| 37 'NavigatorOnLine', |
| 38 'ParentNode', |
| 39 'SVGDocument', |
| 40 'SVGExternalResourcesRequired', |
| 41 'SVGFilterPrimitiveStandardAttributes', |
| 42 'SVGFitToViewBox', |
| 43 'SVGTests', |
| 44 'SVGURIReference', |
| 45 'SVGZoomAndPan', |
| 46 'TimeoutHandler', |
| 47 'URLUtils', |
| 48 'URLUtilsReadOnly', |
| 49 'WebGLRenderingContextBase', |
| 50 'WindowBase64', |
| 51 'WindowEventHandlers', |
| 52 'WindowImageBitmapFactories', |
| 53 'WindowPagePopup', |
| 54 'WindowTimers', |
| 55 ]) |
| 56 |
| 17 _safe_interfaces = monitored.Set('generator._safe_interfaces', [ | 57 _safe_interfaces = monitored.Set('generator._safe_interfaces', [ |
| 18 'double', | 58 'double', |
| 19 'Float32Array', | 59 'Float32Array', |
| 20 'Float64Array', | 60 'Float64Array', |
| 21 'Int8Array', | 61 'Int8Array', |
| 22 'Int16Array', | 62 'Int16Array', |
| 23 'Int32Array', | 63 'Int32Array', |
| 24 'Uint8Array', | 64 'Uint8Array', |
| 25 'Uint8ClampedArray', | 65 'Uint8ClampedArray', |
| 26 'Uint16Array', | 66 'Uint16Array', |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 'WebGLLoseContext', | 182 'WebGLLoseContext', |
| 143 'WorkerConsole', | 183 'WorkerConsole', |
| 144 'WorkerPerformance', | 184 'WorkerPerformance', |
| 145 'XPathNSResolver', | 185 'XPathNSResolver', |
| 146 ]) | 186 ]) |
| 147 | 187 |
| 148 # Classes we should just suppress? | 188 # Classes we should just suppress? |
| 149 # SpeechGrammarList and friends | 189 # SpeechGrammarList and friends |
| 150 | 190 |
| 151 def IsPureInterface(interface_name, database): | 191 def IsPureInterface(interface_name, database): |
| 192 if (interface_name in _pure_interfaces): |
| 193 return True |
| 152 if (interface_name in _safe_interfaces or | 194 if (interface_name in _safe_interfaces or |
| 153 interface_name in _safe_interfaces_legacy or | 195 interface_name in _safe_interfaces_legacy or |
| 154 database.HasInterface(interface_name)): | 196 database.HasInterface(interface_name)): |
| 155 return False | 197 return False |
| 156 | 198 |
| 157 interface = database.GetInterface(interface_name) | 199 interface = database.GetInterface(interface_name) |
| 158 | 200 |
| 159 if 'Constructor' in interface.ext_attrs: | 201 if 'Constructor' in interface.ext_attrs: |
| 160 return False | 202 return False |
| 161 | 203 |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 return_type == 'Rectangle') | 1664 return_type == 'Rectangle') |
| 1623 | 1665 |
| 1624 def wrap_return_type_blink(return_type, type_name, type_registry): | 1666 def wrap_return_type_blink(return_type, type_name, type_registry): |
| 1625 """Returns True if we should wrap the returned value. This checks | 1667 """Returns True if we should wrap the returned value. This checks |
| 1626 a number of different variations, calling the more basic functions | 1668 a number of different variations, calling the more basic functions |
| 1627 above.""" | 1669 above.""" |
| 1628 return (wrap_unwrap_type_blink(return_type, type_registry) or | 1670 return (wrap_unwrap_type_blink(return_type, type_registry) or |
| 1629 wrap_unwrap_type_blink(type_name, type_registry) or | 1671 wrap_unwrap_type_blink(type_name, type_registry) or |
| 1630 wrap_type_blink(return_type, type_registry) or | 1672 wrap_type_blink(return_type, type_registry) or |
| 1631 wrap_unwrap_list_blink(return_type, type_registry)) | 1673 wrap_unwrap_list_blink(return_type, type_registry)) |
| OLD | NEW |