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

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

Issue 1091543002: IDL: Add [FlexibleArrayBufferView] and use for bufferSubData Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-includes-for-type-tuning
Patch Set: add warning about the storage's life-time Created 5 years, 8 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
« no previous file with comments | « Source/bindings/core/v8/V8BindingMacros.h ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 90cf991416ddceae262864238f3a63404b031f60..fbfaca4091d55b3145d690961d56bc8780a3096b 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -181,8 +181,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_
return 'String'
return 'V8StringResource<%s>' % string_mode()
- if idl_type.is_array_buffer_or_view and raw_type:
- return idl_type.implemented_as + '*'
+ if idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes:
+ return 'FlexibleArrayBufferView'
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):
@@ -374,6 +374,9 @@ def includes_for_type(idl_type, extended_attributes=None):
base_idl_type = idl_type.base_type
if base_idl_type in INCLUDES_FOR_TYPE:
return INCLUDES_FOR_TYPE[base_idl_type]
+ if base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes:
+ return set(['bindings/core/v8/V8ArrayBufferView.h',
+ 'core/dom/FlexibleArrayBufferView.h'])
if idl_type.is_basic_type:
return set()
if base_idl_type.endswith('ConstructorConstructor'):
@@ -497,6 +500,7 @@ V8_VALUE_TO_CPP_VALUE = {
# Interface types
'Dictionary': 'Dictionary({v8_value}, {isolate}, exceptionState)',
'EventTarget': 'toEventTarget({isolate}, {v8_value})',
+ 'FlexibleArrayBufferView': 'toFlexibleArrayBufferView({isolate}, {v8_value}, {variable_name}, SMALL_ARRAY_BUFFER_VIEW_STORAGE({v8_value}))',
'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current({isolate}))',
'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})',
'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({v8_value}, 0, 0, exceptionState, {isolate})',
@@ -550,6 +554,9 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
idl_type = idl_type.preprocessed_type
base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else idl_type.base_type
+ if base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes:
+ base_idl_type = 'FlexibleArrayBufferView'
+
if idl_type.is_integer_type:
configuration = 'NormalConversion'
if 'EnforceRange' in extended_attributes:
@@ -645,6 +652,8 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
check_expression = '!%s.prepare()' % variable_name
elif not idl_type.v8_conversion_is_trivial:
raise Exception('unclassified V8 -> C++ conversion for IDL type: %s' % idl_type.name)
+ elif idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes:
+ set_expression = cpp_value
else:
assign_expression = cpp_value
« no previous file with comments | « Source/bindings/core/v8/V8BindingMacros.h ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698