| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 CPP_UNSIGNED_TYPES = set([ | 104 CPP_UNSIGNED_TYPES = set([ |
| 105 'octet', | 105 'octet', |
| 106 'unsigned int', | 106 'unsigned int', |
| 107 'unsigned long', | 107 'unsigned long', |
| 108 'unsigned short', | 108 'unsigned short', |
| 109 ]) | 109 ]) |
| 110 CPP_SPECIAL_CONVERSION_RULES = { | 110 CPP_SPECIAL_CONVERSION_RULES = { |
| 111 'Date': 'double', | 111 'Date': 'double', |
| 112 'Dictionary': 'Dictionary', | 112 'Dictionary': 'Dictionary', |
| 113 'EventHandler': 'EventListener*', | 113 'EventHandler': 'EventListener*', |
| 114 'EventListener': 'EventListener*', |
| 114 'NodeFilter': 'NodeFilter*', | 115 'NodeFilter': 'NodeFilter*', |
| 115 'Promise': 'ScriptPromise', | 116 'Promise': 'ScriptPromise', |
| 116 'ScriptValue': 'ScriptValue', | 117 'ScriptValue': 'ScriptValue', |
| 117 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 | 118 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 |
| 118 'XPathNSResolver': 'XPathNSResolver*', | 119 'XPathNSResolver': 'XPathNSResolver*', |
| 119 'boolean': 'bool', | 120 'boolean': 'bool', |
| 120 'unrestricted double': 'double', | 121 'unrestricted double': 'double', |
| 121 'unrestricted float': 'float', | 122 'unrestricted float': 'float', |
| 122 } | 123 } |
| 123 | 124 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: | 174 if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE: |
| 174 return base_idl_type | 175 return base_idl_type |
| 175 if base_idl_type in CPP_INT_TYPES: | 176 if base_idl_type in CPP_INT_TYPES: |
| 176 return 'int' | 177 return 'int' |
| 177 if base_idl_type in CPP_UNSIGNED_TYPES: | 178 if base_idl_type in CPP_UNSIGNED_TYPES: |
| 178 return 'unsigned' | 179 return 'unsigned' |
| 179 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: | 180 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: |
| 180 return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] | 181 return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] |
| 181 | 182 |
| 182 if base_idl_type in NON_WRAPPER_TYPES: | 183 if base_idl_type == 'SerializedScriptValue': |
| 183 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type | 184 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type |
| 184 if idl_type.is_string_type: | 185 if idl_type.is_string_type: |
| 185 if not raw_type: | 186 if not raw_type: |
| 186 return 'String' | 187 return 'String' |
| 187 return 'V8StringResource<%s>' % string_mode() | 188 return 'V8StringResource<%s>' % string_mode() |
| 188 | 189 |
| 189 if idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in
extended_attributes: | 190 if idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in
extended_attributes: |
| 190 return 'FlexibleArrayBufferView' | 191 return 'FlexibleArrayBufferView' |
| 191 if idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in
extended_attributes: | 192 if idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in
extended_attributes: |
| 192 return 'Flexible' + idl_type.base_type + 'View' | 193 return 'Flexible' + idl_type.base_type + 'View' |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 number_of_nullable_member_types_union) | 983 number_of_nullable_member_types_union) |
| 983 | 984 |
| 984 | 985 |
| 985 def includes_nullable_type_union(idl_type): | 986 def includes_nullable_type_union(idl_type): |
| 986 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 987 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 987 return idl_type.number_of_nullable_member_types == 1 | 988 return idl_type.number_of_nullable_member_types == 1 |
| 988 | 989 |
| 989 IdlTypeBase.includes_nullable_type = False | 990 IdlTypeBase.includes_nullable_type = False |
| 990 IdlNullableType.includes_nullable_type = True | 991 IdlNullableType.includes_nullable_type = True |
| 991 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 992 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |