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

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

Issue 31713002: IDL compiler: treat DOMString and DOMTimeStamp as primitive types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index 768e36bc43ba561f4d72e3fd403a7ce7d5fec1da..a35dcdfd1c0f18fac1658625d9f2481f0f877b08 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -152,9 +152,11 @@ my %implementation;
# as primitive types in the future.
# Since V8 dosn't provide Promise primitive object currently,
# primitiveTypeHash doesn't contain Promise.
-my %primitiveTypeHash = ("boolean" => 1,
+my %primitiveTypeHash = ("Date" => 1,
+ "DOMString" => 1,
+ "DOMTimeStamp" => 1, # typedef unsigned long long
+ "boolean" => 1,
"void" => 1,
- "Date" => 1,
"byte" => 1,
"octet" => 1,
"short" => 1,
@@ -414,7 +416,6 @@ sub SkipIncludeHeader
return 1 if IsPrimitiveType($type);
return 1 if IsEnumType($type);
return 1 if IsCallbackFunctionType($type);
- return 1 if $type eq "DOMString";
return 0;
}
@@ -5462,7 +5463,6 @@ sub IsWrapperType
return 0 if IsCallbackFunctionType($type);
return 0 if IsEnumType($type);
return 0 if IsPrimitiveType($type);
- return 0 if $type eq "DOMString";
return 0 if $type eq "Promise";
return !$nonWrapperTypes{$type};
}
@@ -5607,17 +5607,6 @@ sub NativeToJSValue
return "$indent$receiver v8::Number::New($getIsolate, static_cast<double>($nativeValue));";
}
- if (IsPrimitiveType($type)) {
- die "unexpected type $type" if not ($type eq "float" or $type eq "double");
- return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue});" if $isReturnValue;
- return "$indent$receiver v8::Number::New($getIsolate, $nativeValue);";
- }
-
- if ($nativeType eq "ScriptValue" or $nativeType eq "ScriptPromise") {
- return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue}.v8Value());" if $isReturnValue;
- return "$indent$receiver $nativeValue.v8Value();";
- }
-
my $conv = $extendedAttributes->{"TreatReturnedNullStringAs"};
if (($type eq "DOMString" || IsEnumType($type)) && $isReturnValue) {
my $functionSuffix = "";
@@ -5649,6 +5638,17 @@ sub NativeToJSValue
return "$indent$receiver $returnValue;";
}
+ if (IsPrimitiveType($type)) {
+ die "unexpected type $type" if not ($type eq "float" or $type eq "double");
+ return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue});" if $isReturnValue;
+ return "$indent$receiver v8::Number::New($getIsolate, $nativeValue);";
+ }
+
+ if ($nativeType eq "ScriptValue" or $nativeType eq "ScriptPromise") {
+ return "${indent}v8SetReturnValue(${getCallbackInfo}, ${nativeValue}.v8Value());" if $isReturnValue;
+ return "$indent$receiver $nativeValue.v8Value();";
+ }
+
my $arrayOrSequenceType = GetArrayOrSequenceType($type);
if ($arrayOrSequenceType) {
@@ -5882,7 +5882,6 @@ sub IsRefPtrType
return 0 if IsPrimitiveType($type);
return 0 if GetArrayType($type);
return 0 if GetSequenceType($type);
- return 0 if $type eq "DOMString";
return 0 if $type eq "Promise";
return 0 if IsCallbackFunctionType($type);
return 0 if IsEnumType($type);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698