| 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 28 matching lines...) Expand all Loading... |
| 39 'byte', | 39 'byte', |
| 40 'long', | 40 'long', |
| 41 'short', | 41 'short', |
| 42 ]) | 42 ]) |
| 43 CPP_UNSIGNED_TYPES = set([ | 43 CPP_UNSIGNED_TYPES = set([ |
| 44 'octet', | 44 'octet', |
| 45 'unsigned int', | 45 'unsigned int', |
| 46 'unsigned long', | 46 'unsigned long', |
| 47 'unsigned short', | 47 'unsigned short', |
| 48 ]) | 48 ]) |
| 49 # Promise is not yet in the Web IDL spec but is going to be speced |
| 50 # as primitive types in the future. |
| 51 # Since V8 dosn't provide Promise primitive object currently, |
| 52 # PRIMITIVE_TYPES doesn't contain Promise. |
| 49 CPP_TYPE_SPECIAL_CONVERSION_RULES = { | 53 CPP_TYPE_SPECIAL_CONVERSION_RULES = { |
| 50 'boolean': 'bool', | 54 'boolean': 'bool', |
| 51 'DOMString': 'const String&', | 55 'DOMString': 'const String&', |
| 56 'Promise': 'ScriptPromise', |
| 52 } | 57 } |
| 53 PRIMITIVE_TYPES = set([ | 58 PRIMITIVE_TYPES = set([ |
| 54 # http://www.w3.org/TR/WebIDL/#dfn-primitive-type | 59 # http://www.w3.org/TR/WebIDL/#dfn-primitive-type |
| 55 'boolean', | 60 'boolean', |
| 56 'float', | 61 'float', |
| 57 # unrestricted float is not supported | 62 # unrestricted float is not supported |
| 58 'double', | 63 'double', |
| 59 # unrestricted double is not supported | 64 # unrestricted double is not supported |
| 60 # integer types | 65 # integer types |
| 61 # http://www.w3.org/TR/WebIDL/#dfn-integer-type | 66 # http://www.w3.org/TR/WebIDL/#dfn-integer-type |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if this_cpp_type in V8_SET_RETURN_VALUE_DICT: | 162 if this_cpp_type in V8_SET_RETURN_VALUE_DICT: |
| 158 expression_format_string = V8_SET_RETURN_VALUE_DICT[this_cpp_type] | 163 expression_format_string = V8_SET_RETURN_VALUE_DICT[this_cpp_type] |
| 159 else: | 164 else: |
| 160 raise Exception('unexpected IDL type %s' % idl_type) | 165 raise Exception('unexpected IDL type %s' % idl_type) |
| 161 return expression_format_string.format(callback_info=callback_info, cpp_valu
e=cpp_value) | 166 return expression_format_string.format(callback_info=callback_info, cpp_valu
e=cpp_value) |
| 162 | 167 |
| 163 | 168 |
| 164 def includes_for_type(idl_type): | 169 def includes_for_type(idl_type): |
| 165 if primitive_type(idl_type) or idl_type == 'DOMString': | 170 if primitive_type(idl_type) or idl_type == 'DOMString': |
| 166 return set() | 171 return set() |
| 172 if idl_type == 'Promise': |
| 173 return set(['ScriptPromise.h']) |
| 167 this_array_or_sequence_type = array_or_sequence_type(idl_type) | 174 this_array_or_sequence_type = array_or_sequence_type(idl_type) |
| 168 if this_array_or_sequence_type: | 175 if this_array_or_sequence_type: |
| 169 return includes_for_type(this_array_or_sequence_type) | 176 return includes_for_type(this_array_or_sequence_type) |
| 170 return set(['V8%s.h' % idl_type]) | 177 return set(['V8%s.h' % idl_type]) |
| OLD | NEW |