Title: [113448] trunk/Source/WebCore
Revision
113448
Author
[email protected]
Date
2012-04-06 09:39:32 -0700 (Fri, 06 Apr 2012)

Log Message

Unreviewed, rolling out r113442.
http://trac.webkit.org/changeset/113442
https://bugs.webkit.org/show_bug.cgi?id=83373

for breaking JSC bindings compilation (Requested by pfeldman
on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-04-06

* GNUmakefile.list.am:
* Target.pri:
* UseJSC.cmake:
* UseV8.cmake:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSMutationCallbackCustom.cpp: Added.
(WebCore):
(WebCore::JSMutationCallback::handleEvent):
* bindings/scripts/CodeGenerator.pm:
* bindings/scripts/CodeGeneratorJS.pm:
(AddIncludesForTypeInImpl):
(GenerateCallbackHeader):
(GenerateCallbackImplementation):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateCallbackHeader):
(GenerateCallbackImplementation):
* bindings/scripts/test/JS/JSTestCallback.cpp:
(WebCore::JSTestCallback::callbackWithBoolean):
* bindings/scripts/test/JS/JSTestCallback.h:
(JSTestCallback):
* bindings/scripts/test/TestCallback.idl:
* bindings/scripts/test/V8/V8TestCallback.cpp:
(WebCore::V8TestCallback::callbackWithBoolean):
* bindings/scripts/test/V8/V8TestCallback.h:
(V8TestCallback):
* bindings/v8/custom/V8MutationCallbackCustom.cpp: Added.
(WebCore):
(WebCore::V8MutationCallback::handleEvent):
* dom/MutationCallback.idl:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113447 => 113448)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 16:39:32 UTC (rev 113448)
@@ -1,3 +1,44 @@
+2012-04-06  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r113442.
+        http://trac.webkit.org/changeset/113442
+        https://bugs.webkit.org/show_bug.cgi?id=83373
+
+        for breaking JSC bindings compilation (Requested by pfeldman
+        on #webkit).
+
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * UseJSC.cmake:
+        * UseV8.cmake:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSMutationCallbackCustom.cpp: Added.
+        (WebCore):
+        (WebCore::JSMutationCallback::handleEvent):
+        * bindings/scripts/CodeGenerator.pm:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (AddIncludesForTypeInImpl):
+        (GenerateCallbackHeader):
+        (GenerateCallbackImplementation):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateCallbackHeader):
+        (GenerateCallbackImplementation):
+        * bindings/scripts/test/JS/JSTestCallback.cpp:
+        (WebCore::JSTestCallback::callbackWithBoolean):
+        * bindings/scripts/test/JS/JSTestCallback.h:
+        (JSTestCallback):
+        * bindings/scripts/test/TestCallback.idl:
+        * bindings/scripts/test/V8/V8TestCallback.cpp:
+        (WebCore::V8TestCallback::callbackWithBoolean):
+        * bindings/scripts/test/V8/V8TestCallback.h:
+        (V8TestCallback):
+        * bindings/v8/custom/V8MutationCallbackCustom.cpp: Added.
+        (WebCore):
+        (WebCore::V8MutationCallback::handleEvent):
+        * dom/MutationCallback.idl:
+
 2012-04-06  Zan Dobersek  <[email protected]>
 
         [Gtk] Unskip the video track tests

Modified: trunk/Source/WebCore/GNUmakefile.list.am (113447 => 113448)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-04-06 16:39:32 UTC (rev 113448)
@@ -1413,6 +1413,7 @@
 	Source/WebCore/bindings/js/JSMessageEventCustom.cpp \
 	Source/WebCore/bindings/js/JSMessagePortCustom.cpp \
 	Source/WebCore/bindings/js/JSMessagePortCustom.h \
+	Source/WebCore/bindings/js/JSMutationCallbackCustom.cpp \
 	Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp \
 	Source/WebCore/bindings/js/JSNodeCustom.cpp \
 	Source/WebCore/bindings/js/JSNodeCustom.h \

