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

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

Issue 257783003: Basic support for unrestricted types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 46b011633307efbfe35c45d7f6cdf857d2a4e7a0..e243bbbde7fb0e6a6b7736a6f4cac2838308dbb1 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -113,6 +113,8 @@ CPP_SPECIAL_CONVERSION_RULES = {
# FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345529
'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>',
'boolean': 'bool',
+ 'unrestricted double': 'double',
+ 'unrestricted float': 'float',
}
@@ -352,7 +354,9 @@ V8_VALUE_TO_CPP_VALUE = {
'DOMString': '{v8_value}',
'boolean': '{v8_value}->BooleanValue()',
'float': 'static_cast<float>({v8_value}->NumberValue())',
Nils Barth (inactive) 2014/04/25 05:40:15 We should have a toFloat wrapper function, right?
haraken 2014/04/25 06:16:16 I'm neutral. If we need to write static_cast<float
Nils Barth (inactive) 2014/04/25 07:16:07 Nope, this is the only place, so no need!
+ 'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())',
'double': 'static_cast<double>({v8_value}->NumberValue())',
+ 'unrestricted double': 'static_cast<double>({v8_value}->NumberValue())',
'byte': 'toInt8({arguments})',
'octet': 'toUInt8({arguments})',
'short': 'toInt16({arguments})',
@@ -543,7 +547,9 @@ V8_SET_RETURN_VALUE = {
'void': '',
# No special v8SetReturnValue* function (set value directly)
'float': 'v8SetReturnValue(info, {cpp_value})',
+ 'unrestricted float': 'v8SetReturnValue(info, {cpp_value})',
'double': 'v8SetReturnValue(info, {cpp_value})',
+ 'unrestricted double': 'v8SetReturnValue(info, {cpp_value})',
# No special v8SetReturnValue* function, but instead convert value to V8
# and then use general v8SetReturnValue.
'array': 'v8SetReturnValue(info, {cpp_value})',
@@ -618,7 +624,9 @@ CPP_VALUE_TO_V8_VALUE = {
'int': 'v8::Integer::New({isolate}, {cpp_value})',
Nils Barth (inactive) 2014/04/25 05:40:15 v8Integer wrapper function? (etc.)
haraken 2014/04/25 06:16:16 This is no :) We don't want to have an unnecessary
Nils Barth (inactive) 2014/04/25 07:16:07 Got it, thanks!
'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})',
'float': 'v8::Number::New({isolate}, {cpp_value})',
+ 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})',
'double': 'v8::Number::New({isolate}, {cpp_value})',
+ 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})',
'void': 'v8Undefined()',
# Special cases
'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null({isolate}))',

Powered by Google App Engine
This is Rietveld 408576698