<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191288] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191288">191288</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2015-10-19 03:45:03 -0700 (Mon, 19 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Binding generator should generate names for JSBuiltins partial interface methods using ImplementedBy value
https://bugs.webkit.org/show_bug.cgi?id=150163
Reviewed by Darin Adler.
Covered by updated binding tests.
Updating generation of JS built-in function/attribute name to use the ImplementedBy value of the interface if any.
This allows splitting JS built-ins just like is done for IDLs.
Updated accordingly the JS Builtin header include.
* bindings/scripts/CodeGeneratorJS.pm:
(GetAttributeGetterName): Updated to pass function object and not only function name.
(GetAttributeSetterName): Ditto.
(GetFunctionName): Removed unneeded code plus updated to pass function object and not only function name.
(GenerateConstructorHelperMethods): Making direct use of GetJSBuiltinFunctionNameFromString since there is no function object for the constructor.
(GetJSBuiltinFunctionName): Updated to take into accound ImplementedBy value if any.
(GetJSBuiltinFunctionNameFromString):
(GetJSBuiltinScopeName): Returns either the interface name or its ImplementedBy value.
(AddJSBuiltinIncludesIfNeeded): Updating name of the header in case of partial interface.
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/ObjC/DOMTestInterface.h:
* bindings/scripts/test/ObjC/DOMTestInterface.mm:
(-[DOMTestInterface builtinAttribute]):
(-[DOMTestInterface setBuiltinAttribute:]):
(-[DOMTestInterface builtinFunction]):
* bindings/scripts/test/TestSupplemental.idl: Added JSBuiltin attribute and function.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestInterfaceh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestInterfacemm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestSupplementalidl">trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/ChangeLog        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -1,5 +1,35 @@
</span><span class="cx"> 2015-10-19 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><ins>+ Binding generator should generate names for JSBuiltins partial interface methods using ImplementedBy value
+ https://bugs.webkit.org/show_bug.cgi?id=150163
+
+ Reviewed by Darin Adler.
+
+ Covered by updated binding tests.
+
+ Updating generation of JS built-in function/attribute name to use the ImplementedBy value of the interface if any.
+ This allows splitting JS built-ins just like is done for IDLs.
+ Updated accordingly the JS Builtin header include.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GetAttributeGetterName): Updated to pass function object and not only function name.
+ (GetAttributeSetterName): Ditto.
+ (GetFunctionName): Removed unneeded code plus updated to pass function object and not only function name.
+ (GenerateConstructorHelperMethods): Making direct use of GetJSBuiltinFunctionNameFromString since there is no function object for the constructor.
+ (GetJSBuiltinFunctionName): Updated to take into accound ImplementedBy value if any.
+ (GetJSBuiltinFunctionNameFromString):
+ (GetJSBuiltinScopeName): Returns either the interface name or its ImplementedBy value.
+ (AddJSBuiltinIncludesIfNeeded): Updating name of the header in case of partial interface.
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ * bindings/scripts/test/ObjC/DOMTestInterface.h:
+ * bindings/scripts/test/ObjC/DOMTestInterface.mm:
+ (-[DOMTestInterface builtinAttribute]):
+ (-[DOMTestInterface setBuiltinAttribute:]):
+ (-[DOMTestInterface builtinFunction]):
+ * bindings/scripts/test/TestSupplemental.idl: Added JSBuiltin attribute and function.
+
+2015-10-19 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
</ins><span class="cx"> Binding generator should allow generating private JS functions
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=150167
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> # Copyright (C) 2012 Ericsson AB. All rights reserved.
</span><span class="cx"> # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
</span><span class="cx"> # Copyright (C) 2013 Samsung Electronics. All rights reserved.
</span><ins>+# Copyright (C) 2015 Canon Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # This library is free software; you can redistribute it and/or
</span><span class="cx"> # modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -571,7 +572,7 @@
</span><span class="cx"> return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
</span><span class="cx"> }
</span><span class="cx"> if ($attribute->signature->extendedAttributes->{"JSBuiltin"}) {
</span><del>- return GetJSBuiltinFunctionName($className, $attribute->signature->name);
</del><ins>+ return GetJSBuiltinFunctionName($className, $attribute);
</ins><span class="cx"> }
</span><span class="cx"> return "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
</span><span class="cx"> }
</span><span class="lines">@@ -583,28 +584,17 @@
</span><span class="cx"> return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
</span><span class="cx"> }
</span><span class="cx"> if ($attribute->signature->extendedAttributes->{"JSBuiltin"}) {
</span><del>- return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute->signature->name));
</del><ins>+ return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute));
</ins><span class="cx"> }
</span><span class="cx"> return "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub GetJSBuiltinFunctionName
-{
- my ($className, $functionName) = @_;
- return $codeGenerator->WK_lcfirst(substr $className, 2) . $codeGenerator->WK_ucfirst($functionName) . "CodeGenerator";
-}
-
</del><span class="cx"> sub GetFunctionName
</span><span class="cx"> {
</span><span class="cx"> my ($className, $function) = @_;
</span><span class="cx">
</span><del>- my $scopeName = $function->signature->extendedAttributes->{"ImplementedBy"};
- if (!$scopeName) {
- $scopeName = substr $className, 2;
- }
-
</del><span class="cx"> if ($function->signature->extendedAttributes->{"JSBuiltin"}) {
</span><del>- return GetJSBuiltinFunctionName($className, $function->signature->name);
</del><ins>+ return GetJSBuiltinFunctionName($className, $function);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $kind = $function->isStatic ? "Constructor" : "Prototype";
</span><span class="lines">@@ -4952,7 +4942,7 @@
</span><span class="cx"> if ($interface->extendedAttributes->{"JSBuiltinConstructor"}) {
</span><span class="cx"> push(@$outputArray, "template<> FunctionExecutable* ${constructorClassName}::initializeExecutable(VM& vm)\n");
</span><span class="cx"> push(@$outputArray, "{\n");
</span><del>- push(@$outputArray, " return " . GetJSBuiltinFunctionName($className, "initialize" . $interfaceName) . "(vm);\n");
</del><ins>+ push(@$outputArray, " return " . GetJSBuiltinFunctionNameFromString($interfaceName, "initialize" . $interfaceName) . "(vm);\n");
</ins><span class="cx"> push(@$outputArray, "}\n");
</span><span class="cx"> push(@$outputArray, "\n");
</span><span class="cx"> }
</span><span class="lines">@@ -5031,25 +5021,45 @@
</span><span class="cx"> return (@specials > 0) ? join(" | ", @specials) : "0";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub GetJSBuiltinFunctionName
+{
+ my ($className, $function) = @_;
+ my $scopeName = $function->signature->extendedAttributes->{"ImplementedBy"};
+ $scopeName = substr $className, 2 unless $scopeName;
+ return GetJSBuiltinFunctionNameFromString($scopeName, $function->signature->name);
+}
+
+sub GetJSBuiltinFunctionNameFromString
+{
+ my ($scopeName, $functionName) = @_;
+ return $codeGenerator->WK_lcfirst($scopeName) . $codeGenerator->WK_ucfirst($functionName) . "CodeGenerator";
+}
+
+sub GetJSBuiltinScopeName
+{
+ my $interface = shift;
+ my $object = shift;
+
+ return $object->signature->extendedAttributes->{"ImplementedBy"} if $object->signature->extendedAttributes->{"ImplementedBy"};
+ return $interface->name;
+}
+
</ins><span class="cx"> sub AddJSBuiltinIncludesIfNeeded()
</span><span class="cx"> {
</span><span class="cx"> my $interface = shift;
</span><span class="cx">
</span><del>- my $include = $interface->name . "Builtins.h";
-
</del><span class="cx"> if ($interface->extendedAttributes->{"JSBuiltinConstructor"}) {
</span><del>- AddToImplIncludes($include);
</del><ins>+ AddToImplIncludes($interface->name . "Builtins.h");
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- AddToImplIncludes($include, $function->signature->extendedAttributes->{"Conditional"}) if $function->signature->extendedAttributes->{"JSBuiltin"};
</del><ins>+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $function) . "Builtins.h", $function->signature->extendedAttributes->{"Conditional"}) if $function->signature->extendedAttributes->{"JSBuiltin"};
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- AddToImplIncludes($include, $attribute->signature->extendedAttributes->{"Conditional"}) if $attribute->signature->extendedAttributes->{"JSBuiltin"};
</del><ins>+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $attribute) . "Builtins.h", $attribute->signature->extendedAttributes->{"Conditional"}) if $attribute->signature->extendedAttributes->{"JSBuiltin"};
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> 1;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> #include <runtime/Error.h>
</span><span class="cx"> #include <wtf/GetPtr.h>
</span><span class="cx">
</span><ins>+#if ENABLE(Condition11) || ENABLE(Condition12)
+#include "TestSupplementalBuiltins.h"
+#endif
+
</ins><span class="cx"> #if ENABLE(Condition11) || ENABLE(Condition12) || ENABLE(Condition22) || ENABLE(Condition23)
</span><span class="cx"> #include "JSNode.h"
</span><span class="cx"> #include "JSTestObj.h"
</span><span class="lines">@@ -319,6 +323,11 @@
</span><span class="cx"> #else
</span><span class="cx"> { 0, 0, NoIntrinsic, { 0, 0 } },
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "builtinAttribute", Accessor | Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinAttributeCodeGenerator), (intptr_t) (setTestSupplementalBuiltinAttributeCodeGenerator) } },
+#else
+ { 0, 0, NoIntrinsic, { 0, 0 } },
+#endif
</ins><span class="cx"> #if ENABLE(Condition22) || ENABLE(Condition23)
</span><span class="cx"> { "IMPLEMENTSCONSTANT1", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
</span><span class="cx"> #else
</span><span class="lines">@@ -369,6 +378,11 @@
</span><span class="cx"> #else
</span><span class="cx"> { 0, 0, NoIntrinsic, { 0, 0 } },
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(Condition11) || ENABLE(Condition12)
+ { "builtinFunction", JSC::Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testSupplementalBuiltinFunctionCodeGenerator), (intptr_t) (0) } },
+#else
+ { 0, 0, NoIntrinsic, { 0, 0 } },
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -44,4 +44,5 @@
</span><span class="cx"> @property (copy) NSString *supplementalStr2;
</span><span class="cx"> @property (copy) NSString *supplementalStr3;
</span><span class="cx"> @property (strong) DOMNode *supplementalNode;
</span><ins>+@property unsigned short builtinAttribute;
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -172,7 +172,21 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(Condition11) || ENABLE(Condition12)
+- (unsigned short)builtinAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ return TestSupplemental::builtinAttribute(IMPL);
+}
</ins><span class="cx">
</span><ins>+- (void)setBuiltinAttribute:(unsigned short)newBuiltinAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ TestSupplemental::setBuiltinAttribute(IMPL, newBuiltinAttribute);
+}
+#endif
+
+
</ins><span class="cx"> #if ENABLE(Condition22) || ENABLE(Condition23)
</span><span class="cx"> - (void)implementsMethod1
</span><span class="cx"> {
</span><span class="lines">@@ -258,6 +272,16 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+
+#if ENABLE(Condition11) || ENABLE(Condition12)
+- (void)builtinFunction
+{
+ WebCore::JSMainThreadNullState state;
+ TestSupplemental::builtinFunction(IMPL);
+}
+
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> WebCore::TestInterface* core(DOMTestInterface *wrapper)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestSupplementalidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl (191287 => 191288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl        2015-10-19 10:36:42 UTC (rev 191287)
+++ trunk/Source/WebCore/bindings/scripts/test/TestSupplemental.idl        2015-10-19 10:45:03 UTC (rev 191288)
</span><span class="lines">@@ -45,4 +45,7 @@
</span><span class="cx">
</span><span class="cx"> const unsigned short SUPPLEMENTALCONSTANT1 = 1;
</span><span class="cx"> [Reflect=CONST_IMPL] const unsigned short SUPPLEMENTALCONSTANT2 = 2;
</span><ins>+
+ [JSBuiltin] void builtinFunction();
+ [JSBuiltin, ReadOnly] attribute unsigned short builtinAttribute;
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>