Modified: trunk/Source/WebCore/Target.pri (113447 => 113448)


--- trunk/Source/WebCore/Target.pri	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/Target.pri	2012-04-06 16:39:32 UTC (rev 113448)
@@ -205,6 +205,7 @@
         bindings/v8/custom/V8MessageChannelConstructor.cpp \
         bindings/v8/custom/V8MessagePortCustom.cpp \
         bindings/v8/custom/V8MessageEventCustom.cpp \
+        bindings/v8/custom/V8MutationCallbackCustom.cpp \
         bindings/v8/custom/V8NamedNodeMapCustom.cpp \
         bindings/v8/custom/V8NamedNodesCollection.cpp \
         bindings/v8/custom/V8NodeCustom.cpp \
@@ -332,6 +333,7 @@
         bindings/js/JSMessageEventCustom.cpp \
         bindings/js/JSMessagePortCustom.cpp \
         bindings/js/JSMessagePortCustom.h \
+        bindings/js/JSMutationCallbackCustom.cpp \
         bindings/js/JSNamedNodeMapCustom.cpp \
         bindings/js/JSNodeCustom.cpp \
         bindings/js/JSNodeFilterCondition.cpp \

Modified: trunk/Source/WebCore/UseJSC.cmake (113447 => 113448)


--- trunk/Source/WebCore/UseJSC.cmake	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/UseJSC.cmake	2012-04-06 16:39:32 UTC (rev 113448)
@@ -112,6 +112,7 @@
     bindings/js/JSMessageChannelCustom.cpp
     bindings/js/JSMessageEventCustom.cpp
     bindings/js/JSMessagePortCustom.cpp
+    bindings/js/JSMutationCallbackCustom.cpp
     bindings/js/JSNamedNodeMapCustom.cpp
     bindings/js/JSNodeCustom.cpp
     bindings/js/JSNodeFilterCondition.cpp

Modified: trunk/Source/WebCore/UseV8.cmake (113447 => 113448)


--- trunk/Source/WebCore/UseV8.cmake	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/UseV8.cmake	2012-04-06 16:39:32 UTC (rev 113448)
@@ -132,6 +132,7 @@
     bindings/v8/custom/V8MessageChannelConstructor.cpp
     bindings/v8/custom/V8MessageEventCustom.cpp
     bindings/v8/custom/V8MessagePortCustom.cpp
+    bindings/v8/custom/V8MutationCallbackCustom.cpp
     bindings/v8/custom/V8NamedNodeMapCustom.cpp
     bindings/v8/custom/V8NamedNodesCollection.cpp
     bindings/v8/custom/V8NodeCustom.cpp

Modified: trunk/Source/WebCore/WebCore.gypi (113447 => 113448)


--- trunk/Source/WebCore/WebCore.gypi	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/WebCore.gypi	2012-04-06 16:39:32 UTC (rev 113448)
@@ -1954,6 +1954,7 @@
             'bindings/js/JSMessageEventCustom.cpp',
             'bindings/js/JSMessagePortCustom.cpp',
             'bindings/js/JSMessagePortCustom.h',
+            'bindings/js/JSMutationCallbackCustom.cpp',
             'bindings/js/JSNamedNodeMapCustom.cpp',
             'bindings/js/JSNodeCustom.cpp',
             'bindings/js/JSNodeFilterCondition.cpp',
@@ -2264,6 +2265,7 @@
             'bindings/v8/custom/V8MessageChannelConstructor.cpp',
             'bindings/v8/custom/V8MessageEventCustom.cpp',
             'bindings/v8/custom/V8MessagePortCustom.cpp',
+            'bindings/v8/custom/V8MutationCallbackCustom.cpp',
             'bindings/v8/custom/V8NamedNodeMapCustom.cpp',
             'bindings/v8/custom/V8NamedNodesCollection.cpp',
             'bindings/v8/custom/V8NamedNodesCollection.h',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (113447 => 113448)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-04-06 16:39:32 UTC (rev 113448)
