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

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

Issue 26694003: Add support for [TreatNullAs] extended attribute for reflected attributes (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 | 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/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index c43bd0e9913b97bd716117aab63f9d58627fe754..ce9b0c6f0c525906cf7f8d2cbc8439f5e4018cb8 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -1840,9 +1840,15 @@ END
# Generate super-compact call for regular attribute setter:
my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attrName : $reflect;
my $namespace = NamespaceForAttributeName($interfaceName, $contentAttributeName);
+ my $mode = "";
arv (Not doing code reviews) 2013/10/09 14:55:19 Can this be extracted to a function. sub GetStrin
Inactive 2013/10/09 15:17:41 Done.
+ if (($attribute->extendedAttributes->{"TreatNullAs"} and $attribute->extendedAttributes->{"TreatNullAs"} eq "NullString") and ($attribute->extendedAttributes->{"TreatUndefinedAs"} and $attribute->extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) {
+ $mode = "WithUndefinedOrNullCheck";
+ } elsif ($attribute->extendedAttributes->{"TreatNullAs"} and $attribute->extendedAttributes->{"TreatNullAs"} eq "NullString") {
+ $mode = "WithNullCheck";
+ }
AddToImplIncludes("${namespace}.h");
$code .= " Element* imp = V8Element::toNative(info.Holder());\n";
- $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, value);\n";
+ $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<$mode>, stringResource, value);\n";
# Attr (not Attribute) used in content attributes
$code .= " imp->setAttribute(${namespace}::${contentAttributeName}Attr, stringResource);\n";
$code .= "}\n\n";
@@ -5140,7 +5146,7 @@ sub GetNativeType
my $mode = "";
if (($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{"TreatNullAs"} eq "NullString") and ($extendedAttributes->{"TreatUndefinedAs"} and $extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) {
$mode = "WithUndefinedOrNullCheck";
- } elsif (($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{"TreatNullAs"} eq "NullString") or $extendedAttributes->{"Reflect"}) {
+ } elsif ($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{"TreatNullAs"} eq "NullString") {
$mode = "WithNullCheck";
}
# FIXME: Add the case for 'elsif ($attributeOrParameter->extendedAttributes->{"TreatUndefinedAs"} and $attributeOrParameter->extendedAttributes->{"TreatUndefinedAs"} eq "NullString"))'.
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698