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

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

Issue 345883004: IDL: Use V8StringResource<WithNullCheck> for nullable DOMString (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 raw_type: 130 raw_type:
131 bool, True if idl_type's raw/primitive C++ type should be returned. 131 bool, True if idl_type's raw/primitive C++ type should be returned.
132 used_as_argument: 132 used_as_argument:
133 bool, True if the C++ type is used as an argument of a method. 133 bool, True if the C++ type is used as an argument of a method.
134 used_as_variadic_argument: 134 used_as_variadic_argument:
135 bool, True if the C++ type is used as a variadic argument of a metho d. 135 bool, True if the C++ type is used as a variadic argument of a metho d.
136 used_in_cpp_sequence: 136 used_in_cpp_sequence:
137 bool, True if the C++ type is used as an element of an array or sequ ence. 137 bool, True if the C++ type is used as an element of an array or sequ ence.
138 """ 138 """
139 def string_mode(): 139 def string_mode():
140 if idl_type.is_nullable:
141 return 'WithNullCheck'
140 # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString', 142 # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString',
141 # but we use NullString for performance. 143 # but we use NullString for performance.
142 if extended_attributes.get('TreatNullAs') != 'NullString': 144 if extended_attributes.get('TreatNullAs') != 'NullString':
143 return '' 145 return ''
144 if extended_attributes.get('TreatUndefinedAs') != 'NullString': 146 if extended_attributes.get('TreatUndefinedAs') != 'NullString':
145 return 'WithNullCheck' 147 return 'WithNullCheck'
146 return 'WithUndefinedOrNullCheck' 148 return 'WithUndefinedOrNullCheck'
147 149
148 extended_attributes = extended_attributes or {} 150 extended_attributes = extended_attributes or {}
149 idl_type = idl_type.preprocessed_type 151 idl_type = idl_type.preprocessed_type
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 700
699 def literal_cpp_value(idl_type, idl_literal): 701 def literal_cpp_value(idl_type, idl_literal):
700 """Converts an expression that is a valid C++ literal for this type.""" 702 """Converts an expression that is a valid C++ literal for this type."""
701 # FIXME: add validation that idl_type and idl_literal are compatible 703 # FIXME: add validation that idl_type and idl_literal are compatible
702 literal_value = str(idl_literal) 704 literal_value = str(idl_literal)
703 if idl_type.base_type in CPP_UNSIGNED_TYPES: 705 if idl_type.base_type in CPP_UNSIGNED_TYPES:
704 return literal_value + 'u' 706 return literal_value + 'u'
705 return literal_value 707 return literal_value
706 708
707 IdlType.literal_cpp_value = literal_cpp_value 709 IdlType.literal_cpp_value = literal_cpp_value
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698