@@ -67173,6 +67173,58 @@
 					>
 				</File>
 				<File
+					RelativePath="..\bindings\js\JSMutationCallbackCustom.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_Cairo_CFLite|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release_Cairo_CFLite|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_All|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Production|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\bindings\js\JSNamedNodeMapCustom.cpp"
 					>
 					<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (113447 => 113448)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-04-06 16:39:32 UTC (rev 113448)
@@ -5703,6 +5703,7 @@
 		C6F0902C14327D4F00685849 /* JSWebKitMutationObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F0902414327D4F00685849 /* JSWebKitMutationObserver.cpp */; };
 		C6F0902D14327D4F00685849 /* JSWebKitMutationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F0902514327D4F00685849 /* JSWebKitMutationObserver.h */; };
 		C6F0917F143A2BB900685849 /* JSWebKitMutationObserverCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F0917E143A2BB900685849 /* JSWebKitMutationObserverCustom.cpp */; };
+		C6F09185143A6C3B00685849 /* JSMutationCallbackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F09184143A6C3B00685849 /* JSMutationCallbackCustom.cpp */; };
 		C6F41047130C6E8900393DE4 /* EntryBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F41046130C6E8900393DE4 /* EntryBase.cpp */; };
 		CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
 		CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -12796,6 +12797,7 @@
 		C6F0902414327D4F00685849 /* JSWebKitMutationObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitMutationObserver.cpp; sourceTree = "<group>"; };
 		C6F0902514327D4F00685849 /* JSWebKitMutationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitMutationObserver.h; sourceTree = "<group>"; };
 		C6F0917E143A2BB900685849 /* JSWebKitMutationObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitMutationObserverCustom.cpp; sourceTree = "<group>"; };
+		C6F09184143A6C3B00685849 /* JSMutationCallbackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationCallbackCustom.cpp; sourceTree = "<group>"; };
 		C6F41046130C6E8900393DE4 /* EntryBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EntryBase.cpp; path = Modules/filesystem/EntryBase.cpp; sourceTree = "<group>"; };
 		CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
 		CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
@@ -19782,6 +19784,7 @@
 				410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
 				E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */,
 				41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */,
+				C6F09184143A6C3B00685849 /* JSMutationCallbackCustom.cpp */,
 				BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */,
 				BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */,
 				BC9439C2116CF4940048C750 /* JSNodeCustom.h */,
@@ -26467,6 +26470,7 @@
 				898785B8122CA2A7003AABDA /* JSMetadataCallback.cpp in Sources */,
 				A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
 				C6F0902814327D4F00685849 /* JSMutationCallback.cpp in Sources */,
+				C6F09185143A6C3B00685849 /* JSMutationCallbackCustom.cpp in Sources */,
 				65DF31FB09D1CC60000BE325 /* JSMutationEvent.cpp in Sources */,
 				C6F08FC91431000D00685849 /* JSMutationRecord.cpp in Sources */,
 				BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */,

Added: trunk/Source/WebCore/bindings/js/JSMutationCallbackCustom.cpp (0 => 113448)


