Title: [188905] trunk/Source/WebCore
Revision
188905
Author
[email protected]
Date
2015-08-25 03:11:14 -0700 (Tue, 25 Aug 2015)

Log Message

Get rid of custom bindings for RequestAnimationFrameCallback.handleEvent()
https://bugs.webkit.org/show_bug.cgi?id=148417

Reviewed by Sam Weinig.

Get rid of custom bindings for RequestAnimationFrameCallback.handleEvent()
by improving the bindings generator. In this case, the problem was that the
bindings generator did not know how to convert a double parameter into a
JSValue. The new code leverages the pre-existing NativeToJSValue subroutine
to do the conversion instead of duplicating complex support here.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSRequestAnimationFrameCallbackCustom.cpp: Removed.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallbackImplementation):
* bindings/scripts/test/JS/JSTestCallback.cpp:
(WebCore::JSTestCallback::callbackWithArrayParam):
(WebCore::JSTestCallback::callbackWithSerializedScriptValueParam):
(WebCore::JSTestCallback::callbackWithStringList):
(WebCore::JSTestCallback::callbackWithBoolean):
(WebCore::JSTestCallback::callbackRequiresThisToPass):
* dom/RequestAnimationFrameCallback.idl:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (188904 => 188905)


--- trunk/Source/WebCore/CMakeLists.txt	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-08-25 10:11:14 UTC (rev 188905)
@@ -1170,7 +1170,6 @@
     bindings/js/JSReadableStreamControllerCustom.cpp
     bindings/js/JSReadableStreamCustom.cpp
     bindings/js/JSReadableStreamReaderCustom.cpp
-    bindings/js/JSRequestAnimationFrameCallbackCustom.cpp
     bindings/js/JSSQLResultSetRowListCustom.cpp
     bindings/js/JSSQLTransactionCustom.cpp
     bindings/js/JSSVGLengthCustom.cpp

Modified: trunk/Source/WebCore/ChangeLog (188904 => 188905)


--- trunk/Source/WebCore/ChangeLog	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/ChangeLog	2015-08-25 10:11:14 UTC (rev 188905)
@@ -1,3 +1,28 @@
+2015-08-25  Chris Dumez  <[email protected]>
+
+        Get rid of custom bindings for RequestAnimationFrameCallback.handleEvent()
+        https://bugs.webkit.org/show_bug.cgi?id=148417
+
+        Reviewed by Sam Weinig.
+
+        Get rid of custom bindings for RequestAnimationFrameCallback.handleEvent()
+        by improving the bindings generator. In this case, the problem was that the
+        bindings generator did not know how to convert a double parameter into a
+        JSValue. The new code leverages the pre-existing NativeToJSValue subroutine
+        to do the conversion instead of duplicating complex support here.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSRequestAnimationFrameCallbackCustom.cpp: Removed.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateCallbackImplementation):
+        * bindings/scripts/test/JS/JSTestCallback.cpp:
+        (WebCore::JSTestCallback::callbackWithArrayParam):
+        (WebCore::JSTestCallback::callbackWithSerializedScriptValueParam):
+        (WebCore::JSTestCallback::callbackWithStringList):
+        (WebCore::JSTestCallback::callbackWithBoolean):
+        (WebCore::JSTestCallback::callbackRequiresThisToPass):
+        * dom/RequestAnimationFrameCallback.idl:
+
 2015-08-24  Jinyoung Hur  <[email protected]>
 
         Clear cairo-gl surface for initialization

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (188904 => 188905)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-08-25 10:11:14 UTC (rev 188905)
@@ -18605,20 +18605,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\bindings\js\JSRequestAnimationFrameCallbackCustom.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\bindings\js\JSSQLResultSetRowListCustom.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (188904 => 188905)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-08-25 10:11:14 UTC (rev 188905)
@@ -4431,9 +4431,6 @@
     <ClCompile Include="..\bindings\js\ReadableJSStream.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>
-    <ClCompile Include="..\bindings\js\JSRequestAnimationFrameCallbackCustom.cpp">
-      <Filter>bindings\js</Filter>
-    </ClCompile>
     <ClCompile Include="..\bindings\js\JSSQLResultSetRowListCustom.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (188904 => 188905)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-08-25 10:11:14 UTC (rev 188905)
@@ -1738,7 +1738,6 @@
 		4998AECE13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */; };
 		4998AED113FB224D0090B1AA /* ScriptedAnimationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4998AECF13FB224D0090B1AA /* ScriptedAnimationController.cpp */; };
 		4998AED213FB224D0090B1AA /* ScriptedAnimationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AED013FB224D0090B1AA /* ScriptedAnimationController.h */; };
