diff options
Diffstat (limited to 'WebCore/bindings')
28 files changed, 122 insertions, 265 deletions
diff --git a/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp b/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp deleted file mode 100644 index 8ca7f1f..0000000 --- a/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2010, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEB_AUDIO) - -#include "AudioBufferSourceNode.h" - -#include "AudioBuffer.h" -#include "JSAudioBuffer.h" -#include "JSAudioBufferSourceNode.h" - -using namespace JSC; - -namespace WebCore { - -void JSAudioBufferSourceNode::setBuffer(ExecState*, JSValue value) -{ - AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(impl()); - imp->setBuffer(toAudioBuffer(value)); -} - -} // namespace WebCore - -#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/bindings/js/JSCSSRuleCustom.cpp b/WebCore/bindings/js/JSCSSRuleCustom.cpp index 4d226d0..20b3ab4 100644 --- a/WebCore/bindings/js/JSCSSRuleCustom.cpp +++ b/WebCore/bindings/js/JSCSSRuleCustom.cpp @@ -47,17 +47,6 @@ using namespace JSC; namespace WebCore { -void JSCSSRule::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - - if (CSSStyleSheet* parentStyleSheet = impl()->parentStyleSheet()) - markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentStyleSheet); - - if (CSSRule* parentRule = impl()->parentRule()) - markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentRule); -} - JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule) { if (!rule) diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 1a448ee..458ad5b 100644 --- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -47,9 +47,6 @@ void JSCSSStyleDeclaration::markChildren(MarkStack& markStack) CSSStyleDeclaration* declaration = impl(); JSGlobalData& globalData = *Heap::heap(this)->globalData(); - if (CSSRule* parentRule = declaration->parentRule()) - markDOMObjectWrapper(markStack, globalData, parentRule); - if (declaration->isMutableStyleDeclaration()) { CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration); CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end(); diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp index 6a4fb17..6df88f6 100644 --- a/WebCore/bindings/js/JSConsoleCustom.cpp +++ b/WebCore/bindings/js/JSConsoleCustom.cpp @@ -57,23 +57,23 @@ JSValue JSConsole::profiles(ExecState* exec) const JSValue JSConsole::profile(ExecState* exec) { - RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1)); const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); - impl()->profile(title, exec, callStack); + impl()->profile(title, exec, callStack.release()); return jsUndefined(); } JSValue JSConsole::profileEnd(ExecState* exec) { - RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1)); const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); - impl()->profileEnd(title, exec, callStack); + impl()->profileEnd(title, exec, callStack.release()); return jsUndefined(); } diff --git a/WebCore/bindings/js/JSConvolverNodeCustom.cpp b/WebCore/bindings/js/JSConvolverNodeCustom.cpp deleted file mode 100644 index db7e244..0000000 --- a/WebCore/bindings/js/JSConvolverNodeCustom.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2010, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEB_AUDIO) - -#include "ConvolverNode.h" - -#include "AudioBuffer.h" -#include "JSAudioBuffer.h" -#include "JSConvolverNode.h" - -using namespace JSC; - -namespace WebCore { - -void JSConvolverNode::setBuffer(ExecState*, JSValue value) -{ - ConvolverNode* imp = static_cast<ConvolverNode*>(impl()); - imp->setBuffer(toAudioBuffer(value)); -} - -} // namespace WebCore - -#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp b/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp deleted file mode 100644 index 9acabf3..0000000 --- a/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2010, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEB_AUDIO) - -#include "JavaScriptAudioNode.h" - -#include "JSJavaScriptAudioNode.h" - -using namespace JSC; - -namespace WebCore { - -void JSJavaScriptAudioNode::markChildren(MarkStack& markStack) -{ - Base::markChildren(markStack); - static_cast<JavaScriptAudioNode*>(impl())->markJSEventListeners(markStack); -} - -} // namespace WebCore - -#endif // ENABLE(WEB_AUDIO) diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 7cf8207..b237aac 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -124,10 +124,6 @@ JSValue JSXMLHttpRequest::send(ExecState* exec) impl()->send(toBlob(val), ec); else if (val.inherits(&JSDOMFormData::s_info)) impl()->send(toDOMFormData(val), ec); -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - else if (val.inherits(&JSArrayBuffer::s_info)) - impl()->send(toArrayBuffer(val), ec); -#endif else impl()->send(ustringToString(val.toString(exec)), ec); } diff --git a/WebCore/bindings/js/ScriptCallStackFactory.cpp b/WebCore/bindings/js/ScriptCallStackFactory.cpp index 9a64ffc..25fabdd 100644 --- a/WebCore/bindings/js/ScriptCallStackFactory.cpp +++ b/WebCore/bindings/js/ScriptCallStackFactory.cpp @@ -48,7 +48,7 @@ using namespace JSC; namespace WebCore { -PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize) +PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize) { Vector<ScriptCallFrame> frames; CallFrame* callFrame = exec; @@ -75,16 +75,16 @@ PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t m break; callFrame = callFrame->callerFrame(); } - return ScriptCallStack::create(frames); + return new ScriptCallStack(frames); } -PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount) +PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount) { Vector<ScriptValue> arguments; size_t argumentCount = exec->argumentCount(); for (size_t i = skipArgumentCount; i < argumentCount; ++i) arguments.append(ScriptValue(exec->argument(i))); - return ScriptArguments::create(exec, arguments); + return new ScriptArguments(exec, arguments); } bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&) diff --git a/WebCore/bindings/js/ScriptCallStackFactory.h b/WebCore/bindings/js/ScriptCallStackFactory.h index 9fbfc78..744d88d 100644 --- a/WebCore/bindings/js/ScriptCallStackFactory.h +++ b/WebCore/bindings/js/ScriptCallStackFactory.h @@ -31,7 +31,7 @@ #ifndef ScriptCallStackFactory_h #define ScriptCallStackFactory_h -#include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> namespace JSC { class ExecState; @@ -42,8 +42,8 @@ namespace WebCore { class ScriptArguments; class ScriptCallStack; -PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize); -PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount); +PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize); +PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount); } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptHeapSnapshot.h b/WebCore/bindings/js/ScriptHeapSnapshot.h index 4c3d915..a9432ad 100644 --- a/WebCore/bindings/js/ScriptHeapSnapshot.h +++ b/WebCore/bindings/js/ScriptHeapSnapshot.h @@ -38,22 +38,17 @@ namespace WebCore { class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> { public: - class OutputStream { - public: - virtual ~OutputStream() { } - virtual void Write(const String& chunk) = 0; - virtual void Close() = 0; - }; - - virtual ~ScriptHeapSnapshot() { } + virtual ~ScriptHeapSnapshot() {} String title() const { return ""; } unsigned int uid() const { return 0; } - void writeJSON(OutputStream*) { } +#if ENABLE(INSPECTOR) + PassRefPtr<InspectorObject> buildInspectorObjectForHead() const { return InspectorObject::create(); } +#endif private: - ScriptHeapSnapshot() { } + ScriptHeapSnapshot() {} }; } // namespace WebCore diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index 9a9e9d7..42f3f1c 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -308,8 +308,8 @@ sub AvoidInclusionOfType my $object = shift; my $type = shift; - # Special case: SVGPoint.h / SVGNumber.h do not exist. - return 1 if $type eq "SVGPoint" or $type eq "SVGNumber"; + # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h do not exist. + return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber"; return 0; } diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm index 9b3f21e..f9dd5f2 100644 --- a/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -25,6 +25,8 @@ package CodeGeneratorCPP; +use File::stat; + # Global Variables my $module = ""; my $outputDir = ""; diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 1ad55e4..95cdf30 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -25,6 +25,8 @@ package CodeGeneratorJS; +use File::stat; + my $module = ""; my $outputDir = ""; my $writeDependencies = 0; @@ -1906,9 +1908,9 @@ sub GenerateImplementation my $hasOptionalArguments = 0; if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - push(@implContent, " RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n"); + push(@implContent, " OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n"); push(@implContent, " size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;\n"); - push(@implContent, " RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n"); + push(@implContent, " OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n"); $implIncludes{"ScriptArguments.h"} = 1; $implIncludes{"ScriptCallStack.h"} = 1; $implIncludes{"ScriptCallStackFactory.h"} = 1; @@ -2300,7 +2302,7 @@ sub GenerateImplementationFunctionCall() if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { $functionString .= ", " if $paramIndex; $paramIndex += 2; - $functionString .= "scriptArguments, callStack"; + $functionString .= "scriptArguments.release(), callStack.release()"; } if (@{$function->raisesExceptions}) { diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 6ccebf9..6fb2270 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -26,6 +26,8 @@ package CodeGeneratorObjC; +use File::stat; + # Global Variables my $module = ""; my $outputDir = ""; @@ -1302,7 +1304,6 @@ sub GenerateImplementation my $type = $attribute->signature->type; if ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) { my $idlTypeWithNamespace = GetSVGTypeWithNamespace($type); - $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type); if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and not defined $attribute->signature->extendedAttributes->{"Immutable"}) { $idlTypeWithNamespace =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassNameWithNamespace, /; $implIncludes{"SVGStaticPropertyTearOff.h"} = 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 7488d50..922da15 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1,3 +1,4 @@ + # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> @@ -26,6 +27,7 @@ package CodeGeneratorV8; +use File::stat; use Digest::MD5; my $module = ""; @@ -38,7 +40,6 @@ my @implFixedHeader = (); my @implContent = (); my @implContentDecls = (); my %implIncludes = (); -my %headerIncludes = (); my @allParents = (); @@ -204,11 +205,8 @@ sub GetSVGPropertyTypes $implIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1; } elsif ($svgNativeType =~ /SVGTransformListPropertyTearOff/) { $svgListPropertyType = $svgWrappedNativeType; - $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1; - $headerIncludes{"SVGTransformListPropertyTearOff.h"} = 1; - } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { - $svgListPropertyType = $svgWrappedNativeType; - $headerIncludes{"SVGPathSegListPropertyTearOff.h"} = 1; + $implIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1; + $implIncludes{"SVGTransformListPropertyTearOff.h"} = 1; } if ($svgPropertyType) { @@ -236,6 +234,7 @@ sub GenerateHeader # - Add default header template push(@headerContent, GenerateHeaderContentHeader($dataNode)); + my %headerInclues = (); $headerIncludes{"wtf/text/StringHash.h"} = 1; $headerIncludes{"WrapperTypeInfo.h"} = 1; $headerIncludes{"V8DOMWrapper.h"} = 1; @@ -251,7 +250,7 @@ sub GenerateHeader push(@headerContent, "#include <v8.h>\n"); push(@headerContent, "#include <wtf/HashMap.h>\n"); - + push(@headerContent, "\nnamespace WebCore {\n"); push(@headerContent, "\ntemplate<typename PropertyType> class SVGPropertyTearOff;\n") if $svgPropertyType; if ($svgNativeType) { @@ -1266,9 +1265,9 @@ END if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { push(@implContentDecls, <<END); - RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters)); + OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); if (!callStack) return v8::Undefined(); END @@ -2652,7 +2651,7 @@ sub GenerateFunctionCallString() if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { $functionString .= ", " if $index; - $functionString .= "scriptArguments, callStack"; + $functionString .= "scriptArguments.release(), callStack.release()"; $index += 2; } @@ -2904,6 +2903,10 @@ sub JSValueToNative return "V8DOMWrapper::wrapNativeNodeFilter($value)"; } + if ($type eq "SVGRect") { + $implIncludes{"FloatRect.h"} = 1; + } + if ($type eq "MediaQueryListListener") { $implIncludes{"MediaQueryListListener.h"} = 1; return "MediaQueryListListener::create(" . $value . ")"; @@ -3085,6 +3088,7 @@ sub ReturnNativeToJSValue my $indent = shift; my $type = GetTypeFromSignature($signature); + return "return v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp"; return "return v8Boolean($value)" if $type eq "boolean"; return "return v8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined() @@ -3096,7 +3100,7 @@ sub ReturnNativeToJSValue return "return v8DateOrNull($value)" if $type eq "Date"; # long long and unsigned long long are not representable in ECMAScript. - return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp"; + return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long"; return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; return "return $value.v8Value()" if $nativeType eq "ScriptValue"; diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 44efde1..d8bf67e 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -1057,14 +1057,14 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); + OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); log* intArg = tolog(exec->argument(0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - imp->customArgsAndException(intArg, scriptArguments, callStack, ec); + imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index d4fdff5..e06d3f2 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -764,13 +764,13 @@ static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& TestObj* imp = V8TestObj::toNative(args.Holder()); ExceptionCode ec = 0; { - RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); + OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); if (!callStack) return v8::Undefined(); EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); - imp->customArgsAndException(intArg, scriptArguments, callStack, ec); + imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec); if (UNLIKELY(ec)) goto fail; return v8::Handle<v8::Value>(); diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.cpp b/WebCore/bindings/v8/ScriptCallStackFactory.cpp index 5d4e146..62fbeef 100644 --- a/WebCore/bindings/v8/ScriptCallStackFactory.cpp +++ b/WebCore/bindings/v8/ScriptCallStackFactory.cpp @@ -78,17 +78,17 @@ static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle< } } -PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize) +PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize) { v8::HandleScope scope; v8::Context::Scope contextScope(context); Vector<ScriptCallFrame> scriptCallFrames; toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize); - return ScriptCallStack::create(scriptCallFrames); + return new ScriptCallStack(scriptCallFrames); } -PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize) +PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize) { v8::HandleScope scope; v8::Local<v8::Context> context = v8::Context::GetCurrent(); @@ -98,7 +98,7 @@ PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize) return createScriptCallStack(context, stackTrace, maxStackSize); } -PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount) +PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount) { v8::HandleScope scope; v8::Local<v8::Context> context = v8::Context::GetCurrent(); @@ -108,7 +108,7 @@ PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8argumen for (int i = skipArgumentCount; i < v8arguments.Length(); ++i) arguments.append(ScriptValue(v8arguments[i])); - return ScriptArguments::create(state, arguments); + return new ScriptArguments(state, arguments); } bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace) diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.h b/WebCore/bindings/v8/ScriptCallStackFactory.h index 66e44f5..613af7b 100644 --- a/WebCore/bindings/v8/ScriptCallStackFactory.h +++ b/WebCore/bindings/v8/ScriptCallStackFactory.h @@ -32,12 +32,10 @@ #define ScriptCallStackFactory_h #include <v8.h> -#include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { -class ScriptArguments; -class ScriptCallStack; class ScriptState; const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>( @@ -46,9 +44,12 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac | v8::StackTrace::kScriptNameOrSourceURL | v8::StackTrace::kFunctionName); -PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize); -PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize); -PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount); +class ScriptArguments; +class ScriptCallStack; + +PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize); +PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize); +PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount); } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptControllerQt.cpp b/WebCore/bindings/v8/ScriptControllerQt.cpp index 11bcb01..246921e 100644 --- a/WebCore/bindings/v8/ScriptControllerQt.cpp +++ b/WebCore/bindings/v8/ScriptControllerQt.cpp @@ -40,7 +40,7 @@ QScriptEngine* ScriptController::qtScriptEngine() v8::Context::Scope scope(v8Context); if (v8Context.IsEmpty()) return 0; - m_qtScriptEngine = new QScriptEngine; + m_qtScriptEngine = new QScriptEngine(QScriptEngine::AdoptCurrentContext); } return m_qtScriptEngine.get(); } diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp b/WebCore/bindings/v8/ScriptHeapSnapshot.cpp index c35d508..885d039 100644 --- a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp +++ b/WebCore/bindings/v8/ScriptHeapSnapshot.cpp @@ -33,7 +33,6 @@ #include "InspectorValues.h" #include "V8Binding.h" -#include <v8.h> #include <v8-profiler.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -51,29 +50,50 @@ unsigned int ScriptHeapSnapshot::uid() const return m_snapshot->GetUid(); } -namespace { - -class OutputStreamAdapter : public v8::OutputStream { -public: - OutputStreamAdapter(ScriptHeapSnapshot::OutputStream* output) - : m_output(output) { } - void EndOfStream() { m_output->Close(); } - int GetChunkSize() { return 10240; } - WriteResult WriteAsciiChunk(char* data, int size) - { - m_output->Write(String(data, size)); - return kContinue; +static PassRefPtr<InspectorObject> buildInspectorObjectFor(const v8::HeapGraphNode* root) +{ + v8::HandleScope scope; + RefPtr<InspectorObject> result = InspectorObject::create(); + RefPtr<InspectorObject> lowLevels = InspectorObject::create(); + RefPtr<InspectorObject> entries = InspectorObject::create(); + RefPtr<InspectorObject> children = InspectorObject::create(); + for (int i = 0, count = root->GetChildrenCount(); i < count; ++i) { + const v8::HeapGraphNode* node = root->GetChild(i)->GetToNode(); + if (node->GetType() == v8::HeapGraphNode::kInternal) { + RefPtr<InspectorObject> lowLevel = InspectorObject::create(); + lowLevel->setNumber("count", node->GetInstancesCount()); + lowLevel->setNumber("size", node->GetSelfSize()); + lowLevel->setString("type", toWebCoreString(node->GetName())); + lowLevels->setObject(toWebCoreString(node->GetName()), lowLevel); + } else if (node->GetInstancesCount()) { + RefPtr<InspectorObject> entry = InspectorObject::create(); + entry->setString("constructorName", toWebCoreString(node->GetName())); + entry->setNumber("count", node->GetInstancesCount()); + entry->setNumber("size", node->GetSelfSize()); + entries->setObject(toWebCoreString(node->GetName()), entry); + } else { + RefPtr<InspectorObject> entry = InspectorObject::create(); + entry->setString("constructorName", toWebCoreString(node->GetName())); + for (int j = 0, count = node->GetChildrenCount(); j < count; ++j) { + const v8::HeapGraphEdge* v8Edge = node->GetChild(j); + const v8::HeapGraphNode* v8Child = v8Edge->GetToNode(); + RefPtr<InspectorObject> child = InspectorObject::create(); + child->setString("constructorName", toWebCoreString(v8Child->GetName())); + child->setNumber("count", v8Edge->GetName()->ToInteger()->Value()); + entry->setObject(String::number(reinterpret_cast<unsigned long long>(v8Child)), child); + } + children->setObject(String::number(reinterpret_cast<unsigned long long>(node)), entry); + } } -private: - ScriptHeapSnapshot::OutputStream* m_output; -}; - -} // namespace + result->setObject("lowlevels", lowLevels); + result->setObject("entries", entries); + result->setObject("children", children); + return result.release(); +} -void ScriptHeapSnapshot::writeJSON(ScriptHeapSnapshot::OutputStream* stream) +PassRefPtr<InspectorObject> ScriptHeapSnapshot::buildInspectorObjectForHead() const { - OutputStreamAdapter outputStream(stream); - m_snapshot->Serialize(&outputStream, v8::HeapSnapshot::kJSON); + return buildInspectorObjectFor(m_snapshot->GetRoot()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.h b/WebCore/bindings/v8/ScriptHeapSnapshot.h index d3ae022..794a5a9 100644 --- a/WebCore/bindings/v8/ScriptHeapSnapshot.h +++ b/WebCore/bindings/v8/ScriptHeapSnapshot.h @@ -43,13 +43,6 @@ class InspectorObject; class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> { public: - class OutputStream { - public: - virtual ~OutputStream() { } - virtual void Write(const String& chunk) = 0; - virtual void Close() = 0; - }; - static PassRefPtr<ScriptHeapSnapshot> create(const v8::HeapSnapshot* snapshot) { return adoptRef(new ScriptHeapSnapshot(snapshot)); @@ -58,7 +51,8 @@ public: String title() const; unsigned int uid() const; - void writeJSON(OutputStream* stream); + + PassRefPtr<InspectorObject> buildInspectorObjectForHead() const; private: ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot) diff --git a/WebCore/bindings/v8/V8ConsoleMessage.cpp b/WebCore/bindings/v8/V8ConsoleMessage.cpp index 9e6e267..40f9a7a 100644 --- a/WebCore/bindings/v8/V8ConsoleMessage.cpp +++ b/WebCore/bindings/v8/V8ConsoleMessage.cpp @@ -114,7 +114,7 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V String errorMessage = toWebCoreString(errorMessageString); v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); - RefPtr<ScriptCallStack> callStack; + OwnPtr<ScriptCallStack> callStack; // Currently stack trace is only collected when inspector is open. if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) { v8::Local<v8::Context> context = v8::Context::GetEntered(); @@ -125,10 +125,10 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V bool useURL = resourceName.IsEmpty() || !resourceName->IsString(); String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName); V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber()); - consoleMessage.dispatchNow(page, callStack); + consoleMessage.dispatchNow(page, callStack.release()); } -void V8ConsoleMessage::dispatchNow(Page* page, PassRefPtr<ScriptCallStack> callStack) +void V8ConsoleMessage::dispatchNow(Page* page, PassOwnPtr<ScriptCallStack> callStack) { ASSERT(page); diff --git a/WebCore/bindings/v8/V8ConsoleMessage.h b/WebCore/bindings/v8/V8ConsoleMessage.h index 97de24f..6b892dd 100644 --- a/WebCore/bindings/v8/V8ConsoleMessage.h +++ b/WebCore/bindings/v8/V8ConsoleMessage.h @@ -82,7 +82,7 @@ namespace WebCore { const String m_sourceID; const unsigned m_lineNumber; - void dispatchNow(Page*, PassRefPtr<ScriptCallStack>); + void dispatchNow(Page*, PassOwnPtr<ScriptCallStack>); // All delayed messages are stored in this vector. If the vector // is 0, there are no delayed messages. diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index 3eeacec..b26882b 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -444,7 +444,7 @@ void V8GCController::gcEpilogue() void V8GCController::checkMemoryUsage() { -#if PLATFORM(CHROMIUM) || PLATFORM(QT) && !OS(SYMBIAN) +#if PLATFORM(CHROMIUM) // These values are appropriate for Chromium only. const int lowUsageMB = 256; // If memory usage is below this threshold, do not bother forcing GC. const int highUsageMB = 1024; // If memory usage is above this threshold, force GC more aggresively. diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp index 65c30a0..8fa19d7 100644 --- a/WebCore/bindings/v8/V8NPUtils.cpp +++ b/WebCore/bindings/v8/V8NPUtils.cpp @@ -53,7 +53,9 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP if (object.IsEmpty()) return; - if (object->IsNumber()) + if (object->IsInt32()) + INT32_TO_NPVARIANT(object->NumberValue(), *result); + else if (object->IsNumber()) DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); else if (object->IsBoolean()) BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp index e21354e..9142ad7 100644 --- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp @@ -65,9 +65,9 @@ v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args) { INC_STATS("DOM.Console.traceCallback"); Console* imp = V8Console::toNative(args.Holder()); - RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture)); - RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0)); - imp->trace(scriptArguments.release(), callStack); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture)); + OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0)); + imp->trace(scriptArguments.release(), callStack.release()); return v8::Handle<v8::Value>(); } @@ -75,10 +75,10 @@ v8::Handle<v8::Value> V8Console::assertCallback(const v8::Arguments& args) { INC_STATS("DOM.Console.assertCallback"); Console* imp = V8Console::toNative(args.Holder()); - RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture)); bool condition = args[0]->BooleanValue(); - RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); - imp->assertCondition(condition, scriptArguments.release(), callStack); + OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); + imp->assertCondition(condition, scriptArguments.release(), callStack.release()); return v8::Handle<v8::Value>(); } @@ -87,11 +87,11 @@ v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args) { INC_STATS("DOM.Console.profile"); Console* imp = V8Console::toNative(args.Holder()); - RefPtr<ScriptCallStack> callStack(createScriptCallStack(1)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1)); if (!callStack) return v8::Undefined(); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]); - imp->profile(title, ScriptState::current(), callStack); + imp->profile(title, ScriptState::current(), callStack.release()); return v8::Handle<v8::Value>(); } @@ -99,11 +99,11 @@ v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args) { INC_STATS("DOM.Console.profileEnd"); Console* imp = V8Console::toNative(args.Holder()); - RefPtr<ScriptCallStack> callStack(createScriptCallStack(1)); + OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1)); if (!callStack) return v8::Undefined(); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]); - imp->profileEnd(title, ScriptState::current(), callStack); + imp->profileEnd(title, ScriptState::current(), callStack.release()); return v8::Handle<v8::Value>(); } #endif diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 6a571ae..5c56cfb 100644 --- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -193,13 +193,6 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args) DOMFormData* domFormData = V8DOMFormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, ec); -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - } else if (V8ArrayBuffer::HasInstance(arg)) { - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); - ASSERT(arrayBuffer); - xmlHttpRequest->send(arrayBuffer, ec); -#endif } else xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); } |