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

Unified Diff: Source/bindings/scripts/v8_types.py

Issue 185413023: Oilpan: move Touch related objects to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added 2 binding tests + style Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index cae0e8926a7013adb0674d7e7833f28957ce5f8d..1889b2b4dc055ed02603a08bfb011e508948ef69 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -248,8 +248,15 @@ CPP_SPECIAL_CONVERSION_RULES = {
}
-def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
- """Returns C++ type corresponding to IDL type."""
+def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as_member=False):
+ """Returns C++ type corresponding to IDL type.
+
+ Args:
+ used_as_argument: bool, True if idl_type's raw/primitive C++ type
+ should be returned.
+ used_as_member: bool, if idl_type is the type of an array or sequence
+ (which maps to some vector representation in C++.)
haraken 2014/03/05 14:52:46 Instead of |used_as_member|, shall we use |will_be
sof 2014/03/05 16:01:12 I renamed it as will_be_in_heap_object; its the pr
+ """
def string_mode():
# FIXME: the Web IDL spec requires 'EmptyString', not 'NullString',
# but we use NullString for performance.
@@ -283,7 +290,9 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
for union_member_type in idl_type.union_member_types)
this_array_or_sequence_type = array_or_sequence_type(idl_type)
if this_array_or_sequence_type:
- return cpp_template_type('Vector', cpp_type(this_array_or_sequence_type))
+ will_be_garbage_collected = is_will_be_garbage_collected(this_array_or_sequence_type)
+ vector_type = 'WillBeHeapVector' if will_be_garbage_collected else 'Vector'
+ return cpp_template_type(vector_type, cpp_type(this_array_or_sequence_type, used_as_member=will_be_garbage_collected))
if is_typed_array_type(idl_type) and used_as_argument:
return idl_type + '*'
@@ -292,7 +301,8 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
if used_as_argument:
return implemented_as_class + '*'
if is_will_be_garbage_collected(idl_type):
- return cpp_template_type('RefPtrWillBeRawPtr', implemented_as_class)
+ ref_ptr_type = 'RefPtrWillBeMember' if used_as_member else 'RefPtrWillBeRawPtr'
+ return cpp_template_type(ref_ptr_type, implemented_as_class)
return cpp_template_type('RefPtr', implemented_as_class)
# Default, assume native type is a pointer with same type name as idl type
return idl_type + '*'
@@ -471,12 +481,14 @@ def v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_valu
if (is_interface_type(this_array_or_sequence_type) and
this_array_or_sequence_type != 'Dictionary'):
this_cpp_type = None
- expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))'
+ ref_ptr_type = 'Member' if is_will_be_garbage_collected(this_array_or_sequence_type) else 'Ref'
+ expression_format = '(to{ref_ptr_type}PtrNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))'
haraken 2014/03/05 14:52:46 "MemberPtr" sounds strange. Shall we call it toMem
sof 2014/03/05 16:01:12 Great catch; my typo (the underlying method is cal
add_includes_for_type(this_array_or_sequence_type)
else:
+ ref_ptr_type = None
this_cpp_type = cpp_type(this_array_or_sequence_type)
expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {index}, info.GetIsolate())'
- expression = expression_format.format(array_or_sequence_type=this_array_or_sequence_type, cpp_type=this_cpp_type, index=index, v8_value=v8_value)
+ expression = expression_format.format(array_or_sequence_type=this_array_or_sequence_type, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type, v8_value=v8_value)
return expression

Powered by Google App Engine
This is Rietveld 408576698