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

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

Issue 52353003: IDL compiler: 3 more special types for methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years, 2 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 | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/unstable/v8_types.py
diff --git a/Source/bindings/scripts/unstable/v8_types.py b/Source/bindings/scripts/unstable/v8_types.py
index 7e002313f5809ca099e3606dee22466beca72f84..8d4d03186bc91a8c79133f1b77fa9773d8c013eb 100644
--- a/Source/bindings/scripts/unstable/v8_types.py
+++ b/Source/bindings/scripts/unstable/v8_types.py
@@ -166,6 +166,9 @@ DOM_NODE_TYPES = set([
'TestNode',
])
NON_WRAPPER_TYPES = set([
+ 'CompareHow',
+ 'Dictionary',
+ 'MediaQueryListListener',
'NodeFilter',
'SerializedScriptValue',
])
@@ -226,18 +229,14 @@ CPP_UNSIGNED_TYPES = set([
'unsigned short',
])
CPP_SPECIAL_CONVERSION_RULES = {
+ 'CompareHow': 'Range::CompareHow',
'Date': 'double',
+ 'Dictionary': 'Dictionary',
+ 'EventHandler': 'EventListener*',
'Promise': 'ScriptPromise',
'any': 'ScriptValue',
'boolean': 'bool',
}
-CPP_REF_PTR_CONVERSION_TYPES = set([
- # FIXME: overlaps with NON_WRAPPER_TYPES
- 'DOMStringList',
- 'NodeFilter',
- 'SerializedScriptValue',
- 'XPathNSResolver',
-])
def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
"""Returns C++ type corresponding to IDL type."""
@@ -263,7 +262,9 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
return 'unsigned'
if idl_type in CPP_SPECIAL_CONVERSION_RULES:
return CPP_SPECIAL_CONVERSION_RULES[idl_type]
- if idl_type in CPP_REF_PTR_CONVERSION_TYPES:
+ if (idl_type in NON_WRAPPER_TYPES or
+ idl_type == 'DOMStringList' or # FIXME: eliminate this special case
+ idl_type == 'XPathNSResolver'): # FIXME: eliminate this special case
return 'RefPtr<%s>' % idl_type
if idl_type == 'DOMString':
return cpp_string_type()
@@ -273,12 +274,8 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
if this_array_or_sequence_type:
return cpp_template_type('Vector', cpp_type(this_array_or_sequence_type))
- # Special cases
- if idl_type == 'EventHandler':
- return 'EventListener*'
if is_typed_array_type and used_as_argument:
return idl_type + '*'
-
if is_interface_type(idl_type) and not used_as_argument:
return cpp_template_type('RefPtr', idl_type)
# Default, assume native type is a pointer with same type name as idl type
@@ -357,11 +354,14 @@ V8_VALUE_TO_CPP_VALUE_AND_INCLUDES = {
# idl_type -> (cpp_expression_format, includes)
'any': ('ScriptValue({v8_value}, {isolate})',
set(['bindings/v8/ScriptValue.h'])),
+ 'CompareHow': ('static_cast<Range::CompareHow>({v8_value}->Int32Value())',
+ set()),
'Dictionary': ('Dictionary({v8_value}, {isolate})',
set(['bindings/v8/Dictionary.h'])),
'DOMStringList': ('toDOMStringList({v8_value}, {isolate})', set()),
- 'MediaQueryListListener': ('MediaQueryListListener::create({v8_value})',
- set(['core/css/MediaQueryListListener.h'])),
+ 'MediaQueryListListener': (
+ 'MediaQueryListListener::create(ScriptValue({v8_value}, {isolate}))',
+ set(['core/css/MediaQueryListListener.h'])),
'NodeFilter': ('toNodeFilter({v8_value}, {isolate})', set()),
'Promise': ('ScriptPromise({v8_value})',
set(['bindings/v8/ScriptPromise.h'])),
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698