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

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

Issue 17225003: Support named query generation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: remove int returnValue and hard code v8::None 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 | « Source/bindings/bindings.gypi ('k') | Source/bindings/tests/results/V8TestEventTarget.cpp » ('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 9972dafcbaf43964df84aa05a003024cb324896e..ee97b640dde5f07c5ae8883e4394c05123b7d394 100644
--- a/Source/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm
@@ -3193,7 +3193,6 @@ sub GenerateImplementationIndexedPropertyAccessors
my $indexedEnumeratorFunction = $indexedGetterFunction;
$indexedEnumeratorFunction = 0 if $indexedGetterFunction && $indexedGetterFunction->extendedAttributes->{"NotEnumerable"};
- # FIXME: Support generated named query bindings.
my $indexedQueryFunction = 0;
# If there is an enumerator, there MUST be a query method to properly communicate property attributes.
my $hasQuery = $indexedQueryFunction || $indexedEnumeratorFunction;
@@ -3351,10 +3350,12 @@ sub GenerateImplementationNamedPropertyAccessors
GenerateImplementationNamedPropertyEnumerator($interface);
}
- # FIXME: Support generated named query bindings.
- my $namedQueryFunction = 0;
# If there is an enumerator, there MUST be a query method to properly communicate property attributes.
- my $hasQuery = $namedQueryFunction || $namedEnumeratorFunction;
+ my $hasQuery = $namedEnumeratorFunction;
+ my $hasCustomNamedQuery = $hasCustomNamedEnumerator;
+ if ($hasQuery && !$hasCustomNamedQuery) {
+ GenerateImplementationNamedPropertyQuery($interface);
+ }
my $subCode = "";
if ($namedGetterFunction || $namedSetterFunction || $namedDeleterFunction || $namedEnumeratorFunction || $hasQuery) {
@@ -3643,6 +3644,31 @@ void ${v8ClassName}::namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::
END
}
+sub GenerateImplementationNamedPropertyQuery
+{
+ my $interface = shift;
+ my $implClassName = GetImplName($interface);
+ my $v8ClassName = GetV8ClassName($interface);
+
+ $implementation{nameSpaceWebCore}->add(<<END);
+void ${v8ClassName}::namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
+{
+ ${implClassName}* collection = toNative(info.Holder());
+ AtomicString propertyName = toWebCoreAtomicString(name);
+ ExceptionCode ec = 0;
+ bool result = collection->namedPropertyQuery(propertyName, ec);
+ if (ec) {
+ setDOMException(ec, info.GetIsolate());
+ return;
+ }
+ if (!result)
+ return;
+ v8SetReturnValueInt(info, v8::None);
+}
+
+END
+}
+
sub GenerateImplementationLegacyCall
{
my $interface = shift;
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/tests/results/V8TestEventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698