--- trunk/Source/WebCore/bindings/js/JSMutationCallbackCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSMutationCallbackCustom.cpp	2012-04-06 16:39:32 UTC (rev 113448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2011 Google 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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(MUTATION_OBSERVERS)
+
+#include "JSMutationCallback.h"
+
+#include "JSMutationRecord.h"
+#include "JSWebKitMutationObserver.h"
+#include "ScriptExecutionContext.h"
+#include <runtime/JSLock.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+bool JSMutationCallback::handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer)
+{
+    if (!canInvokeCallback())
+        return true;
+
+    RefPtr<JSMutationCallback> protect(this);
+
+    JSLock lock(SilenceAssertionsOnly);
+
+    ExecState* exec = m_data->globalObject()->globalExec();
+
+    MarkedArgumentBuffer mutationList;
+    for (size_t i = 0; i < mutations->size(); ++i)
+        mutationList.append(toJS(exec, m_data->globalObject(), mutations->at(i).get()));
+
+    JSValue jsObserver = toJS(exec, m_data->globalObject(), observer);
+
+    MarkedArgumentBuffer args;
+    args.append(constructArray(exec, m_data->globalObject(), mutationList));
+    args.append(jsObserver);
+
+    bool raisedException = false;
+    m_data->invokeCallback(jsObserver, args, &raisedException);
+    return !raisedException;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MUTATION_OBSERVERS)

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2012-04-06 16:39:32 UTC (rev 113448)
@@ -454,17 +454,6 @@
     return "";
 }
 
-sub IsCallbackWithArrayType
-{
-    my ($generator, $dataNode, @mparams) = @_;
-    if ($dataNode->extendedAttributes->{"Callback"}) {
-        foreach my $param (@mparams) {
-            return 1 if $generator->GetArrayType($param->type);
-        }
-    }
-    return 0;
-}
-
 # Uppercase the first letter while respecting WebKit style guidelines.
 # E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang.
 sub WK_ucfirst

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-04-06 16:39:32 UTC (rev 113448)
@@ -209,9 +209,9 @@
 {
     my $type = $codeGenerator->StripModule(shift);
     my $isCallback = @_ ? shift : 0;
-
+    
     AddIncludesForType($type, $isCallback, \%implIncludes);
-
+    
     # additional includes (things needed to compile the bindings but not the header)
     if ($type eq "CanvasRenderingContext2D") {
         $implIncludes{"CanvasGradient.h"} = 1;
@@ -2607,12 +2607,7 @@
 
             my @args = ();
             foreach my $param (@params) {
-                my $arrayType = $codeGenerator->GetArrayType($param->type);
-                if ($arrayType) {
-                    push(@args, GetNativeType("${arrayType}Array") . " " . $param->name);
-                } else {
-                    push(@args, GetNativeType($param->type) . " " . $param->name);
-                }
+                push(@args, GetNativeType($param->type) . " " . $param->name);
             }
             push(@headerContent, join(", ", @args));
 
@@ -2687,32 +2682,17 @@
             }
 
             AddIncludesForTypeInImpl($function->signature->type);
+            push(@implContent, "\n" . GetNativeType($function->signature->type) . " ${className}::" . $function->signature->name . "(");
 
             my @args = ();
-            my @argsCheck;
             foreach my $param (@params) {
-                my $arrayType = $codeGenerator->GetArrayType($param->type);
-                if ($arrayType) {
-                    my $paramName = $param->name;
-                    push(@implContent, "typedef Vector<RefPtr<${arrayType}> > ${arrayType}Array;\n");
-                    AddIncludesForTypeInImpl($arrayType, 1);
-                    push(@args, GetNativeType("${arrayType}Array") . " " . $paramName);
-                    push(@argsCheck, <<END);
-    ASSERT(${paramName});
-    if (!${paramName})
-        return true;
-END
-                } else {
-                    AddIncludesForTypeInImpl($param->type, 1);
-                    push(@args, GetNativeType($param->type) . " " . $param->name);
-                }
+                AddIncludesForTypeInImpl($param->type, 1);
+                push(@args, GetNativeType($param->type) . " " . $param->name);
             }
-            push(@implContent, "\n" . GetNativeType($function->signature->type) . " ${className}::" . $function->signature->name . "(");
             push(@implContent, join(", ", @args));
             push(@implContent, ")\n");
 
             push(@implContent, "{\n");
-            push(@implContent, "@argsCheck\n") if @argsCheck;
             push(@implContent, "    if (!canInvokeCallback())\n");
             push(@implContent, "        return true;\n\n");
             push(@implContent, "    RefPtr<$className> protect(this);\n\n");
@@ -2726,29 +2706,13 @@
                     push(@implContent, "    args.append(jsString(exec, ${paramName}));\n");
                 } elsif ($param->type eq "boolean") {
                     push(@implContent, "    args.append(jsBoolean(${paramName}));\n");
-                } elsif ($codeGenerator->GetArrayType($param->type)) {
-                    push(@implContent, <<END);
-    MarkedArgumentBuffer list;
-    for (size_t i = 0; i < ${paramName}->size(); ++i)
-        list.append(toJS(exec, m_data->globalObject(), ${paramName}->at(i).get()));
-
-    args.append(constructArray(exec, m_data->globalObject(), list));
-END
                 } else {
                     push(@implContent, "    args.append(toJS(exec, m_data->globalObject(), ${paramName}));\n");
                 }
             }
 
             push(@implContent, "\n    bool raisedException = false;\n");
