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

Unified Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 16951005: Add support for byte and octet Web IDL types to the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take Joshua's feedback into consideration Created 7 years, 6 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 | « LayoutTests/fast/js/webidl-type-mapping-expected.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/CodeGeneratorV8.pm
diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm
index 8faa15454b74e9d04fe7a05789200d330d51a695..20c707afa75a135b5f330f7f8d49120caadf1c23 100644
--- a/Source/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm
@@ -152,6 +152,8 @@ my %implementation;
my %primitiveTypeHash = ("boolean" => 1,
"void" => 1,
"Date" => 1,
+ "byte" => 1,
+ "octet" => 1,
"short" => 1,
"long" => 1,
"long long" => 1,
@@ -4827,8 +4829,8 @@ sub GetNativeType
return "float" if $type eq "float";
return "double" if $type eq "double";
- return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $type eq "unsigned short";
- return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int";
+ return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $type eq "byte";
+ return "unsigned" if $type eq "unsigned long" or $type eq "unsigned int" or $type eq "unsigned short" or $type eq "octet";
return "long long" if $type eq "long long";
return "unsigned long long" if $type eq "unsigned long long";
return "bool" if $type eq "boolean";
@@ -4893,11 +4895,15 @@ sub JSValueToNative
return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
if ($intConversion ne "NormalConversion") {
+ return "toInt8($value, $intConversion, ok)" if $type eq "byte";
+ return "toUInt8($value, $intConversion, ok)" if $type eq "octet";
return "toInt32($value, $intConversion, ok)" if $type eq "long" or $type eq "short";
return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long" or $type eq "unsigned short";
return "toInt64($value, $intConversion, ok)" if $type eq "long long";
return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long";
} else {
+ return "toInt8($value)" if $type eq "byte";
+ return "toUInt8($value)" if $type eq "octet";
return "toInt32($value)" if $type eq "long" or $type eq "short";
return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsigned short";
return "toInt64($value)" if $type eq "long long";
« no previous file with comments | « LayoutTests/fast/js/webidl-type-mapping-expected.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698