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

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

Issue 22436002: Replace EntryArray type by an Entry[] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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/code_generator_v8.py
diff --git a/Source/bindings/scripts/code_generator_v8.py b/Source/bindings/scripts/code_generator_v8.py
index 41e81fdaae08a507ec9365f5c4e5ecb204048477..0cfaec9bdf5bab4a464e0b30ccb960d27ad1a0ff 100644
--- a/Source/bindings/scripts/code_generator_v8.py
+++ b/Source/bindings/scripts/code_generator_v8.py
@@ -126,7 +126,7 @@ def cpp_value_to_js_value(data_type, cpp_value, isolate, creation_context=''):
return 'v8::Number::New(%s)' % cpp_value
if data_type == 'DOMString':
return 'v8String(%s, %s)' % (cpp_value, isolate)
- if sequence_type(data_type):
+ if array_or_sequence_type(data_type):
return 'v8Array(%s, %s)' % (cpp_value, isolate)
return 'toV8(%s, %s, %s)' % (cpp_value, creation_context, isolate)
@@ -146,8 +146,8 @@ def generate_conditional_string(interface_or_attribute_or_operation):
def includes_for_type(data_type):
if primitive_type(data_type) or data_type == 'DOMString':
return set()
- if sequence_type(data_type):
- return includes_for_type(sequence_type(data_type))
+ if array_or_sequence_type(data_type):
+ return includes_for_type(array_or_sequence_type(data_type))
return set(['V8%s.h' % data_type])
@@ -173,6 +173,16 @@ def sequence_type(data_type):
return matched.group(1)
+def array_type(data_type):
+ matched = re.match(r'([\w\d_\s]+)\[\]', data_type)
+ if not matched:
+ return None
+ return matched.group(1)
+
+
+def array_or_sequence_type(data_type):
+ return array_type(data_type) or sequence_type(data_type)
+
def cpp_type(data_type, pointer_type):
"""Returns the C++ type corresponding to the IDL type.
@@ -184,8 +194,8 @@ def cpp_type(data_type, pointer_type):
"""
if data_type in CPP_TYPE_SPECIAL_CONVERSION_RULES:
return CPP_TYPE_SPECIAL_CONVERSION_RULES[data_type]
- if sequence_type(data_type):
- return 'Vector<%s >' % cpp_type(sequence_type(data_type), 'RefPtr')
+ if array_or_sequence_type(data_type):
+ return 'const Vector<%s >&' % cpp_type(array_or_sequence_type(data_type), 'RefPtr')
if pointer_type == 'raw':
return data_type + '*'
if pointer_type in ['RefPtr', 'PassRefPtr']:
« no previous file with comments | « LayoutTests/fast/filesystem/script-tests/read-directory.js ('k') | Source/core/inspector/InspectorFileSystemAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698