-            if ($codeGenerator->IsCallbackWithArrayType($dataNode, @params)) {
-                push(@implContent, <<END);
-    JSValue jsObserver = toJS(exec, m_data->globalObject(), observer);
-    m_data->invokeCallback(jsObserver, args, &raisedException);
-
-END
-            } else {
-                    push(@implContent, "    m_data->invokeCallback(args, &raisedException);\n");
-            }
+            push(@implContent, "    m_data->invokeCallback(args, &raisedException);\n");
             push(@implContent, "    return !raisedException;\n");
             push(@implContent, "}\n");
         }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-04-06 16:39:32 UTC (rev 113448)
@@ -2967,12 +2967,7 @@
 
             my @args = ();
             foreach my $param (@params) {
-                my $arrayType = $codeGenerator->GetArrayType($param->type);
-                if ($arrayType) {
-                    push(@args, GetNativeTypeForCallbacks("${arrayType}Array") . " " . $param->name);
-                } else {
-                    push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
-                }
+                push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
             }
             push(@headerContent, join(", ", @args));
             push(@headerContent, ");\n");
@@ -3040,33 +3035,18 @@
                 next;
             }
 
-            AddIncludesForType($function->signature->type); 
+            AddIncludesForType($function->signature->type);
+            push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "(");
 
             my @args = ();
-            my @argsCheck;
             foreach my $param (@params) {
-                my $arrayType = $codeGenerator->GetArrayType($param->type);
-                if ($arrayType) {
-                    AddIncludesForType($arrayType);
-                    my $paramName = $param->name;
-                    push(@implContent, "typedef Vector<RefPtr<${arrayType}> > ${arrayType}Array;\n");
-                    push(@args, GetNativeTypeForCallbacks("${arrayType}Array") . " " . $paramName);
-                    push(@argsCheck, <<END);
-    ASSERT(${paramName});
-    if (!${paramName})
-        return true;
-END
-                } else {
-                    AddIncludesForType($param->type);
-                    push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
-                }
+                AddIncludesForType($param->type);
+                push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
             }
-            push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "(");
             push(@implContent, join(", ", @args));
 
             push(@implContent, ")\n");
             push(@implContent, "{\n");
-            push(@implContent, "@argsCheck\n") if @argsCheck;
             push(@implContent, "    if (!canInvokeCallback())\n");
             push(@implContent, "        return true;\n\n");
             push(@implContent, "    v8::HandleScope handleScope;\n\n");
@@ -3078,17 +3058,6 @@
             @args = ();
             foreach my $param (@params) {
                 my $paramName = $param->name;
-                my @GenerateEventListenerImpl = ();
-                if ($codeGenerator->GetArrayType($param->type)) {
-                    push(@implContent, <<END);
-    v8::Local<v8::Array> ${paramName}Array = v8::Array::New(${paramName}->size());
-    for (size_t i = 0; i < ${paramName}->size(); ++i)
-        ${paramName}Array->Set(v8::Uint32::New(i), toV8(${paramName}->at(i).get()));
-
-END
-                    push(@args, "        ${paramName}Array");
-                    next;
-                }
                 push(@implContent, "    v8::Handle<v8::Value> ${paramName}Handle = " . NativeToJSValue($param, $paramName) . ";\n");
                 push(@implContent, "    if (${paramName}Handle.IsEmpty()) {\n");
                 push(@implContent, "        if (!isScriptControllerTerminating())\n");
@@ -3106,11 +3075,7 @@
                 push(@implContent, "\n    v8::Handle<v8::Value> *argv = 0;\n\n");
             }
             push(@implContent, "    bool callbackReturnValue = false;\n");
