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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 'Date': 'double', | 240 'Date': 'double', |
241 'Dictionary': 'Dictionary', | 241 'Dictionary': 'Dictionary', |
242 'EventHandler': 'EventListener*', | 242 'EventHandler': 'EventListener*', |
243 'Promise': 'ScriptPromise', | 243 'Promise': 'ScriptPromise', |
244 'ScriptValue': 'ScriptValue', | 244 'ScriptValue': 'ScriptValue', |
245 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 | 245 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 |
246 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 246 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', |
247 'boolean': 'bool', | 247 'boolean': 'bool', |
248 } | 248 } |
249 | 249 |
| 250 |
250 def cpp_type(idl_type, extended_attributes=None, used_as_argument=False): | 251 def cpp_type(idl_type, extended_attributes=None, used_as_argument=False): |
251 """Returns C++ type corresponding to IDL type.""" | 252 """Returns C++ type corresponding to IDL type.""" |
252 def string_mode(): | 253 def string_mode(): |
253 # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString', | 254 # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString', |
254 # but we use NullString for performance. | 255 # but we use NullString for performance. |
255 if extended_attributes.get('TreatNullAs') != 'NullString': | 256 if extended_attributes.get('TreatNullAs') != 'NullString': |
256 return '' | 257 return '' |
257 if extended_attributes.get('TreatUndefinedAs') != 'NullString': | 258 if extended_attributes.get('TreatUndefinedAs') != 'NullString': |
258 return 'WithNullCheck' | 259 return 'WithNullCheck' |
259 return 'WithUndefinedOrNullCheck' | 260 return 'WithUndefinedOrNullCheck' |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 'bindings/v8/V8EventListenerList.h']), | 360 'bindings/v8/V8EventListenerList.h']), |
360 'EventListener': set(['bindings/v8/BindingSecurity.h', | 361 'EventListener': set(['bindings/v8/BindingSecurity.h', |
361 'bindings/v8/V8EventListenerList.h', | 362 'bindings/v8/V8EventListenerList.h', |
362 'core/frame/DOMWindow.h']), | 363 'core/frame/DOMWindow.h']), |
363 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), | 364 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), |
364 'Promise': set(['bindings/v8/ScriptPromise.h']), | 365 'Promise': set(['bindings/v8/ScriptPromise.h']), |
365 'SerializedScriptValue': set(['bindings/v8/SerializedScriptValue.h']), | 366 'SerializedScriptValue': set(['bindings/v8/SerializedScriptValue.h']), |
366 'ScriptValue': set(['bindings/v8/ScriptValue.h']), | 367 'ScriptValue': set(['bindings/v8/ScriptValue.h']), |
367 } | 368 } |
368 | 369 |
| 370 |
369 def includes_for_type(idl_type): | 371 def includes_for_type(idl_type): |
370 idl_type = preprocess_idl_type(idl_type) | 372 idl_type = preprocess_idl_type(idl_type) |
371 if idl_type in INCLUDES_FOR_TYPE: | 373 if idl_type in INCLUDES_FOR_TYPE: |
372 return INCLUDES_FOR_TYPE[idl_type] | 374 return INCLUDES_FOR_TYPE[idl_type] |
373 if is_basic_type(idl_type): | 375 if is_basic_type(idl_type): |
374 return set() | 376 return set() |
375 if is_typed_array_type(idl_type): | 377 if is_typed_array_type(idl_type): |
376 return set(['bindings/v8/custom/V8%sCustom.h' % idl_type]) | 378 return set(['bindings/v8/custom/V8%sCustom.h' % idl_type]) |
377 this_array_or_sequence_type = array_or_sequence_type(idl_type) | 379 this_array_or_sequence_type = array_or_sequence_type(idl_type) |
378 if this_array_or_sequence_type: | 380 if this_array_or_sequence_type: |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 657 |
656 | 658 |
657 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='', extended_attributes=None): | 659 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='', extended_attributes=None): |
658 """Returns an expression that converts a C++ value to a V8 value.""" | 660 """Returns an expression that converts a C++ value to a V8 value.""" |
659 # the isolate parameter is needed for callback interfaces | 661 # the isolate parameter is needed for callback interfaces |
660 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) | 662 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) |
661 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes) | 663 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes) |
662 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] | 664 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] |
663 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) | 665 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) |
664 return statement | 666 return statement |
OLD | NEW |