Index: third_party/WebKit/Source/bindings/scripts/v8_types.py |
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_types.py b/third_party/WebKit/Source/bindings/scripts/v8_types.py |
index aa502e87ad0202ce48f0c31bda7efff47a501903..fd26b1855cd0249565bf254ba6c01ad606f55411 100644 |
--- a/third_party/WebKit/Source/bindings/scripts/v8_types.py |
+++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py |
@@ -69,6 +69,9 @@ TYPED_ARRAY_TYPES = frozenset([ |
'Uint16Array', |
'Uint32Array', |
]) |
+ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ |
+ 'ArrayBufferView' |
+])) |
ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ |
'ArrayBuffer', |
'ArrayBufferView', |
@@ -80,6 +83,9 @@ ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ |
IdlType.is_array_buffer_or_view = property( |
lambda self: self.base_type in ARRAY_BUFFER_AND_VIEW_TYPES) |
+IdlType.is_array_buffer_view_or_typed_array = property( |
+ lambda self: self.base_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES) |
+ |
IdlType.is_typed_array = property( |
lambda self: self.base_type in TYPED_ARRAY_TYPES) |
@@ -192,6 +198,9 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ |
return 'FlexibleArrayBufferView' |
if base_idl_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes: |
return 'Flexible' + base_idl_type + 'View' |
+ if base_idl_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: |
+ if not used_in_cpp_sequence: |
+ return cpp_template_type('MaybeShared', idl_type.implemented_as) |
if idl_type.is_interface_type: |
implemented_as_class = idl_type.implemented_as |
if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected) or not used_in_cpp_sequence: |
@@ -335,6 +344,7 @@ def includes_for_cpp_class(class_name, relative_dir_posix): |
INCLUDES_FOR_TYPE = { |
'object': set(), |
'ArrayBufferView': set(['bindings/core/v8/V8ArrayBufferView.h', |
+ 'core/dom/MaybeShared.h', |
'core/dom/FlexibleArrayBufferView.h']), |
'Dictionary': set(['bindings/core/v8/Dictionary.h']), |
'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', |
@@ -370,9 +380,11 @@ def includes_for_type(idl_type, extended_attributes=None): |
if base_idl_type in INCLUDES_FOR_TYPE: |
return INCLUDES_FOR_TYPE[base_idl_type] |
if base_idl_type in TYPED_ARRAY_TYPES: |
- return INCLUDES_FOR_TYPE['ArrayBufferView'].union( |
- set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], base_idl_type)]) |
- ) |
+ ta_includes = set() |
+ ta_includes.update(INCLUDES_FOR_TYPE['ArrayBufferView']) |
+ ta_includes.update(['core/dom/MaybeShared.h']) |
+ ta_includes.update(set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], base_idl_type)])) |
+ return ta_includes |
if idl_type.is_basic_type: |
return set() |
if base_idl_type.endswith('ConstructorConstructor'): |
@@ -443,8 +455,8 @@ def impl_includes_for_type(idl_type, interfaces_info): |
includes_for_type.add(interface_info['include_path']) |
if base_idl_type in INCLUDES_FOR_TYPE: |
includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type]) |
- if idl_type.is_typed_array: |
- return set(['core/dom/DOMTypedArray.h']) |
+ if idl_type.is_array_buffer_view_or_typed_array: |
+ return set(['core/dom/DOMTypedArray.h', 'core/dom/MaybeShared.h']) |
return includes_for_type |
@@ -559,7 +571,7 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else idl_type.base_type |
if 'FlexibleArrayBufferView' in extended_attributes: |
- if base_idl_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferView'])): |
+ if base_idl_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: |
raise "Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type) |
base_idl_type = 'FlexibleArrayBufferView' |
@@ -661,7 +673,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl |
'error_message': 'no V8 -> C++ conversion for IDL type: %s' % idl_type.name |
} |
elif 'FlexibleArrayBufferView' in extended_attributes: |
- if idl_type.base_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferView'])): |
+ if idl_type.base_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: |
raise "Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type) |
set_expression = cpp_value |
else: |