-            if ($codeGenerator->IsCallbackWithArrayType($dataNode, @params)) {
-                push(@implContent, "    return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(observerHandle), " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");
-            } else {
-                push(@implContent, "    return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");
-            }
+            push(@implContent, "    return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");
             push(@implContent, "}\n");
         }
     }

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp	2012-04-06 16:39:32 UTC (rev 113448)
@@ -27,8 +27,6 @@
 #include "JSClass1.h"
 #include "JSClass2.h"
 #include "JSDOMStringList.h"
-#include "JSMutationRecord.h"
-#include "JSWebKitMutationObserver.h"
 #include "ScriptExecutionContext.h"
 #include <runtime/JSLock.h>
 
@@ -147,37 +145,7 @@
     m_data->invokeCallback(args, &raisedException);
     return !raisedException;
 }
-typedef Vector<RefPtr<MutationRecord> > MutationRecordArray;
 
-bool JSTestCallback::handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer)
-{
-    ASSERT(mutations);
-    if (!mutations)
-        return true;
-
-    if (!canInvokeCallback())
-        return true;
-
-    RefPtr<JSTestCallback> protect(this);
-
-    JSLock lock(SilenceAssertionsOnly);
-
-    ExecState* exec = m_data->globalObject()->globalExec();
-    MarkedArgumentBuffer args;
-    MarkedArgumentBuffer list;
-    for (size_t i = 0; i < mutations->size(); ++i)
-        list.append(toJS(exec, m_data->globalObject(), mutations->at(i).get()));
-
-    args.append(constructArray(exec, m_data->globalObject(), list));
-    args.append(toJS(exec, m_data->globalObject(), observer));
-
-    bool raisedException = false;
-    JSValue jsObserver = toJS(exec, m_data->globalObject(), observer);
-    m_data->invokeCallback(jsObserver, args, &raisedException);
-
-    return !raisedException;
 }
 
-}
-
 #endif // ENABLE(SQL_DATABASE)

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h	2012-04-06 16:39:32 UTC (rev 113448)
@@ -47,7 +47,6 @@
     virtual int customCallback(Class5* class5Param, Class6* class6Param);
     virtual bool callbackWithStringList(DOMStringList* listParam);
     virtual bool callbackWithBoolean(bool boolParam);
-    virtual bool handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer);
 
 private:
     JSTestCallback(JSC::JSObject* callback, JSDOMGlobalObject*);

Modified: trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl	2012-04-06 16:39:32 UTC (rev 113448)
@@ -40,6 +40,5 @@
       [Custom] long customCallback(in Class5 class5Param, in Class6 class6Param);
       boolean callbackWithStringList(in DOMStringList listParam);
       boolean callbackWithBoolean(in boolean boolParam);
-      boolean handleEvent(in sequence<MutationRecord> mutations, in WebKitMutationObserver observer);
     };
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp	2012-04-06 16:39:32 UTC (rev 113448)
@@ -29,9 +29,7 @@
 #include "V8Class2.h"
 #include "V8CustomVoidCallback.h"
 #include "V8DOMStringList.h"
-#include "V8MutationRecord.h"
 #include "V8Proxy.h"
-#include "V8WebKitMutationObserver.h"
 #include <wtf/GetPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -192,45 +190,7 @@
     bool callbackReturnValue = false;
     return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
 }
-typedef Vector<RefPtr<MutationRecord> > MutationRecordArray;
 
