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

Unified Diff: Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm

Issue 9231022: WebGL support. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 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/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
diff --git a/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm b/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
index ccf7cef64b2008fcdf7e8ba7c2d9ff141ad47c0a..91c8cb40fe151216376b0f112ef7fc4e1b1479b9 100644
--- a/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
+++ b/Source/WebCore/bindings/dart/gyp/scripts/CodeGeneratorDart.pm
@@ -108,6 +108,17 @@ sub GenerateModule
my ($object, $dataNode) = @_;
}
+my %overrideConstructorParameters = (
+ "Float32Array" => 3,
+ "Float64Array" => 3,
+ "Int8Array" => 3,
+ "Int16Array" => 3,
+ "Int32Array" => 3,
+ "Uint8Array" => 3,
+ "Uint16Array" => 3,
+ "Uint32Array" => 3,
+);
+
sub GenerateInterface
{
my ($object, $dataNode, $defines) = @_;
@@ -118,6 +129,10 @@ sub GenerateInterface
# Prepare internal structures.
$codeGenerator->LinkOverloadedFunctions($dataNode);
+ if (exists $overrideConstructorParameters{$dataNode->name}) {
antonm 2012/01/18 15:12:23 this feels like a hack to me: if we change the ord
Nikolay 2012/01/19 13:27:34 Done.
+ $dataNode->extendedAttributes->{"ConstructorParameters"} = $overrideConstructorParameters{$dataNode->name};
antonm 2012/01/18 15:12:23 nit: please, omit "" around ConstructorParameters
Nikolay 2012/01/19 13:27:34 Done.
+ }
+
# Start actual generation
if ($dataNode->extendedAttributes->{Callback}) {
$object->GenerateCallbackDartInterface($dataNode);
@@ -212,17 +227,19 @@ sub HasOptionalParameters
}
}
-sub HasCustomConstructor
+sub CanBeConstructed
{
my ($dataNode) = @_;
- # FIXME: switch to using CanBeConstructed attribute.
- return 1 if $dataNode->name eq "FileReader";
- return 1 if $dataNode->name eq "XMLHttpRequest";
- return 1 if $dataNode->name eq "WebKitCSSMatrix";
- return 1 if $dataNode->name eq "WebKitPoint";
+ return
+ $dataNode->extendedAttributes->{"CanBeConstructed"} || HasCustomConstructor($dataNode);
antonm 2012/01/18 15:12:23 nit: omit "" (here and below)
Nikolay 2012/01/19 13:27:34 Done.
+}
- return 0;
+sub HasCustomConstructor
+{
+ my ($dataNode) = @_;
+
+ return $dataNode->extendedAttributes->{"CustomConstructor"} && not ($dataNode->name =~ "Event");
}
sub IsParameterOptionalInWebKit
@@ -377,6 +394,7 @@ sub IDLTypeToW3C
my %idlTypeToDart = (
"any" => "Object",
+ "any[]" => "List",
"boolean" => "bool",
"custom" => "Object",
"object" => "Object",
@@ -1350,9 +1368,9 @@ my %excludedInterfaces = (
"SVGZoomAndPan" => 1,
);
-sub ListLike
+sub ListLikeWithBase
{
- my ($elementType, $needsAuxiliaryAccessors) = @_;
+ my ($elementType, $baseClass, $needsAuxiliaryAccessors) = @_;
my @auxiliaryMethods = ();
if ($needsAuxiliaryAccessors) {
@@ -1362,11 +1380,25 @@ sub ListLike
return IDLTypeInfoStruct->new(
additionalInterfaces => ["List<$elementType>"],
- superClass => "ListBase<$elementType>",
+ superClass => "$baseClass",
auxilaryMethods => \@auxiliaryMethods
);
}
+sub ListLike
+{
+ my ($elementType, $needsAuxiliaryAccessors) = @_;
+
+ return ListLikeWithBase($elementType, "ListBase<$elementType>", $needsAuxiliaryAccessors);
+}
+
+sub ArrayBufferLike
+{
+ my ($elementType, $needsAuxiliaryAccessors) = @_;
+
+ return ListLikeWithBase($elementType, "ArrayBufferViewImplementation", $needsAuxiliaryAccessors);
+}
+
sub MapLike
{
# FIXME: most probably we need to deduce more types using hints like
@@ -1395,6 +1427,15 @@ my %idlTypeInfoOverrides = (
"HTMLCollection" => ListLike("Node"),
"NodeList" => ListLike("Node"),
"StyleSheetList" => ListLike("StyleSheet"),
+ "ArrayBufferView" => ListLikeWithBase("num", "ListBase<num>"),
+ "Float32Array" => ArrayBufferLike("double", 1),
+ "Float64Array" => ArrayBufferLike("double", 1),
+ "Int8Array" => ArrayBufferLike("int", 1),
+ "Int16Array" => ArrayBufferLike("int", 1),
+ "Int32Array" => ArrayBufferLike("int", 1),
+ "Uint8Array" => ArrayBufferLike("int", 1),
+ "Uint16Array" => ArrayBufferLike("int", 1),
+ "Uint32Array" => ArrayBufferLike("int", 1),
);
# FIXME: turn into the single IDL type info registry.
@@ -1436,7 +1477,7 @@ sub GenerateSource
# Build default clause if any.
my $defaultClause = "";
- if (HasCustomConstructor($dataNode)) {
+ if (CanBeConstructed($dataNode)) {
$defaultClause = " default ${w3cInterfaceName}Implementation";
push(@customCallbackDeclarations, GenerateCustomCallbackDeclaration("constructorCallback"));
}

Powered by Google App Engine
This is Rietveld 408576698