-		4998AED413FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4998AED313FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp */; };
 		499B3EC5128CCC4700E726C2 /* PlatformCALayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 499B3EC3128CCC4700E726C2 /* PlatformCALayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		499B3ED6128CD31400E726C2 /* GraphicsLayerCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 499B3ED4128CD31400E726C2 /* GraphicsLayerCA.cpp */; };
 		499B3ED7128CD31400E726C2 /* GraphicsLayerCA.h in Headers */ = {isa = PBXBuildFile; fileRef = 499B3ED5128CD31400E726C2 /* GraphicsLayerCA.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8994,7 +8993,6 @@
 		4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRequestAnimationFrameCallback.h; sourceTree = "<group>"; };
 		4998AECF13FB224D0090B1AA /* ScriptedAnimationController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptedAnimationController.cpp; sourceTree = "<group>"; };
 		4998AED013FB224D0090B1AA /* ScriptedAnimationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptedAnimationController.h; sourceTree = "<group>"; };
-		4998AED313FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRequestAnimationFrameCallbackCustom.cpp; sourceTree = "<group>"; };
 		499B3EC3128CCC4700E726C2 /* PlatformCALayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayer.h; sourceTree = "<group>"; };
 		499B3ED4128CD31400E726C2 /* GraphicsLayerCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsLayerCA.cpp; sourceTree = "<group>"; };
 		499B3ED5128CD31400E726C2 /* GraphicsLayerCA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerCA.h; sourceTree = "<group>"; };
@@ -21579,7 +21577,6 @@
 				A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
 				41A023F31A39DBCB00F722CF /* JSReadableStreamCustom.cpp */,
 				419FAFB01ABABD7B005B828B /* JSReadableStreamReaderCustom.cpp */,
-				4998AED313FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp */,
 				4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */,
 				07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */,
 				07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */,
@@ -29290,7 +29287,6 @@
 				419FAFB11ABABDED005B828B /* JSReadableStreamReaderCustom.cpp in Sources */,
 				BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */,
 				4998AECD13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp in Sources */,
-				4998AED413FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp in Sources */,
 				BC74DA481013F468007987AD /* JSRGBColor.cpp in Sources */,
 				073794E519EE2FF200E5A045 /* JSRTCConfiguration.cpp in Sources */,
 				07969DAB17D14151007FF842 /* JSRTCDataChannel.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (188904 => 188905)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2015-08-25 10:11:14 UTC (rev 188905)
@@ -127,7 +127,6 @@
 #include "JSReadableStreamReaderCustom.cpp"
 #include "ReadableJSStream.cpp"
 #endif
-#include "JSRequestAnimationFrameCallbackCustom.cpp"
 #include "JSSQLResultSetRowListCustom.cpp"
 #include "JSSQLTransactionCustom.cpp"
 #include "JSSVGLengthCustom.cpp"

Deleted: trunk/Source/WebCore/bindings/js/JSRequestAnimationFrameCallbackCustom.cpp (188904 => 188905)


--- trunk/Source/WebCore/bindings/js/JSRequestAnimationFrameCallbackCustom.cpp	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/bindings/js/JSRequestAnimationFrameCallbackCustom.cpp	2015-08-25 10:11:14 UTC (rev 188905)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-
-#include "JSRequestAnimationFrameCallback.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-bool JSRequestAnimationFrameCallback::handleEvent(double highResNowMs)
-{
-    if (!canInvokeCallback())
-        return true;
-
-    Ref<JSRequestAnimationFrameCallback> protect(*this);
-
-    JSLockHolder lock(m_data->globalObject()->vm());
-
-    MarkedArgumentBuffer args;
-    args.append(jsNumber(highResNowMs));
-
-    bool raisedException = false;
-    m_data->invokeCallback(args, &raisedException);
-    return !raisedException;
-}
-
-}
-
-#endif

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (188904 => 188905)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-08-25 10:11:14 UTC (rev 188905)
@@ -3,7 +3,7 @@
 # Copyright (C) 2006 Anders Carlsson <[email protected]>
 # Copyright (C) 2006, 2007 Samuel Weinig <[email protected]>
 # Copyright (C) 2006 Alexey Proskuryakov <[email protected]>
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013, 2014 Apple Inc. All rights reserved.
+# Copyright (C) 2006, 2007-2010, 2013-2105 Apple Inc. All rights reserved.
 # Copyright (C) 2009 Cameron McCormack <[email protected]>
 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
@@ -3590,20 +3590,13 @@
             push(@implContent, "    JSLockHolder lock(m_data->globalObject()->vm());\n\n");
             if (@params) {
                 push(@implContent, "    ExecState* exec = m_data->globalObject()->globalExec();\n");
+                push(@implContent, "    UNUSED_PARAM(exec);\n");
             }
             push(@implContent, "    MarkedArgumentBuffer args;\n");
 
             foreach my $param (@params) {
                 my $paramName = $param->name;
-                if ($param->type eq "DOMString") {
-                    push(@implContent, "    args.append(jsStringWithCache(exec, ${paramName}));\n");
-                } elsif ($param->type eq "boolean") {
-                    push(@implContent, "    args.append(jsBoolean(${paramName}));\n");
-                } elsif ($param->type eq "SerializedScriptValue") {
-                    push(@implContent, "    args.append($paramName ? $paramName->deserialize(exec, m_data->globalObject(), 0) : jsNull());\n");
-                } else {
-                    push(@implContent, "    args.append(toJS(exec, m_data->globalObject(), ${paramName}));\n");
-                }
+                push(@implContent, "    args.append(" . NativeToJSValue($param, 1, $interfaceName, $paramName, "m_data") . ");\n");
             }
 
             push(@implContent, "\n    bool raisedException = false;\n");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (188904 => 188905)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp	2015-08-25 10:11:14 UTC (rev 188905)
@@ -24,11 +24,15 @@
 
 #include "JSTestCallback.h"
 
+#include "DOMStringList.h"
 #include "JSDOMStringList.h"
 #include "JSTestNode.h"
 #include "ScriptExecutionContext.h"
 #include "SerializedScriptValue.h"
+#include "TestNode.h"
+#include "URL.h"
 #include <runtime/JSLock.h>
+#include <runtime/JSString.h>
 
 using namespace JSC;
 
@@ -84,8 +88,9 @@
     JSLockHolder lock(m_data->globalObject()->vm());
 
     ExecState* exec = m_data->globalObject()->globalExec();
+    UNUSED_PARAM(exec);
     MarkedArgumentBuffer args;
-    args.append(toJS(exec, m_data->globalObject(), arrayParam));
+    args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(arrayParam)));
 
     bool raisedException = false;
     m_data->invokeCallback(args, &raisedException);
@@ -102,8 +107,9 @@
     JSLockHolder lock(m_data->globalObject()->vm());
 
     ExecState* exec = m_data->globalObject()->globalExec();
+    UNUSED_PARAM(exec);
     MarkedArgumentBuffer args;
-    args.append(srzParam ? srzParam->deserialize(exec, m_data->globalObject(), 0) : jsNull());
+    args.append(srzParam ? srzParam->deserialize(exec, castedThis->globalObject(), 0) : jsNull());
     args.append(jsStringWithCache(exec, strArg));
 
     bool raisedException = false;
@@ -121,8 +127,9 @@
     JSLockHolder lock(m_data->globalObject()->vm());
 
     ExecState* exec = m_data->globalObject()->globalExec();
+    UNUSED_PARAM(exec);
     MarkedArgumentBuffer args;
-    args.append(toJS(exec, m_data->globalObject(), listParam));
+    args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(listParam)));
 
     bool raisedException = false;
     m_data->invokeCallback(args, &raisedException);
@@ -139,6 +146,7 @@
     JSLockHolder lock(m_data->globalObject()->vm());
 
     ExecState* exec = m_data->globalObject()->globalExec();
+    UNUSED_PARAM(exec);
     MarkedArgumentBuffer args;
     args.append(jsBoolean(boolParam));
 
@@ -157,9 +165,10 @@
     JSLockHolder lock(m_data->globalObject()->vm());
 
     ExecState* exec = m_data->globalObject()->globalExec();
+    UNUSED_PARAM(exec);
     MarkedArgumentBuffer args;
-    args.append(toJS(exec, m_data->globalObject(), longParam));
-    args.append(toJS(exec, m_data->globalObject(), testNodeParam));
+    args.append(jsNumber(longParam));
+    args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(testNodeParam)));
 
     bool raisedException = false;
     m_data->invokeCallback(args, &raisedException);

Modified: trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl (188904 => 188905)


--- trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl	2015-08-25 05:31:49 UTC (rev 188904)
+++ trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl	2015-08-25 10:11:14 UTC (rev 188905)
@@ -30,8 +30,8 @@
 
 [
     Conditional=REQUEST_ANIMATION_FRAME,
-] callback interface RequestAnimationFrameCallback{
+] callback interface RequestAnimationFrameCallback {
     // highResTime is passed as high resolution timestamp, see
     // http://www.w3.org/TR/hr-time/ for details.
-    [Custom] boolean handleEvent(unrestricted double highResTime);
+    boolean handleEvent(unrestricted double highResTime);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to