-bool V8TestCallback::handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer)
-{
-    ASSERT(mutations);
-    if (!mutations)
-        return true;
-
-    if (!canInvokeCallback())
-        return true;
-
-    v8::HandleScope handleScope;
-
-    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
-    if (v8Context.IsEmpty())
-        return true;
-
-    v8::Context::Scope scope(v8Context);
-
-    v8::Local<v8::Array> mutationsArray = v8::Array::New(mutations->size());
-    for (size_t i = 0; i < mutations->size(); ++i)
-        mutationsArray->Set(v8::Uint32::New(i), toV8(mutations->at(i).get()));
-
-    v8::Handle<v8::Value> observerHandle = toV8(observer);
-    if (observerHandle.IsEmpty()) {
-        if (!isScriptControllerTerminating())
-            CRASH();
-        return true;
-    }
-
-    v8::Handle<v8::Value> argv[] = {
-        mutationsArray,
-        observerHandle
-    };
-
-    bool callbackReturnValue = false;
-    return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext());
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SQL_DATABASE)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h (113447 => 113448)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h	2012-04-06 16:39:32 UTC (rev 113448)
@@ -52,7 +52,6 @@
     virtual int customCallback(Class5* class5Param, Class6* class6Param);
     virtual bool callbackWithStringList(RefPtr<DOMStringList> listParam);
     virtual bool callbackWithBoolean(bool boolParam);
-    virtual bool handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer);
 
 private:
     V8TestCallback(v8::Local<v8::Object>, ScriptExecutionContext*);

Added: trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp (0 => 113448)


--- trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp	2012-04-06 16:39:32 UTC (rev 113448)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010, 2012 Google 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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(MUTATION_OBSERVERS)
+
+#include "V8MutationCallback.h"
+
+#include "ScriptExecutionContext.h"
+#include "V8Binding.h"
+#include "V8CustomVoidCallback.h"
+#include "V8MutationRecord.h"
+#include "V8Proxy.h"
+#include "V8WebKitMutationObserver.h"
+#include <wtf/Assertions.h>
+#include <wtf/GetPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+bool V8MutationCallback::handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer)
+{
+    ASSERT(mutations);
+    if (!mutations)
+        return true;
+
+    if (!canInvokeCallback())
+        return true;
+
+    v8::HandleScope handleScope;
+
+    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
+    if (v8Context.IsEmpty())
+        return true;
+
+    v8::Context::Scope scope(v8Context);
+
+    v8::Local<v8::Array> mutationsArray = v8::Array::New(mutations->size());
+    for (size_t i = 0; i < mutations->size(); ++i)
+        mutationsArray->Set(v8::Integer::New(i), toV8(mutations->at(i).get()));
+
+    v8::Handle<v8::Value> observerHandle = toV8(observer);
+    if (observerHandle.IsEmpty()) {
+        if (!isScriptControllerTerminating())
+            CRASH();
+        return true;
+    }
+
+    if (!observerHandle->IsObject())
+        return true;
+
+    v8::Handle<v8::Value> argv[] = {
+        mutationsArray,
+        observerHandle
+    };
+
+    bool callbackReturnValue = false;
+    return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MUTATION_OBSERVERS)

Modified: trunk/Source/WebCore/dom/MutationCallback.idl (113447 => 113448)


--- trunk/Source/WebCore/dom/MutationCallback.idl	2012-04-06 16:26:12 UTC (rev 113447)
+++ trunk/Source/WebCore/dom/MutationCallback.idl	2012-04-06 16:39:32 UTC (rev 113448)
@@ -33,6 +33,6 @@
         Conditional=MUTATION_OBSERVERS,
         Callback
     ] MutationCallback {
-        boolean handleEvent(in sequence<MutationRecord> mutations, in WebKitMutationObserver observer);
+        [Custom] boolean handleEvent(in MutationRecordArray mutations, in WebKitMutationObserver observer);
     };
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to