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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_dictionary.py

Issue 2494973002: bindings: Stop using Nullable<T> in dictionary impl (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
index 4bdb8fd2a51f1bf1f0c95617fa749c0b59bcb804..db321bbd98ed3d53122377341972c97e89cc5a76 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_dictionary.py
@@ -188,13 +188,14 @@ def member_impl_context(member, interfaces_info, header_includes):
idl_type = unwrap_nullable_if_needed(member.idl_type)
cpp_name = v8_utilities.cpp_name(member)
- def getter_expression():
- if idl_type.impl_should_use_nullable_container:
- return 'm_%s.get()' % cpp_name
- return 'm_%s' % cpp_name
+ has_flag_variable = None
peria 2016/11/11 07:45:15 This variable name is confusing. It is a |has_fla
+ if not idl_type.cpp_type_has_null_value:
+ has_flag_variable = 'm_has' + cpp_name[0].upper() + cpp_name[1:]
def has_method_expression():
- if idl_type.impl_should_use_nullable_container or idl_type.is_enum or idl_type.is_string_type or idl_type.is_union_type:
+ if has_flag_variable:
+ return has_flag_variable
+ elif idl_type.is_enum or idl_type.is_string_type or idl_type.is_union_type:
return '!m_%s.isNull()' % cpp_name
elif idl_type.name in ['Any', 'Object']:
return '!(m_{0}.isEmpty() || m_{0}.isNull() || m_{0}.isUndefined())'.format(cpp_name)
@@ -203,12 +204,6 @@ def member_impl_context(member, interfaces_info, header_includes):
else:
return 'm_%s' % cpp_name
- def member_cpp_type():
- member_cpp_type = idl_type.cpp_type_args(used_in_cpp_sequence=True)
- if idl_type.impl_should_use_nullable_container:
- return v8_types.cpp_template_type('Nullable', member_cpp_type)
- return member_cpp_type
-
cpp_default_value = None
if member.default_value and not member.default_value.is_null:
cpp_default_value = idl_type.literal_cpp_value(member.default_value)
@@ -217,13 +212,14 @@ def member_impl_context(member, interfaces_info, header_includes):
return {
'cpp_default_value': cpp_default_value,
'cpp_name': cpp_name,
- 'getter_expression': getter_expression(),
+ 'getter_expression': 'm_' + cpp_name,
'has_method_expression': has_method_expression(),
'has_method_name': has_method_name_for_dictionary_member(member),
'is_nullable': idl_type.is_nullable,
'is_traceable': idl_type.is_traceable,
- 'member_cpp_type': member_cpp_type(),
+ 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True),
'null_setter_name': null_setter_name_for_dictionary_member(member),
'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
'setter_name': setter_name_for_dictionary_member(member),
+ 'has_flag_variable': has_flag_variable,
bashi 2016/11/11 07:05:37 Will re-order this.
Yuki 2016/11/11 07:34:39 What about |nullable_indicator_name|?
bashi 2016/11/11 07:52:57 Done.
}

Powered by Google App Engine
This is Rietveld 408576698