diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/bindings/scripts | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/bindings/scripts')
27 files changed, 1176 insertions, 156 deletions
diff --git a/Source/WebCore/bindings/scripts/CodeGenerator.pm b/Source/WebCore/bindings/scripts/CodeGenerator.pm index 9a9e9d7..7eb676f 100644 --- a/Source/WebCore/bindings/scripts/CodeGenerator.pm +++ b/Source/WebCore/bindings/scripts/CodeGenerator.pm @@ -52,7 +52,7 @@ my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1); my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1); -my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1); +my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1); my %svgAnimatedTypeHash = ("SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1, "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1, diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index d2309e9..cb51c8a 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -689,9 +689,6 @@ sub GenerateHeader push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>);\n"); } - # Destructor - push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $eventTarget or $interfaceName eq "DOMWindow"); - # Prototype push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}); @@ -741,7 +738,6 @@ sub GenerateHeader } # Class info - push(@headerContent, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n"); push(@headerContent, " static const JSC::ClassInfo s_info;\n\n"); # Structure ID @@ -752,7 +748,7 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);\n" . " }\n\n"); # markChildren function @@ -762,7 +758,7 @@ sub GenerateHeader } # Custom pushEventHandlerScope function - push(@headerContent, " virtual void pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChain&) const;\n\n") if $dataNode->extendedAttributes->{"CustomPushEventHandlerScope"}; + push(@headerContent, " virtual JSC::ScopeChainNode* pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChainNode*) const;\n\n") if $dataNode->extendedAttributes->{"CustomPushEventHandlerScope"}; # Custom call functions push(@headerContent, " virtual JSC::CallType getCallData(JSC::CallData&);\n\n") if $dataNode->extendedAttributes->{"CustomCall"}; @@ -950,7 +946,6 @@ sub GenerateHeader } else { push(@headerContent, " static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);\n"); } - push(@headerContent, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n"); push(@headerContent, " static const JSC::ClassInfo s_info;\n"); if ($numFunctions > 0 || $numConstants > 0 || $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}) { push(@headerContent, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n"); @@ -965,7 +960,7 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);\n" . " }\n"); if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) { push(@headerContent, " virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); @@ -1310,9 +1305,9 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}PrototypeTable);\n"); push(@implContent, "}\n"); - push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", 0, 0, get${className}PrototypeTable };\n\n"); + push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObjectWithGlobalObject::s_info, 0, get${className}PrototypeTable };\n\n"); } else { - push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", 0, &${className}PrototypeTable, 0 };\n\n"); + push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObjectWithGlobalObject::s_info, &${className}PrototypeTable, 0 };\n\n"); } if ($interfaceName eq "DOMWindow") { push(@implContent, "void* ${className}Prototype::operator new(size_t size)\n"); @@ -1386,12 +1381,8 @@ sub GenerateImplementation push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}Table);\n"); push(@implContent, "}\n"); } - push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", "); - if ($hasParent) { - push(@implContent, "&" . $parentClassName . "::s_info, "); - } else { - push(@implContent, "0, "); - } + + push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", &" . $parentClassName . "::s_info, "); if ($numAttributes > 0 && !$dataNode->extendedAttributes->{"NoStaticTables"}) { push(@implContent, "&${className}Table"); @@ -1432,33 +1423,13 @@ sub GenerateImplementation } } push(@implContent, "{\n"); + push(@implContent, " ASSERT(inherits(&s_info));\n"); if ($numCachedAttributes > 0) { push(@implContent, " for (unsigned i = Base::AnonymousSlotCount; i < AnonymousSlotCount; i++)\n"); push(@implContent, " putAnonymousValue(globalObject->globalData(), i, JSValue());\n"); } push(@implContent, "}\n\n"); - # Destructor - if (!$hasParent || $eventTarget) { - push(@implContent, "${className}::~$className()\n"); - push(@implContent, "{\n"); - - if ($eventTarget) { - $implIncludes{"RegisteredEventListener.h"} = 1; - push(@implContent, " impl()->invalidateJSEventListeners(this);\n"); - } - - if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { - if ($interfaceName eq "Node") { - push(@implContent, " forgetDOMNode(this, impl(), impl()->document());\n"); - } else { - push(@implContent, " forgetDOMObject(this, impl());\n"); - } - } - - push(@implContent, "}\n\n"); - } - if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { push(@implContent, "void ${className}::markChildren(MarkStack& markStack)\n"); push(@implContent, "{\n"); @@ -2039,7 +2010,7 @@ sub GenerateImplementation } } - push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); + push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, "exec->argument($argsIndex)") . ");\n"); # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. # But this needs to be done in the bindings, because the type is unsigned and the fact that it @@ -2398,7 +2369,6 @@ my %nativeType = ( "NodeFilter" => "RefPtr<NodeFilter>", "SerializedScriptValue" => "RefPtr<SerializedScriptValue>", "IDBKey" => "RefPtr<IDBKey>", - "SVGPaintType" => "SVGPaint::SVGPaintType", "boolean" => "bool", "double" => "double", "float" => "float", @@ -2485,7 +2455,6 @@ sub JSValueToNative return "valueToDate(exec, $value)" if $type eq "Date"; return "static_cast<Range::CompareHow>($value.toInt32(exec))" if $type eq "CompareHow"; - return "static_cast<SVGPaint::SVGPaintType>($value.toInt32(exec))" if $type eq "SVGPaintType"; if ($type eq "DOMString") { return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"}; @@ -2494,12 +2463,12 @@ sub JSValueToNative } if ($type eq "DOMObject") { - return "$value"; + return "exec->globalData(), $value"; } if ($type eq "MediaQueryListListener") { $implIncludes{"MediaQueryListListener.h"} = 1; - return "MediaQueryListListener::create(" . $value .")"; + return "MediaQueryListListener::create(ScriptValue(exec->globalData(), " . $value ."))"; } if ($type eq "SerializedScriptValue" or $type eq "any") { @@ -2544,7 +2513,7 @@ sub NativeToJSValue return "jsNumber(std::max(0, " . $value . "))"; } - if ($codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType" or $type eq "DOMTimeStamp") { + if ($codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp") { $implIncludes{"<runtime/JSNumberCell.h>"} = 1; return "jsNumber($value)"; } @@ -2902,12 +2871,11 @@ sub GenerateConstructorDeclaration push(@$outputArray, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n"); push(@$outputArray, " virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n"); - push(@$outputArray, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n"); push(@$outputArray, " static const JSC::ClassInfo s_info;\n"); push(@$outputArray, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n"); push(@$outputArray, " {\n"); - push(@$outputArray, " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n"); + push(@$outputArray, " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);\n"); push(@$outputArray, " }\n"); push(@$outputArray, "protected:\n"); @@ -2936,11 +2904,12 @@ sub GenerateConstructorDefinition my $callWith = $dataNode->extendedAttributes->{"CallWith"}; my $numberOfconstructParameters = $dataNode->extendedAttributes->{"ConstructorParameters"}; - push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n"); + push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", &DOMConstructorObject::s_info, &${constructorClassName}Table, 0 };\n\n"); push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n"); push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n"); push(@$outputArray, "{\n"); + push(@$outputArray, " ASSERT(inherits(&s_info));\n"); if ($interfaceName eq "DOMWindow") { push(@$outputArray, " putDirect(exec->globalData(), exec->propertyNames().prototype, globalObject->prototype(), DontDelete | ReadOnly);\n"); } else { diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 6ccebf9..a032a71 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -474,7 +474,7 @@ sub GetObjCType return "id <$name>" if IsProtocolType($type); return $name if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp"; - return "unsigned short" if $type eq "CompareHow" or $type eq "SVGPaintType"; + return "unsigned short" if $type eq "CompareHow"; return "$name *"; } @@ -492,7 +492,7 @@ sub GetPropertyAttributes push(@attributes, "copy"); } elsif ($codeGenerator->IsSVGAnimatedType($type)) { push(@attributes, "retain"); - } elsif (!$codeGenerator->IsStringType($type) && !$codeGenerator->IsPrimitiveType($type) && $type ne "DOMTimeStamp" && $type ne "CompareHow" && $type ne "SVGPaintType") { + } elsif (!$codeGenerator->IsStringType($type) && !$codeGenerator->IsPrimitiveType($type) && $type ne "DOMTimeStamp" && $type ne "CompareHow") { push(@attributes, "retain"); } @@ -515,7 +515,6 @@ sub GetObjCTypeGetter return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type) or IsNativeObjCType($type); return $argName . "Node" if $type eq "EventTarget"; return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow"; - return "static_cast<WebCore::SVGPaint::SVGPaintType>($argName)" if $type eq "SVGPaintType"; return "WTF::getPtr(nativeEventListener)" if $type eq "EventListener"; return "WTF::getPtr(nativeNodeFilter)" if $type eq "NodeFilter"; return "WTF::getPtr(nativeResolver)" if $type eq "XPathNSResolver"; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index f393230..df1c04a 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -247,7 +247,11 @@ sub GenerateHeader my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName); foreach my $headerInclude (sort keys(%headerIncludes)) { - push(@headerContent, "#include \"${headerInclude}\"\n"); + if ($headerInclude =~ /wtf/) { + push(@headerContent, "#include \<${headerInclude}\>\n"); + } else { + push(@headerContent, "#include \"${headerInclude}\"\n"); + } } push(@headerContent, "#include <v8.h>\n"); @@ -367,16 +371,14 @@ END v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) { END - if ($domMapFunction) { - push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); - my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)"; - push(@headerContent, <<END); + push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); + my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)"; + push(@headerContent, <<END); v8::Handle<v8::Object> wrapper = ${getWrapper}; if (!wrapper.IsEmpty()) return wrapper; END - push(@headerContent, " }\n") if IsDOMNodeType($interfaceName); - } + push(@headerContent, " }\n") if IsDOMNodeType($interfaceName); push(@headerContent, <<END); return ${className}::wrapSlow(impl); } @@ -1832,7 +1834,7 @@ sub GenerateImplementation } my $has_attributes = 0; - if (@$attributes) { + if (@$attributes && (@$attributes > 1 || $$attributes[0]->signature->type ne "SerializedScriptValue")) { $has_attributes = 1; push(@implContent, "static const BatchedAttribute ${interfaceName}Attrs[] = {\n"); GenerateBatchedAttributeData($dataNode, $attributes); @@ -1976,7 +1978,9 @@ END } else { push(@implContent, <<END); 0, 0); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. END + $implIncludes{"wtf/UnusedParam.h"} = 1; } if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { @@ -2501,11 +2505,9 @@ END END } - if ($domMapFunction) { - push(@implContent, <<END); + push(@implContent, <<END); ${domMapFunction}.set(impl, v8::Persistent<v8::Object>::New(wrapper)); END - } push(@implContent, <<END); return wrapper; @@ -2549,7 +2551,6 @@ sub GetDomMapFunction my $type = shift; return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance"; return "getDOMNodeMap()" if ($dataNode && IsNodeSubType($dataNode)); - return "" if $type eq "DOMImplementation"; return "getActiveDOMObjectMap()" if IsActiveDomType($type); return "getDOMObjectMap()"; } @@ -2809,7 +2810,6 @@ sub GetNativeType return "bool" if $type eq "boolean"; return "String" if $type eq "DOMString"; return "Range::CompareHow" if $type eq "CompareHow"; - return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType"; return "DOMTimeStamp" if $type eq "DOMTimeStamp"; return "unsigned" if $type eq "unsigned int"; return "Node*" if $type eq "EventTarget" and $isParameter; @@ -2886,7 +2886,6 @@ sub JSValueToNative return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsigned short"; return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long"; return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow"; - return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType"; return "toWebCoreDate($value)" if $type eq "Date"; return "v8ValueToWebCoreDOMStringList($value)" if $type eq "DOMStringList"; @@ -3040,7 +3039,6 @@ my %non_wrapper_types = ( 'DOMString' => 1, 'CompareHow' => 1, 'SerializedScriptValue' => 1, - 'SVGPaintType' => 1, 'DOMTimeStamp' => 1, 'JSObject' => 1, 'DOMObject' => 1, @@ -3117,7 +3115,7 @@ sub NativeToJSValue return "v8DateOrNull($value)" if $type eq "Date"; # long long and unsigned long long are not representable in ECMAScript. return "v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp"; - return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; + return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type); return "$value.v8Value()" if $nativeType eq "ScriptValue"; if ($codeGenerator->IsStringType($type)) { diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp new file mode 100644 index 0000000..e16af2d --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp @@ -0,0 +1,96 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include "WebDOMTestSerializedScriptValueInterface.h" + +#include "SerializedScriptValue.h" +#include "TestSerializedScriptValueInterface.h" +#include "WebExceptionHandler.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestSerializedScriptValueInterface::WebDOMTestSerializedScriptValueInterfacePrivate { + WebDOMTestSerializedScriptValueInterfacePrivate(WebCore::TestSerializedScriptValueInterface* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestSerializedScriptValueInterface> impl; +}; + +WebDOMTestSerializedScriptValueInterface::WebDOMTestSerializedScriptValueInterface() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestSerializedScriptValueInterface::WebDOMTestSerializedScriptValueInterface(WebCore::TestSerializedScriptValueInterface* impl) + : WebDOMObject() + , m_impl(new WebDOMTestSerializedScriptValueInterfacePrivate(impl)) +{ +} + +WebDOMTestSerializedScriptValueInterface::WebDOMTestSerializedScriptValueInterface(const WebDOMTestSerializedScriptValueInterface& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestSerializedScriptValueInterfacePrivate(copy.impl()) : 0; +} + +WebDOMTestSerializedScriptValueInterface& WebDOMTestSerializedScriptValueInterface::operator=(const WebDOMTestSerializedScriptValueInterface& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestSerializedScriptValueInterfacePrivate(copy.impl()) : 0; + return *this; +} + +WebCore::TestSerializedScriptValueInterface* WebDOMTestSerializedScriptValueInterface::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestSerializedScriptValueInterface::~WebDOMTestSerializedScriptValueInterface() +{ + delete m_impl; + m_impl = 0; +} + +WebDOMString WebDOMTestSerializedScriptValueInterface::value() const +{ + if (!impl()) + return WebDOMString(); + + return impl()->value()->toString(); +} + +WebCore::TestSerializedScriptValueInterface* toWebCore(const WebDOMTestSerializedScriptValueInterface& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestSerializedScriptValueInterface toWebKit(WebCore::TestSerializedScriptValueInterface* value) +{ + return WebDOMTestSerializedScriptValueInterface(value); +} + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h new file mode 100644 index 0000000..f0daf55 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebDOMTestSerializedScriptValueInterface_h +#define WebDOMTestSerializedScriptValueInterface_h + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestSerializedScriptValueInterface; +}; + +class WebDOMString; + +class WebDOMTestSerializedScriptValueInterface : public WebDOMObject { +public: + WebDOMTestSerializedScriptValueInterface(); + explicit WebDOMTestSerializedScriptValueInterface(WebCore::TestSerializedScriptValueInterface*); + WebDOMTestSerializedScriptValueInterface(const WebDOMTestSerializedScriptValueInterface&); + WebDOMTestSerializedScriptValueInterface& operator=(const WebDOMTestSerializedScriptValueInterface&); + virtual ~WebDOMTestSerializedScriptValueInterface(); + + WebDOMString value() const; + + WebCore::TestSerializedScriptValueInterface* impl() const; + +protected: + struct WebDOMTestSerializedScriptValueInterfacePrivate; + WebDOMTestSerializedScriptValueInterfacePrivate* m_impl; +}; + +WebCore::TestSerializedScriptValueInterface* toWebCore(const WebDOMTestSerializedScriptValueInterface&); +WebDOMTestSerializedScriptValueInterface toWebKit(WebCore::TestSerializedScriptValueInterface*); + +#endif +#endif // ENABLE(Condition1) || ENABLE(Condition2) + diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp new file mode 100644 index 0000000..7592b02 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp @@ -0,0 +1,181 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <glib-object.h> +#include "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> +#include "DOMObjectCache.h" +#include "ExceptionCode.h" +#include "JSMainThreadExecState.h" +#include "SerializedScriptValue.h" +#include "TestSerializedScriptValueInterface.h" +#include "WebKitDOMBinding.h" +#include "gobject/ConvertToUTF8String.h" +#include "webkit/WebKitDOMSerializedScriptValue.h" +#include "webkit/WebKitDOMSerializedScriptValuePrivate.h" +#include "webkit/WebKitDOMTestSerializedScriptValueInterface.h" +#include "webkit/WebKitDOMTestSerializedScriptValueInterfacePrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" +#include "webkitmarshal.h" + +namespace WebKit { + +WebKitDOMTestSerializedScriptValueInterface* kit(WebCore::TestSerializedScriptValueInterface* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return static_cast<WebKitDOMTestSerializedScriptValueInterface*>(ret); + + return static_cast<WebKitDOMTestSerializedScriptValueInterface*>(DOMObjectCache::put(obj, WebKit::wrapTestSerializedScriptValueInterface(obj))); +} + +} // namespace WebKit // + +WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_value(WebKitDOMTestSerializedScriptValueInterface* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + PassRefPtr<WebCore::SerializedScriptValue> g_res = WTF::getPtr(item->value()); + WebKitDOMSerializedScriptValue* res = WebKit::kit(g_res.get()); + return res; +} + + +G_DEFINE_TYPE(WebKitDOMTestSerializedScriptValueInterface, webkit_dom_test_serialized_script_value_interface, WEBKIT_TYPE_DOM_OBJECT) + +namespace WebKit { + +WebCore::TestSerializedScriptValueInterface* core(WebKitDOMTestSerializedScriptValueInterface* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::TestSerializedScriptValueInterface* coreObject = static_cast<WebCore::TestSerializedScriptValueInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit +enum { + PROP_0, + PROP_VALUE, +}; + + +static void webkit_dom_test_serialized_script_value_interface_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object->coreObject) { + WebCore::TestSerializedScriptValueInterface* coreObject = static_cast<WebCore::TestSerializedScriptValueInterface *>(dom_object->coreObject); + + WebKit::DOMObjectCache::forget(coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + } + + G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->finalize(object); +} + +static void webkit_dom_test_serialized_script_value_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_serialized_script_value_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebCore::JSMainThreadNullState state; + WebKitDOMTestSerializedScriptValueInterface* self = WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(object); + WebCore::TestSerializedScriptValueInterface* coreSelf = WebKit::core(self); + switch (prop_id) { + case PROP_VALUE: + { + RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->value(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + + +static void webkit_dom_test_serialized_script_value_interface_constructed(GObject* object) +{ + + if (G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->constructed) + G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->constructed(object); +} + +static void webkit_dom_test_serialized_script_value_interface_class_init(WebKitDOMTestSerializedScriptValueInterfaceClass* requestClass) +{ + GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); + gobjectClass->finalize = webkit_dom_test_serialized_script_value_interface_finalize; + gobjectClass->set_property = webkit_dom_test_serialized_script_value_interface_set_property; + gobjectClass->get_property = webkit_dom_test_serialized_script_value_interface_get_property; + gobjectClass->constructed = webkit_dom_test_serialized_script_value_interface_constructed; + + g_object_class_install_property(gobjectClass, + PROP_VALUE, + g_param_spec_object("value", /* name */ + "test_serialized_script_value_interface_value", /* short description */ + "read-only WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.value", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */ + WEBKIT_PARAM_READABLE)); + + +} + +static void webkit_dom_test_serialized_script_value_interface_init(WebKitDOMTestSerializedScriptValueInterface* request) +{ +} + +namespace WebKit { +WebKitDOMTestSerializedScriptValueInterface* wrapTestSerializedScriptValueInterface(WebCore::TestSerializedScriptValueInterface* coreObject) +{ + g_return_val_if_fail(coreObject, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + coreObject->ref(); + + return WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE, + "core-object", coreObject, NULL)); +} +} // namespace WebKit +#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h new file mode 100644 index 0000000..4bcc755 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h @@ -0,0 +1,54 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebKitDOMTestSerializedScriptValueInterface_h +#define WebKitDOMTestSerializedScriptValueInterface_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> +#include "webkit/WebKitDOMObject.h" + + +G_BEGIN_DECLS +#define WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE (webkit_dom_test_serialized_script_value_interface_get_type()) +#define WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE, WebKitDOMTestSerializedScriptValueInterface)) +#define WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE, WebKitDOMTestSerializedScriptValueInterfaceClass) +#define WEBKIT_DOM_IS_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE)) +#define WEBKIT_DOM_IS_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE)) +#define WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE, WebKitDOMTestSerializedScriptValueInterfaceClass)) + +struct _WebKitDOMTestSerializedScriptValueInterface { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestSerializedScriptValueInterfaceClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_serialized_script_value_interface_get_type (void); + +WEBKIT_API WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_value(WebKitDOMTestSerializedScriptValueInterface* self); + +G_END_DECLS + +#endif /* WebKitDOMTestSerializedScriptValueInterface_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterfacePrivate.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterfacePrivate.h new file mode 100644 index 0000000..82e79a2 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterfacePrivate.h @@ -0,0 +1,39 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WEB_KIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_PRIVATE_H +#define WEB_KIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_PRIVATE_H + +#include <glib-object.h> +#include <webkit/WebKitDOMObject.h> +#include "TestSerializedScriptValueInterface.h" +namespace WebKit { + WebKitDOMTestSerializedScriptValueInterface * + wrapTestSerializedScriptValueInterface(WebCore::TestSerializedScriptValueInterface *coreObject); + + WebCore::TestSerializedScriptValueInterface * + core(WebKitDOMTestSerializedScriptValueInterface *request); + + WebKitDOMTestSerializedScriptValueInterface* + kit(WebCore::TestSerializedScriptValueInterface* node); + +} // namespace WebKit + +#endif /* WEB_KIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE_PRIVATE_H */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 684f587..8d519f5 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -68,11 +68,10 @@ public: virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; @@ -80,12 +79,13 @@ protected: virtual JSC::ConstructType getConstructData(JSC::ConstructData&); }; -const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", 0, &JSTestInterfaceConstructorTable, 0 }; +const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &DOMConstructorObject::s_info, &JSTestInterfaceConstructorTable, 0 }; JSTestInterfaceConstructor::JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSTestInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -126,24 +126,20 @@ static const HashTableValue JSTestInterfacePrototypeTableValues[1] = #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSTestInterfacePrototypeTable = { 1, 0, JSTestInterfacePrototypeTableValues, 0 }; -const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", 0, &JSTestInterfacePrototypeTable, 0 }; +const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestInterfacePrototypeTable, 0 }; JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype<JSTestInterface>(exec, globalObject); } -const ClassInfo JSTestInterface::s_info = { "TestInterface", 0, &JSTestInterfaceTable, 0 }; +const ClassInfo JSTestInterface::s_info = { "TestInterface", &DOMObjectWithGlobalPointer::s_info, &JSTestInterfaceTable, 0 }; JSTestInterface::JSTestInterface(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl) : DOMObjectWithGlobalPointer(structure, globalObject) , m_impl(impl) { -} - -JSTestInterface::~JSTestInterface() -{ - forgetDOMObject(this, impl()); + ASSERT(inherits(&s_info)); } JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index 09d7d7c..2cabc23 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -36,16 +36,14 @@ class JSTestInterface : public DOMObjectWithGlobalPointer { typedef DOMObjectWithGlobalPointer Base; public: JSTestInterface(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestInterface>); - virtual ~JSTestInterface(); static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); @@ -64,11 +62,10 @@ class JSTestInterfacePrototype : public JSC::JSObjectWithGlobalObject { typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } JSTestInterfacePrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } protected: diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp index f1c09b5..0e5edeb 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp @@ -69,22 +69,22 @@ public: virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; -const ClassInfo JSTestMediaQueryListListenerConstructor::s_info = { "TestMediaQueryListListenerConstructor", 0, &JSTestMediaQueryListListenerConstructorTable, 0 }; +const ClassInfo JSTestMediaQueryListListenerConstructor::s_info = { "TestMediaQueryListListenerConstructor", &DOMConstructorObject::s_info, &JSTestMediaQueryListListenerConstructorTable, 0 }; JSTestMediaQueryListListenerConstructor::JSTestMediaQueryListListenerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestMediaQueryListListenerConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSTestMediaQueryListListenerPrototype::self(exec, globalObject), DontDelete | ReadOnly); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestMediaQueryListListenerPrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSTestMediaQueryListListenerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -112,7 +112,7 @@ static const HashTableValue JSTestMediaQueryListListenerPrototypeTableValues[2] #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerPrototypeTable = { 2, 1, JSTestMediaQueryListListenerPrototypeTableValues, 0 }; -const ClassInfo JSTestMediaQueryListListenerPrototype::s_info = { "TestMediaQueryListListenerPrototype", 0, &JSTestMediaQueryListListenerPrototypeTable, 0 }; +const ClassInfo JSTestMediaQueryListListenerPrototype::s_info = { "TestMediaQueryListListenerPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestMediaQueryListListenerPrototypeTable, 0 }; JSObject* JSTestMediaQueryListListenerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { @@ -129,17 +129,13 @@ bool JSTestMediaQueryListListenerPrototype::getOwnPropertyDescriptor(ExecState* return getStaticFunctionDescriptor<JSObject>(exec, &JSTestMediaQueryListListenerPrototypeTable, this, propertyName, descriptor); } -const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", 0, &JSTestMediaQueryListListenerTable, 0 }; +const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", &DOMObjectWithGlobalPointer::s_info, &JSTestMediaQueryListListenerTable, 0 }; JSTestMediaQueryListListener::JSTestMediaQueryListListener(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestMediaQueryListListener> impl) : DOMObjectWithGlobalPointer(structure, globalObject) , m_impl(impl) { -} - -JSTestMediaQueryListListener::~JSTestMediaQueryListListener() -{ - forgetDOMObject(this, impl()); + ASSERT(inherits(&s_info)); } JSObject* JSTestMediaQueryListListener::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -175,7 +171,7 @@ EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod return throwVMTypeError(exec); JSTestMediaQueryListListener* castedThis = static_cast<JSTestMediaQueryListListener*>(asObject(thisValue)); TestMediaQueryListListener* imp = static_cast<TestMediaQueryListListener*>(castedThis->impl()); - RefPtr<MediaQueryListListener> listener = MediaQueryListListener::create(exec->argument(0)); + RefPtr<MediaQueryListListener> listener(MediaQueryListListener::create(ScriptValue(exec->globalData(), exec->argument(0)))); if (exec->hadException()) return JSValue::encode(jsUndefined()); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h index 1863703..a9f8606 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h @@ -34,16 +34,14 @@ class JSTestMediaQueryListListener : public DOMObjectWithGlobalPointer { typedef DOMObjectWithGlobalPointer Base; public: JSTestMediaQueryListListener(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestMediaQueryListListener>); - virtual ~JSTestMediaQueryListListener(); static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); @@ -62,13 +60,12 @@ class JSTestMediaQueryListListenerPrototype : public JSC::JSObjectWithGlobalObje typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } JSTestMediaQueryListListenerPrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } protected: diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 9d446a2..fd2f4d9 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -148,22 +148,22 @@ public: virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; -const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", 0, &JSTestObjConstructorTable, 0 }; +const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", &DOMConstructorObject::s_info, &JSTestObjConstructorTable, 0 }; JSTestObjConstructor::JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSTestObjConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -237,7 +237,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[48] = #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 136, 127, JSTestObjPrototypeTableValues, 0 }; -const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; +const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestObjPrototypeTable, 0 }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { @@ -254,17 +254,13 @@ bool JSTestObjPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identif return getStaticPropertyDescriptor<JSTestObjPrototype, JSObject>(exec, &JSTestObjPrototypeTable, this, propertyName, descriptor); } -const ClassInfo JSTestObj::s_info = { "TestObj", 0, &JSTestObjTable, 0 }; +const ClassInfo JSTestObj::s_info = { "TestObj", &DOMObjectWithGlobalPointer::s_info, &JSTestObjTable, 0 }; JSTestObj::JSTestObj(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestObj> impl) : DOMObjectWithGlobalPointer(structure, globalObject) , m_impl(impl) { -} - -JSTestObj::~JSTestObj() -{ - forgetDOMObject(this, impl()); + ASSERT(inherits(&s_info)); } JSObject* JSTestObj::createPrototype(ExecState* exec, JSGlobalObject* globalObject) @@ -852,13 +848,13 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg = ustringToString(exec->argument(1).toString(exec)); + const String& strArg(ustringToString(exec->argument(1).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - TestObj* objArg = toTestObj(exec->argument(2)); + TestObj* objArg(toTestObj(exec->argument(2))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -886,13 +882,13 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg = ustringToString(exec->argument(1).toString(exec)); + const String& strArg(ustringToString(exec->argument(1).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - TestObj* objArg = toTestObj(exec->argument(2)); + TestObj* objArg(toTestObj(exec->argument(2))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -921,13 +917,13 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg = ustringToString(exec->argument(1).toString(exec)); + const String& strArg(ustringToString(exec->argument(1).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - TestObj* objArg = toTestObj(exec->argument(2)); + TestObj* objArg(toTestObj(exec->argument(2))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -945,10 +941,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) return JSValue::encode(jsUndefined()); - const String& strArg = ustringToString(exec->argument(0).toString(exec)); + const String& strArg(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - TestObj* objArg = toTestObj(exec->argument(1)); + TestObj* objArg(toTestObj(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -967,10 +963,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs if (exec->argumentCount() < 2) return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); ExceptionCode ec = 0; - const String& strArg = ustringToString(exec->argument(0).toString(exec)); + const String& strArg(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - TestObj* objArg = toTestObj(exec->argument(1)); + TestObj* objArg(toTestObj(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -987,7 +983,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); + RefPtr<SerializedScriptValue> serializedArg(SerializedScriptValue::create(exec, exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1002,7 +998,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(ExecState* exec) return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0)); + RefPtr<IDBKey> key(createIDBKeyFromValue(exec, exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1017,7 +1013,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(ExecState* return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - OptionsObject* oo = toOptionsObject(exec->argument(0)); + OptionsObject* oo(toOptionsObject(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1027,7 +1023,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(ExecState* return JSValue::encode(jsUndefined()); } - OptionsObject* ooo = toOptionsObject(exec->argument(1)); + OptionsObject* ooo(toOptionsObject(exec->argument(1))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1078,7 +1074,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); - log* intArg = tolog(exec->argument(0)); + log* intArg(tolog(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1140,7 +1136,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(Ex Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return JSValue::encode(jsUndefined()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1158,7 +1154,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOption Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return JSValue::encode(jsUndefined()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1168,7 +1164,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOption return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(1).toInt32(exec); + int optionalArg(exec->argument(1).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1186,7 +1182,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return JSValue::encode(jsUndefined()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1204,7 +1200,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return JSValue::encode(jsUndefined()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1214,7 +1210,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(1).toInt32(exec); + int optionalArg(exec->argument(1).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1309,7 +1305,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(Exe return JSValue::encode(jsUndefined()); } - int opt = exec->argument(0).toInt32(exec); + int opt(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1324,7 +1320,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int nonOpt = exec->argument(0).toInt32(exec); + int nonOpt(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1334,7 +1330,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return JSValue::encode(jsUndefined()); } - int opt = exec->argument(1).toInt32(exec); + int opt(exec->argument(1).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1349,7 +1345,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int nonOpt = exec->argument(0).toInt32(exec); + int nonOpt(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1359,10 +1355,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return JSValue::encode(jsUndefined()); } - int opt1 = exec->argument(1).toInt32(exec); + int opt1(exec->argument(1).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - int opt2 = exec->argument(2).toInt32(exec); + int opt2(exec->argument(2).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1394,7 +1390,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgA return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int nonCallback = exec->argument(0).toInt32(exec); + int nonCallback(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) { @@ -1434,10 +1430,10 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1( return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - TestObj* objArg = toTestObj(exec->argument(0)); + TestObj* objArg(toTestObj(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg = ustringToString(exec->argument(1).toString(exec)); + const String& strArg(ustringToString(exec->argument(1).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1452,7 +1448,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2( return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - TestObj* objArg = toTestObj(exec->argument(0)); + TestObj* objArg(toTestObj(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1462,7 +1458,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2( return JSValue::encode(jsUndefined()); } - int intArg = exec->argument(1).toInt32(exec); + int intArg(exec->argument(1).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1477,7 +1473,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3( return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - const String& strArg = ustringToString(exec->argument(0).toString(exec)); + const String& strArg(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1492,7 +1488,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4( return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = exec->argument(0).toInt32(exec); + int intArg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -1559,7 +1555,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E return JSValue::encode(result); } - int arg = exec->argument(0).toInt32(exec); + int arg(exec->argument(0).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index b8713ae..7e21168 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -34,17 +34,15 @@ class JSTestObj : public DOMObjectWithGlobalPointer { typedef DOMObjectWithGlobalPointer Base; public: JSTestObj(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestObj>); - virtual ~JSTestObj(); static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); @@ -71,13 +69,12 @@ class JSTestObjPrototype : public JSC::JSObjectWithGlobalObject { typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } static const JSC::ClassInfo s_info; virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) { - return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } JSTestObjPrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } protected: diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp new file mode 100644 index 0000000..5dd6c44 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp @@ -0,0 +1,177 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include "JSTestSerializedScriptValueInterface.h" + +#include "SerializedScriptValue.h" +#include "TestSerializedScriptValueInterface.h" +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestSerializedScriptValueInterface); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestSerializedScriptValueInterfaceTableValues[3] = +{ + { "value", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceValue), (intptr_t)0 THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestSerializedScriptValueInterfaceTable = { 4, 3, JSTestSerializedScriptValueInterfaceTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestSerializedScriptValueInterfaceConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestSerializedScriptValueInterfaceConstructorTable = { 1, 0, JSTestSerializedScriptValueInterfaceConstructorTableValues, 0 }; +class JSTestSerializedScriptValueInterfaceConstructor : public DOMConstructorObject { +public: + JSTestSerializedScriptValueInterfaceConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSTestSerializedScriptValueInterfaceConstructor::s_info = { "TestSerializedScriptValueInterfaceConstructor", &DOMConstructorObject::s_info, &JSTestSerializedScriptValueInterfaceConstructorTable, 0 }; + +JSTestSerializedScriptValueInterfaceConstructor::JSTestSerializedScriptValueInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTestSerializedScriptValueInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestSerializedScriptValueInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTestSerializedScriptValueInterfaceConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestSerializedScriptValueInterfaceConstructor, DOMObject>(exec, &JSTestSerializedScriptValueInterfaceConstructorTable, this, propertyName, slot); +} + +bool JSTestSerializedScriptValueInterfaceConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestSerializedScriptValueInterfaceConstructor, DOMObject>(exec, &JSTestSerializedScriptValueInterfaceConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTestSerializedScriptValueInterfacePrototypeTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTestSerializedScriptValueInterfacePrototypeTable = { 1, 0, JSTestSerializedScriptValueInterfacePrototypeTableValues, 0 }; +const ClassInfo JSTestSerializedScriptValueInterfacePrototype::s_info = { "TestSerializedScriptValueInterfacePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestSerializedScriptValueInterfacePrototypeTable, 0 }; + +JSObject* JSTestSerializedScriptValueInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestSerializedScriptValueInterface>(exec, globalObject); +} + +const ClassInfo JSTestSerializedScriptValueInterface::s_info = { "TestSerializedScriptValueInterface", &DOMObjectWithGlobalPointer::s_info, &JSTestSerializedScriptValueInterfaceTable, 0 }; + +JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestSerializedScriptValueInterface> impl) + : DOMObjectWithGlobalPointer(structure, globalObject) + , m_impl(impl) +{ + ASSERT(inherits(&s_info)); +} + +JSObject* JSTestSerializedScriptValueInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSTestSerializedScriptValueInterfacePrototype(globalObject, JSTestSerializedScriptValueInterfacePrototype::createStructure(globalObject->objectPrototype())); +} + +bool JSTestSerializedScriptValueInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestSerializedScriptValueInterface, Base>(exec, &JSTestSerializedScriptValueInterfaceTable, this, propertyName, slot); +} + +bool JSTestSerializedScriptValueInterface::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestSerializedScriptValueInterface, Base>(exec, &JSTestSerializedScriptValueInterfaceTable, this, propertyName, descriptor); +} + +JSValue jsTestSerializedScriptValueInterfaceValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestSerializedScriptValueInterface* imp = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + JSValue result = imp->value() ? imp->value()->deserialize(exec, castedThis->globalObject()) : jsNull(); + return result; +} + +JSValue jsTestSerializedScriptValueInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestSerializedScriptValueInterface* domObject = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); + return JSTestSerializedScriptValueInterface::getConstructor(exec, domObject->globalObject()); +} + +JSValue JSTestSerializedScriptValueInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestSerializedScriptValueInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestSerializedScriptValueInterface* object) +{ + return getDOMObjectWrapper<JSTestSerializedScriptValueInterface>(exec, globalObject, object); +} +TestSerializedScriptValueInterface* toTestSerializedScriptValueInterface(JSC::JSValue value) +{ + return value.inherits(&JSTestSerializedScriptValueInterface::s_info) ? static_cast<JSTestSerializedScriptValueInterface*>(asObject(value))->impl() : 0; +} + +} + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h new file mode 100644 index 0000000..175fb12 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h @@ -0,0 +1,84 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef JSTestSerializedScriptValueInterface_h +#define JSTestSerializedScriptValueInterface_h + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include "JSDOMBinding.h" +#include <runtime/JSGlobalObject.h> +#include <runtime/JSObjectWithGlobalObject.h> +#include <runtime/ObjectPrototype.h> + +namespace WebCore { + +class TestSerializedScriptValueInterface; + +class JSTestSerializedScriptValueInterface : public DOMObjectWithGlobalPointer { + typedef DOMObjectWithGlobalPointer Base; +public: + JSTestSerializedScriptValueInterface(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<TestSerializedScriptValueInterface>); + static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static const JSC::ClassInfo s_info; + + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + } + + static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + TestSerializedScriptValueInterface* impl() const { return m_impl.get(); } + +private: + RefPtr<TestSerializedScriptValueInterface> m_impl; +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; +}; + +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestSerializedScriptValueInterface*); +TestSerializedScriptValueInterface* toTestSerializedScriptValueInterface(JSC::JSValue); + +class JSTestSerializedScriptValueInterfacePrototype : public JSC::JSObjectWithGlobalObject { + typedef JSC::JSObjectWithGlobalObject Base; +public: + static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); + static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + } + JSTestSerializedScriptValueInterfacePrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } +protected: + static const unsigned StructureFlags = Base::StructureFlags; +}; + +// Attributes + +JSC::JSValue jsTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestSerializedScriptValueInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); + +} // namespace WebCore + +#endif // ENABLE(Condition1) || ENABLE(Condition2) + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h new file mode 100644 index 0000000..ff98133 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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. + */ + +#import <WebCore/DOMObject.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +@class NSString; + +@interface DOMTestSerializedScriptValueInterface : DOMObject +- (NSString *)value; +@end + +#endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm new file mode 100644 index 0000000..1a0fc7b --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm @@ -0,0 +1,99 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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. + */ + +#import "config.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#import "DOMInternal.h" + +#import "DOMTestSerializedScriptValueInterface.h" + +#import "DOMBlobInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMEventInternal.h" +#import "DOMNodeInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMTestSerializedScriptValueInterfaceInternal.h" +#import "ExceptionHandlers.h" +#import "JSMainThreadExecState.h" +#import "SerializedScriptValue.h" +#import "TestSerializedScriptValueInterface.h" +#import "ThreadCheck.h" +#import "WebCoreObjCExtras.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/GetPtr.h> + +#define IMPL reinterpret_cast<WebCore::TestSerializedScriptValueInterface*>(_internal) + +@implementation DOMTestSerializedScriptValueInterface + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestSerializedScriptValueInterface class], self)) + return; + + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (NSString *)value +{ + WebCore::JSMainThreadNullState state; + return IMPL->value()->toString(); +} + +@end + +WebCore::TestSerializedScriptValueInterface* core(DOMTestSerializedScriptValueInterface *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::TestSerializedScriptValueInterface*>(wrapper->_internal) : 0; +} + +DOMTestSerializedScriptValueInterface *kit(WebCore::TestSerializedScriptValueInterface* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + if (!value) + return nil; + if (DOMTestSerializedScriptValueInterface *wrapper = getDOMWrapper(value)) + return [[wrapper retain] autorelease]; + DOMTestSerializedScriptValueInterface *wrapper = [[DOMTestSerializedScriptValueInterface alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); + value->ref(); + addDOMWrapper(wrapper, value); + return [wrapper autorelease]; +} + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterfaceInternal.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterfaceInternal.h new file mode 100644 index 0000000..39c40c5 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterfaceInternal.h @@ -0,0 +1,38 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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. + */ + +#import <WebCore/DOMTestSerializedScriptValueInterface.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +namespace WebCore { + class TestSerializedScriptValueInterface; +} + +WebCore::TestSerializedScriptValueInterface* core(DOMTestSerializedScriptValueInterface *); +DOMTestSerializedScriptValueInterface *kit(WebCore::TestSerializedScriptValueInterface*); + +#endif diff --git a/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl b/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl new file mode 100644 index 0000000..6cd25bb --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary formstrArg, 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 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 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. + */ + +// This IDL file is for testing the bindings code generator and for tracking +// changes in its ouput. +module test { + interface [ + Conditional=Condition1|Condition2, + ] TestSerializedScriptValueInterface { + // The case of a single SerializedScriptValue attribute is a bit of a + // special case. + readonly attribute SerializedScriptValue value; + }; +} diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index 267f1f0..4c40d98 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -29,6 +29,7 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include <wtf/UnusedParam.h> namespace WebCore { @@ -50,6 +51,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 0, 0, 0, 0); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. desc->SetCallHandler(V8TestInterface::constructorCallback); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h index c1e319b..b9ac143 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -26,7 +26,7 @@ #include "TestInterface.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" -#include "wtf/text/StringHash.h" +#include <wtf/text/StringHash.h> #include <v8.h> #include <wtf/HashMap.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h index 908d9cd..7b1db84 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h @@ -24,7 +24,7 @@ #include "TestMediaQueryListListener.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" -#include "wtf/text/StringHash.h" +#include <wtf/text/StringHash.h> #include <v8.h> #include <wtf/HashMap.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h index 1e60488..4edd2e5 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h @@ -24,7 +24,7 @@ #include "TestObj.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" -#include "wtf/text/StringHash.h" +#include <wtf/text/StringHash.h> #include <v8.h> #include <wtf/HashMap.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp new file mode 100644 index 0000000..fef8dbd --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -0,0 +1,97 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "config.h" +#include "V8TestSerializedScriptValueInterface.h" + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#include "RuntimeEnabledFeatures.h" +#include "SerializedScriptValue.h" +#include "V8Binding.h" +#include "V8BindingState.h" +#include "V8DOMWrapper.h" +#include "V8IsolatedContext.h" +#include "V8Proxy.h" +#include <wtf/UnusedParam.h> + +namespace WebCore { + +WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0 }; + +namespace TestSerializedScriptValueInterfaceInternal { + +template <typename T> void V8_USE(T) { } + +} // namespace TestSerializedScriptValueInterfaceInternal + +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc) +{ + v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestSerializedScriptValueInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestSerializedScriptValueInterface::internalFieldCount, + 0, 0, + 0, 0); + UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. + + + // Custom toString template + desc->Set(getToStringName(), getToStringTemplate()); + return desc; +} + +v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetRawTemplate() +{ + static v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterfaceRawCache = createRawTemplate(); + return V8TestSerializedScriptValueInterfaceRawCache; +} + +v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetTemplate() +{ + static v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterfaceCache = ConfigureV8TestSerializedScriptValueInterfaceTemplate(GetRawTemplate()); + return V8TestSerializedScriptValueInterfaceCache; +} + +bool V8TestSerializedScriptValueInterface::HasInstance(v8::Handle<v8::Value> value) +{ + return GetRawTemplate()->HasInstance(value); +} + + +v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(TestSerializedScriptValueInterface* impl) +{ + v8::Handle<v8::Object> wrapper; + V8Proxy* proxy = 0; + wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); + if (wrapper.IsEmpty()) + return wrapper; + + impl->ref(); + SerializedScriptValue::deserializeAndSetProperty(wrapper, "value", static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), impl->value()); + getDOMObjectMap().set(impl, v8::Persistent<v8::Object>::New(wrapper)); + return wrapper; +} + +void V8TestSerializedScriptValueInterface::derefObject(void* object) +{ + static_cast<TestSerializedScriptValueInterface*>(object)->deref(); +} + +} // namespace WebCore + +#endif // ENABLE(Condition1) || ENABLE(Condition2) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h new file mode 100644 index 0000000..5508c99 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h @@ -0,0 +1,76 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#if ENABLE(Condition1) || ENABLE(Condition2) + +#ifndef V8TestSerializedScriptValueInterface_h +#define V8TestSerializedScriptValueInterface_h + +#include "TestSerializedScriptValueInterface.h" +#include "V8DOMWrapper.h" +#include "WrapperTypeInfo.h" +#include <wtf/text/StringHash.h> +#include <v8.h> +#include <wtf/HashMap.h> + +namespace WebCore { + +class V8TestSerializedScriptValueInterface { + +public: + static bool HasInstance(v8::Handle<v8::Value> value); + static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); + static v8::Persistent<v8::FunctionTemplate> GetTemplate(); + static TestSerializedScriptValueInterface* toNative(v8::Handle<v8::Object> object) + { + return reinterpret_cast<TestSerializedScriptValueInterface*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); + } + inline static v8::Handle<v8::Object> wrap(TestSerializedScriptValueInterface*); + static void derefObject(void*); + static WrapperTypeInfo info; + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; +private: + static v8::Handle<v8::Object> wrapSlow(TestSerializedScriptValueInterface*); +}; + + +v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrap(TestSerializedScriptValueInterface* impl) +{ + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (!wrapper.IsEmpty()) + return wrapper; + return V8TestSerializedScriptValueInterface::wrapSlow(impl); +} + +inline v8::Handle<v8::Value> toV8(TestSerializedScriptValueInterface* impl) +{ + if (!impl) + return v8::Null(); + return V8TestSerializedScriptValueInterface::wrap(impl); +} +inline v8::Handle<v8::Value> toV8(PassRefPtr< TestSerializedScriptValueInterface > impl) +{ + return toV8(impl.get()); +} +} + +#endif // V8TestSerializedScriptValueInterface_h +#endif // ENABLE(Condition1) || ENABLE(Condition2) + |