Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 344693002: Add [TreatReturnedNullStringAs] support for ScalarValueString (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 add_includes_for_type(array_or_sequence_type) 543 add_includes_for_type(array_or_sequence_type)
544 return 'array' 544 return 'array'
545 545
546 # Simple types 546 # Simple types
547 base_idl_type = idl_type.base_type 547 base_idl_type = idl_type.base_type
548 # Basic types, without additional includes 548 # Basic types, without additional includes
549 if base_idl_type in CPP_INT_TYPES: 549 if base_idl_type in CPP_INT_TYPES:
550 return 'int' 550 return 'int'
551 if base_idl_type in CPP_UNSIGNED_TYPES: 551 if base_idl_type in CPP_UNSIGNED_TYPES:
552 return 'unsigned' 552 return 'unsigned'
553 if base_idl_type in ('DOMString', 'ByteString'): 553 if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
554 if 'TreatReturnedNullStringAs' not in extended_attributes: 554 if 'TreatReturnedNullStringAs' not in extended_attributes:
555 return base_idl_type 555 return base_idl_type
556 treat_returned_null_string_as = extended_attributes['TreatReturnedNullSt ringAs'] 556 treat_returned_null_string_as = extended_attributes['TreatReturnedNullSt ringAs']
557 if treat_returned_null_string_as == 'Null': 557 if treat_returned_null_string_as == 'Null':
558 return 'StringOrNull' 558 return 'StringOrNull'
559 if treat_returned_null_string_as == 'Undefined': 559 if treat_returned_null_string_as == 'Undefined':
560 return 'StringOrUndefined' 560 return 'StringOrUndefined'
561 raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returne d_null_string_as 561 raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returne d_null_string_as
562 if idl_type.is_basic_type or base_idl_type == 'ScriptValue': 562 if idl_type.is_basic_type or base_idl_type == 'ScriptValue':
563 return base_idl_type 563 return base_idl_type
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='info.Holder()', extended_attributes=None): 682 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea tion_context='info.Holder()', extended_attributes=None):
683 """Returns an expression that converts a C++ value to a V8 value.""" 683 """Returns an expression that converts a C++ value to a V8 value."""
684 # the isolate parameter is needed for callback interfaces 684 # the isolate parameter is needed for callback interfaces
685 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes) 685 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext ended_attributes)
686 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes) 686 this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
687 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] 687 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
688 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context) 688 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat ion_context=creation_context)
689 return statement 689 return statement
690 690
691 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value 691 IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/webidl-type-mapping-expected.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698