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

Unified Diff: Source/WebCore/dom/make_names.pl

Issue 8806015: Changes to support a second VM. (Closed) Base URL: svn://svn.chromium.org/dash/experimental/chrome/src/webkit-full
Patch Set: . Created 9 years 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/dom/make_names.pl
diff --git a/Source/WebCore/dom/make_names.pl b/Source/WebCore/dom/make_names.pl
index 9acffd1cf41720349c109e971e9c4e65a3426cd9..eaaa94f514249763019355e46ec6809ac5b156c8 100755
--- a/Source/WebCore/dom/make_names.pl
+++ b/Source/WebCore/dom/make_names.pl
@@ -44,6 +44,7 @@ sub readAttrs($$);
my $printFactory = 0;
my $printWrapperFactory = 0;
my $printWrapperFactoryV8 = 0;
+my $printWrapperFactoryDart = 0;
my $fontNamesIn = "";
my $tagsFile = "";
my $attrsFile = "";
@@ -80,6 +81,7 @@ GetOptions(
'preprocessor=s' => \$preprocessor,
'wrapperFactory' => \$printWrapperFactory,
'wrapperFactoryV8' => \$printWrapperFactoryV8,
+ 'wrapperFactoryDart' => \$printWrapperFactoryDart,
'fonts=s' => \$fontNamesIn
);
@@ -159,15 +161,12 @@ if ($printFactory) {
printFactoryHeaderFile("$factoryBasePath.h");
}
-die "You cannot specify both --wrapperFactory and --wrapperFactoryV8" if $printWrapperFactory && $printWrapperFactoryV8;
-my $wrapperFactoryType = "";
-if ($printWrapperFactory) {
- $wrapperFactoryType = "JS";
-} elsif ($printWrapperFactoryV8) {
- $wrapperFactoryType = "V8";
-}
+my @wrapperFactoryTypes = ();
+push(@wrapperFactoryTypes, "JS") if $printWrapperFactory;
+push(@wrapperFactoryTypes, "V8") if $printWrapperFactoryV8;
+push(@wrapperFactoryTypes, "Dart") if $printWrapperFactoryDart;
-if ($wrapperFactoryType) {
+foreach my $wrapperFactoryType (@wrapperFactoryTypes) {
printWrapperFactoryCppFile($outputDir, $wrapperFactoryType, $wrapperFactoryFileName);
printWrapperFactoryHeaderFile($outputDir, $wrapperFactoryType, $wrapperFactoryFileName);
}
@@ -1027,6 +1026,40 @@ static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespa
END
;
}
+ } elsif ($wrapperFactoryType eq "Dart") {
+ # Hack for the media tags
+ # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file.
+ if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
+ print F <<END
+static Dart_Handle create${JSInterfaceName}Wrapper($parameters{namespace}Element* element)
+{
+ Settings* settings = element->document()->settings();
+ if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled()))
+ return toDartValue(element);
+ return toDartValue(static_cast<${JSInterfaceName}*>(element));
+}
+
+END
+;
+ } elsif (${JSInterfaceName} eq "HTMLElement") {
+ print F <<END
+static Dart_Handle create${JSInterfaceName}Wrapper($parameters{namespace}Element* element)
+{
+ return DartDOMWrapper::toDart<DartHTMLElement>(element);
+}
+
+END
+;
+ } else {
+ print F <<END
+static Dart_Handle create${JSInterfaceName}Wrapper($parameters{namespace}Element* element)
+{
+ return toDartValue(static_cast<${JSInterfaceName}*>(element));
+}
+
+END
+;
+ }
}
if ($conditional) {
@@ -1082,6 +1115,11 @@ END
#include <v8.h>
END
;
+ } elsif ($wrapperFactoryType eq "Dart") {
+ print F <<END
+#include "Dart$parameters{namespace}Element.h"
+END
+;
}
print F <<END
@@ -1104,6 +1142,12 @@ typedef v8::Handle<v8::Value> (*Create$parameters{namespace}ElementWrapperFuncti
END
;
+ } elsif ($wrapperFactoryType eq "Dart") {
+ print F <<END
+typedef Dart_Handle (*Create$parameters{namespace}ElementWrapperFunction)($parameters{namespace}Element*);
+
+END
+;
}
printWrapperFunctions($F, $wrapperFactoryType);
@@ -1126,6 +1170,15 @@ v8::Handle<v8::Value> createV8$parameters{namespace}Wrapper($parameters{namespac
if (map.isEmpty()) {
END
;
+ } elsif ($wrapperFactoryType eq "Dart") {
+ print F <<END
+Dart_Handle createDart$parameters{namespace}Wrapper($parameters{namespace}Element* element)
+{
+ typedef HashMap<WTF::AtomicStringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap;
+ DEFINE_STATIC_LOCAL(FunctionMap, map, ());
+ if (map.isEmpty()) {
+END
+;
}
for my $tag (sort keys %enabledTags) {
@@ -1164,6 +1217,12 @@ END
return V8$parameters{fallbackInterfaceName}::wrap(static_cast<$parameters{fallbackInterfaceName}*>(element), forceNewObject);
END
;
+ } elsif ($wrapperFactoryType eq "Dart") {
+ print F <<END
+ return createWrapperFunction(element);
+ return toDartValue(static_cast<$parameters{fallbackInterfaceName}*>(element));
+END
+;
}
print F <<END
}
@@ -1225,6 +1284,18 @@ namespace WebCore {
}
END
;
+ } elsif ($wrapperFactoryType eq "Dart") {
+ print F <<END
+#include "dart_api.h"
+
+namespace WebCore {
+
+ class $parameters{namespace}Element;
+
+ Dart_Handle createDart$parameters{namespace}Wrapper($parameters{namespace}Element*);
+}
+END
+;
}
print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};

Powered by Google App Engine
This is Rietveld 408576698