diff options
Diffstat (limited to 'third_party/WebKit/Source')
40 files changed, 843 insertions, 1461 deletions
diff --git a/third_party/WebKit/Source/bindings/bindings.gypi b/third_party/WebKit/Source/bindings/bindings.gypi index 494cc5e..88834da 100644 --- a/third_party/WebKit/Source/bindings/bindings.gypi +++ b/third_party/WebKit/Source/bindings/bindings.gypi @@ -163,7 +163,6 @@ 'v8/custom/V8CustomXPathNSResolver.cpp', 'v8/custom/V8CustomXPathNSResolver.h', 'v8/custom/V8DataViewCustom.cpp', - 'v8/custom/V8DataViewCustom.h', 'v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp', 'v8/custom/V8DeviceMotionEventCustom.cpp', 'v8/custom/V8DeviceOrientationEventCustom.cpp', @@ -175,8 +174,6 @@ 'v8/custom/V8EventCustom.cpp', 'v8/custom/V8EventTargetCustom.cpp', 'v8/custom/V8FileReaderCustom.cpp', - 'v8/custom/V8Float32ArrayCustom.h', - 'v8/custom/V8Float64ArrayCustom.h', 'v8/custom/V8FormDataCustom.cpp', 'v8/custom/V8GeolocationCustom.cpp', 'v8/custom/V8HTMLAllCollectionCustom.cpp', @@ -200,9 +197,6 @@ 'v8/custom/V8InjectedScriptHostCustom.cpp', 'v8/custom/V8InjectedScriptManager.cpp', 'v8/custom/V8InspectorFrontendHostCustom.cpp', - 'v8/custom/V8Int8ArrayCustom.h', - 'v8/custom/V8Int16ArrayCustom.h', - 'v8/custom/V8Int32ArrayCustom.h', 'v8/custom/V8JavaScriptCallFrameCustom.cpp', 'v8/custom/V8LocationCustom.cpp', 'v8/custom/V8MessageChannelCustom.cpp', @@ -227,11 +221,6 @@ 'v8/custom/V8StyleSheetCustom.cpp', 'v8/custom/V8TextCustom.cpp', 'v8/custom/V8TrackEventCustom.cpp', - 'v8/custom/V8TypedArrayCustom.h', - 'v8/custom/V8Uint8ArrayCustom.h', - 'v8/custom/V8Uint8ClampedArrayCustom.h', - 'v8/custom/V8Uint16ArrayCustom.h', - 'v8/custom/V8Uint32ArrayCustom.h', 'v8/custom/V8WebGLRenderingContextCustom.cpp', 'v8/custom/V8WebKitPointCustom.cpp', 'v8/custom/V8WindowCustom.cpp', diff --git a/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm b/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm index 279e57f8..cd82aff 100644 --- a/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm +++ b/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm @@ -426,8 +426,8 @@ sub AddIncludesForType AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); } elsif ($type eq "any" || IsCallbackFunctionType($type)) { AddToImplIncludes("bindings/v8/ScriptValue.h"); - } elsif (IsTypedArrayType($type)) { - AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); + } elsif ($type eq "ArrayBuffer") { + AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); } else { AddToImplIncludes("V8${type}.h"); } @@ -439,7 +439,7 @@ sub HeaderFilesForInterface my $implClassName = shift; my @includes = (); - if (IsTypedArrayType($interfaceName)) { + if (IsTypedArrayType($interfaceName) or $interfaceName eq "ArrayBuffer") { push(@includes, "wtf/${interfaceName}.h"); } elsif (!SkipIncludeHeader($interfaceName)) { my $idlFilename = IDLFileForInterface($interfaceName) or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); @@ -2711,6 +2711,24 @@ END $implementation{nameSpaceWebCore}->add($code); } +sub GenerateTypedArrayConstructor +{ + my $interface = shift; + my $implClassName = GetImplName($interface); + my $v8ClassName = GetV8ClassName($interface); + + my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface); + AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); + + $implementation{nameSpaceInternal}->add(<<END); +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + return constructWebGLArray<$implClassName, ${v8ClassName}, $nativeType>(args, &${v8ClassName}::info, $arrayType); +} + +END +} + sub GenerateNamedConstructor { my $function = shift; @@ -4999,8 +5017,8 @@ sub GetNativeType die "UnionType is not supported" if IsUnionType($type); - if (IsTypedArrayType($type)) { - return $isParameter ? "${type}*" : "RefPtr<${type}>"; + if ($type eq "ArrayBuffer") { + return $isParameter ? "ArrayBuffer*" : "RefPtr<ArrayBuffer>"; } # We need to check [ImplementedAs] extended attribute for wrapper types. @@ -5128,9 +5146,9 @@ sub JSValueToNative return "V8DOMWrapper::isDOMWrapper($value) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast($value))->toEventTarget(v8::Handle<v8::Object>::Cast($value)) : 0"; } - if (IsTypedArrayType($type)) { + if ($type eq "ArrayBuffer") { AddIncludesForType($type); - return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type}>::Cast($value)) : 0" + return "$value->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast($value)) : 0" } if ($type eq "XPathNSResolver") { @@ -5164,7 +5182,7 @@ sub CreateCustomSignature foreach my $parameter (@{$function->parameters}) { if ($first) { $first = 0; } else { $code .= ", "; } - if (IsWrapperType($parameter->type) && not IsTypedArrayType($parameter->type)) { + if (IsWrapperType($parameter->type) && $parameter->type ne "ArrayBuffer") { if ($parameter->type eq "XPathNSResolver") { # Special case for XPathNSResolver. All other browsers accepts a callable, # so, even though it's against IDL, accept objects here. @@ -5253,7 +5271,7 @@ sub IsCallbackInterface { my $type = shift; return 0 unless IsWrapperType($type); - return 0 if IsTypedArrayType($type); + return 0 if $type eq "ArrayBuffer"; my $idlFile = IDLFileForInterface($type) or die("Could NOT find IDL file for interface \"$type\"!\n"); diff --git a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp index 199197b..a25d7fa 100644 --- a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp +++ b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp @@ -36,13 +36,12 @@ #include "V8SpeechRecognitionResult.h" #include "V8SpeechRecognitionResultList.h" #include "V8Storage.h" +#include "V8Uint8Array.h" #include "V8VoidCallback.h" #include "V8Window.h" #include "bindings/v8/ArrayValue.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" #include "core/dom/DOMStringList.h" #include "modules/indexeddb/IDBKeyRange.h" #include "modules/speech/SpeechRecognitionError.h" diff --git a/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp b/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp index e7c30bb..1e34ad8 100644 --- a/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp +++ b/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "bindings/v8/ScriptProfiler.h" +#include "V8ArrayBufferView.h" #include "V8Node.h" #include "V8Window.h" #include "bindings/v8/RetainedDOMInfo.h" @@ -38,7 +39,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8DOMWrapper.h" #include "bindings/v8/WrapperTypeInfo.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/Document.h" #include "core/inspector/BindingVisitors.h" @@ -320,7 +320,7 @@ void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor) // GCd during visiting. ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object>*>(value); - if (!(*wrapper)->IsArrayBufferView()) + if (!toWrapperTypeInfo(*wrapper)->isSubclass(&V8ArrayBufferView::info)) return; m_visitor->visitJSExternalArray(V8ArrayBufferView::toNative(*wrapper)); } diff --git a/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp index c014cbd..17256d3 100644 --- a/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp +++ b/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp @@ -31,26 +31,26 @@ #include "config.h" #include "bindings/v8/SerializedScriptValue.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8DOMFileSystem.h" +#include "V8DataView.h" #include "V8File.h" #include "V8FileList.h" +#include "V8Float32Array.h" #include "V8ImageData.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8MessagePort.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" +#include "V8Uint8ClampedArray.h" +#include "bindings/tests/results/V8Float64Array.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8DataViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "core/dom/MessagePort.h" #include "core/fileapi/Blob.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp index 1d83f4d..367a723 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp @@ -25,63 +25,32 @@ #include "config.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8DataViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" +#include "V8ArrayBufferViewCustomScript.h" +#include "bindings/v8/V8HiddenPropertyName.h" +#include "bindings/v8/V8ScriptRunner.h" #include <v8.h> namespace WebCore { -using namespace WTF; - -ArrayBufferView* V8ArrayBufferView::toNative(v8::Handle<v8::Object> object) +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate) { - ASSERT(object->IsArrayBufferView()); - void* viewPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - if (viewPtr) - return reinterpret_cast<ArrayBufferView*>(viewPtr); - - if (object->IsUint8Array()) { - return V8Uint8Array::toNative(object); - } - if (object->IsInt8Array()) { - return V8Int8Array::toNative(object); - } - if (object->IsUint16Array()) { - return V8Uint16Array::toNative(object); - } - if (object->IsInt16Array()) { - return V8Int16Array::toNative(object); - } - if (object->IsUint32Array()) { - return V8Uint32Array::toNative(object); - } - if (object->IsInt32Array()) { - return V8Int32Array::toNative(object); - } - if (object->IsFloat32Array()) { - return V8Float32Array::toNative(object); - } - if (object->IsFloat64Array()) { - return V8Float64Array::toNative(object); - } - if (object->IsUint8ClampedArray()) { - return V8Uint8ClampedArray::toNative(object); - } - if (object->IsDataView()) { - return V8DataView::toNative(object); - } - ASSERT_NOT_REACHED(); - return 0; + v8::Handle<v8::Value> prototype_value = destArray->GetPrototype(); + if (prototype_value.IsEmpty() || !prototype_value->IsObject()) + return false; + v8::Handle<v8::Object> prototype = prototype_value.As<v8::Object>(); + v8::Handle<v8::Value> value = prototype->GetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod()); + if (value.IsEmpty()) { + String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js), sizeof(V8ArrayBufferViewCustomScript_js)); + value = V8ScriptRunner::compileAndRunInternalScript(v8String(source, isolate), isolate); + prototype->SetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod(), value); + } + if (value.IsEmpty() || !value->IsFunction()) + return false; + v8::Handle<v8::Function> copy_method = value.As<v8::Function>(); + v8::Handle<v8::Value> arguments[3] = { srcArray, v8::Uint32::New(length), v8::Uint32::New(offset) }; + V8ScriptRunner::callInternalFunction(copy_method, destArray, WTF_ARRAY_LENGTH(arguments), arguments, isolate); + return true; } - -} // namespace WebCore +} diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h index d39a9d2..98de7f5 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -37,29 +37,273 @@ #include "core/dom/ExceptionCode.h" #include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" namespace WebCore { +const char tooLargeSize[] = "Size is too large (or is negative)."; +const char outOfRangeLengthAndOffset[] = "Index is out of range."; -class V8ArrayBufferView { -public: - static bool HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, WrapperWorldType) - { - return value->IsArrayBufferView(); +// Copy the elements from the source array to the typed destination array. +// Returns true if it succeeded, otherwise returns false. +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate*); + +template<class JavaScriptWrapperArrayType, class ArrayClass> +void wrapArrayBufferView(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, ArrayClass array, v8::ExternalArrayType arrayType, bool hasIndexer) +{ + // Transform the holder into a wrapper object for the array. + ASSERT(!hasIndexer || static_cast<int32_t>(array.get()->length()) >= 0); + if (hasIndexer) + args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent); + args.GetReturnValue().Set(wrapper); +} + +// Template function used by the ArrayBufferView*Constructor callbacks. +template<class ArrayClass, class ElementType, class JavaScriptWrapperArrayType> +void constructWebGLArrayWithArrayBufferArgument(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer) +{ + ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject()); + if (!buf) { + throwTypeError("Could not convert argument 0 to a ArrayBuffer", args.GetIsolate()); + return; + } + bool ok; + uint32_t offset = 0; + int argLen = args.Length(); + if (argLen > 1) { + offset = toUInt32(args[1], ok); + if (!ok) { + throwTypeError("Could not convert argument 1 to a number", args.GetIsolate()); + return; + } + } + uint32_t length = 0; + if (argLen > 2) { + length = toUInt32(args[2], ok); + if (!ok) { + throwTypeError("Could not convert argument 2 to a number", args.GetIsolate()); + return; + } + } else { + if ((buf->byteLength() - offset) % sizeof(ElementType)) { + throwError(v8RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.", args.GetIsolate()); + return; + } + length = (buf->byteLength() - offset) / sizeof(ElementType); + } + + if (static_cast<int32_t>(length) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length); + if (!array) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, hasIndexer); +} + +// Template function used by the ArrayBufferView*Constructor callbacks. +template<class ArrayClass, class JavaScriptWrapperArrayType, class ElementType> +void constructWebGLArray(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType) +{ + if (!args.IsConstructCall()) { + throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); + return; + } + + if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { + args.GetReturnValue().Set(args.Holder()); + return; + } + + int argLen = args.Length(); + if (!argLen) { + // This happens when we return a previously constructed + // ArrayBufferView, e.g. from the call to <Type>Array.subset(). + // The V8DOMWrapper will set the internal pointer in the + // created object. Unfortunately it doesn't look like it's + // possible to distinguish between this case and that where + // the user calls "new <Type>Array()" from JavaScript. We must + // construct an empty view to avoid crashes when fetching the + // length. + RefPtr<ArrayClass> array = ArrayClass::create(0); + // Do not call SetIndexedPropertiesToExternalArrayData on this + // object. Not only is there no point from a performance + // perspective, but doing so causes errors in the subset() case. + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, false); + return; + } + + // Supported constructors: + // WebGL<T>Array(n) where n is an integer: + // -- create an empty array of n elements + // WebGL<T>Array(arr) where arr is an array: + // -- create a WebGL<T>Array containing the contents of "arr" + // WebGL<T>Array(buf, offset, length) + // -- create a WebGL<T>Array pointing to the ArrayBuffer + // "buf", starting at the specified offset, for the given + // length + + if (args[0]->IsNull()) { + // Invalid first argument + throwTypeError(args.GetIsolate()); + return; + } + + // See whether the first argument is a ArrayBuffer. + if (V8ArrayBuffer::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType, JavaScriptWrapperArrayType>(args, type, arrayType, true); + return; + } + + // See whether the first argument is the same type as impl. In that case, + // we can simply memcpy data from source to impl. + if (JavaScriptWrapperArrayType::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + ArrayClass* source = JavaScriptWrapperArrayType::toNative(args[0]->ToObject()); + uint32_t length = source->length(); + + if (static_cast<int32_t>(length) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array = ArrayClass::createUninitialized(length); + if (!array.get()) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength()); + + memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(ElementType)); + + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, true); + return; + } + + uint32_t len = 0; + v8::Handle<v8::Object> srcArray; + bool doInstantiation = false; + + if (args[0]->IsObject()) { + srcArray = args[0]->ToObject(); + if (srcArray.IsEmpty()) { + throwTypeError("Could not convert argument 0 to an array", args.GetIsolate()); + return; + } + v8::Local<v8::Value> val = srcArray->Get(v8::String::NewSymbol("length")); + if (val.IsEmpty()) { + // Exception thrown during fetch of length property. + return; + } + len = toUInt32(val); + doInstantiation = true; + } else { + bool ok = false; + int32_t tempLength = toInt32(args[0], ok); // NaN/+inf/-inf returns 0, this is intended by WebIDL + if (ok && tempLength >= 0) { + len = static_cast<uint32_t>(tempLength); + doInstantiation = true; + } + } + + if (static_cast<int32_t>(len) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array; + if (doInstantiation) { + if (srcArray.IsEmpty()) + array = ArrayClass::create(len); + else + array = ArrayClass::createUninitialized(len); + } + + if (!array.get()) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; } - static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) - { - return value->IsArrayBufferView(); + + if (doInstantiation) { + array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength()); + } + + + // Transform the holder into a wrapper object for the array. + args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); + + if (!srcArray.IsEmpty()) { + bool copied = copyElements(args.Holder(), srcArray, len, 0, args.GetIsolate()); + if (!copied) { + for (unsigned i = 0; i < len; i++) { + v8::Local<v8::Value> val = srcArray->Get(i); + if (val.IsEmpty()) { + // Exception thrown during fetch. + return; + } + array->set(i, val->NumberValue()); + } + } + } + + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent); + args.GetReturnValue().Set(wrapper); +} + +template <class CPlusPlusArrayType, class JavaScriptWrapperArrayType> +void setWebGLArrayHelper(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + if (args.Length() < 1) { + throwNotEnoughArgumentsError(args.GetIsolate()); + return; + } + + CPlusPlusArrayType* impl = JavaScriptWrapperArrayType::toNative(args.Holder()); + + if (JavaScriptWrapperArrayType::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + // void set(in WebGL<T>Array array, [Optional] in unsigned long offset); + CPlusPlusArrayType* src = JavaScriptWrapperArrayType::toNative(args[0]->ToObject()); + uint32_t offset = 0; + if (args.Length() == 2) + offset = toUInt32(args[1]); + if (!impl->set(src, offset)) { + throwError(v8RangeError, outOfRangeLengthAndOffset, args.GetIsolate()); + return; + } + return; } - static ArrayBufferView* toNative(v8::Handle<v8::Object>); - static inline void* toInternalPointer(ArrayBufferView* impl) - { - return impl; + if (args[0]->IsObject()) { + // void set(in sequence<long> array, [Optional] in unsigned long offset); + v8::Local<v8::Object> array = args[0]->ToObject(); + uint32_t offset = 0; + if (args.Length() == 2) + offset = toUInt32(args[1]); + uint32_t length = toUInt32(array->Get(v8::String::NewSymbol("length"))); + if (!impl->checkInboundData(offset, length)) { + throwError(v8RangeError, outOfRangeLengthAndOffset, args.GetIsolate()); + return; + } + bool copied = copyElements(args.Holder(), array, length, offset, args.GetIsolate()); + if (!copied) { + for (uint32_t i = 0; i < length; i++) + impl->set(offset + i, array->Get(i)->NumberValue()); + } + return; } -}; + throwTypeError("Invalid argument", args.GetIsolate()); +} + +} -} // namespace WebCore #endif // V8ArrayBufferViewCustom_h diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp index 32e35c3..b13f701 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp @@ -31,13 +31,13 @@ #include "config.h" #include "core/fileapi/Blob.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8File.h" #include "bindings/v8/Dictionary.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/fileapi/BlobBuilder.h" #include "wtf/RefPtr.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp index 6c6e2fc..569e9c3 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp @@ -25,11 +25,10 @@ #include "config.h" #include "V8Crypto.h" +#include "V8ArrayBufferView.h" #include "bindings/v8/ExceptionState.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "core/dom/ExceptionCode.h" #include "modules/crypto/Crypto.h" #include "wtf/ArrayBufferView.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp index e07dfa5..72b7af1 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp @@ -24,29 +24,37 @@ */ #include "config.h" -#include "bindings/v8/custom/V8DataViewCustom.h" +#include "core/html/canvas/DataView.h" +#include "V8DataView.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "core/html/canvas/DataView.h" namespace WebCore { -static void initializeScriptWrappableForInterface(DataView* object) +void V8DataView::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& args) { - if (ScriptWrappable::wrapperCanBeStoredInObject(object)) - ScriptWrappable::setTypeInfoInObject(object, &V8DataView::info); - else - ASSERT_NOT_REACHED(); + if (!args.Length()) { + // see constructWebGLArray -- we don't seem to be able to distingish between + // 'new DataView()' and the call used to construct the cached DataView object. + RefPtr<DataView> dataView = DataView::create(0); + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<V8DataView>(dataView.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); + args.GetReturnValue().Set(wrapper); + return; + } + if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + throwTypeError(args.GetIsolate()); + return; + } + constructWebGLArrayWithArrayBufferArgument<DataView, char, V8DataView>(args, &info, v8::kExternalByteArray, false); } -} // namespace WebCore - -// In ScriptWrappable::init, the use of a local function declaration has an issue on Windows: -// the local declaration does not pick up the surrounding namespace. Therefore, we provide this function -// in the global namespace. -// (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c) -void webCoreInitializeScriptWrappableForInterface(WebCore::DataView* object) +// FIXME: Don't need this override. +v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) { - WebCore::initializeScriptWrappableForInterface(object); + ASSERT(impl); + return V8DataView::createWrapper(impl, creationContext, isolate); } + +} // namespace WebCore diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h deleted file mode 100644 index 67f9781..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8DataViewCustom_h -#define V8DataViewCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "core/html/canvas/DataView.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<DataView> { -public: - typedef v8::DataView V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsDataView(); - } - - static size_t length(v8::Handle<v8::DataView> value) - { - return value->ByteLength(); - } - - static size_t length(DataView* array) - { - return array->byteLength(); - } -}; - -typedef V8TypedArray<DataView> V8DataView; - -template<> -class WrapperTypeTraits<DataView> : public TypedArrayWrapperTraits<DataView> { }; - - -inline v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(DataView* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<DataView>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(DataView* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<DataView>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< DataView > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< DataView > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< DataView > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h deleted file mode 100644 index f980ea0..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Float32ArrayCustom_h -#define V8Float32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Float32Array> { -public: - typedef v8::Float32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsFloat32Array(); - } - - static size_t length(v8::Handle<v8::Float32Array> value) - { - return value->Length(); - } - - static size_t length(Float32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Float32Array> V8Float32Array; - -template<> -class WrapperTypeTraits<Float32Array> : public TypedArrayWrapperTraits<Float32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Float32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Float32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Float32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Float32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h deleted file mode 100644 index 1cabb08..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Float64ArrayCustom_h -#define V8Float64ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float64Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Float64Array> { -public: - typedef v8::Float64Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsFloat64Array(); - } - - static size_t length(v8::Handle<v8::Float64Array> value) - { - return value->Length(); - } - - static size_t length(Float64Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Float64Array> V8Float64Array; - -template<> -class WrapperTypeTraits<Float64Array> : public TypedArrayWrapperTraits<Float64Array> { }; - - -inline v8::Handle<v8::Object> wrap(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Float64Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float64Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Float64Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float64Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Float64Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Float64Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float64Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp index 3e2e670..cb35401 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "V8ImageData.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" +#include "V8Uint8ClampedArray.h" namespace WebCore { diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 73b8d63..1ac446e 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -32,11 +32,20 @@ #include "V8InjectedScriptHost.h" #include "V8Database.h" +#include "V8Float32Array.h" #include "V8HTMLAllCollection.h" #include "V8HTMLCollection.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8Node.h" #include "V8NodeList.h" #include "V8Storage.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" +#include "V8Uint8ClampedArray.h" +#include "bindings/tests/results/V8Float64Array.h" #include "bindings/v8/BindingSecurity.h" #include "bindings/v8/ScriptDebugServer.h" #include "bindings/v8/ScriptValue.h" @@ -44,15 +53,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8ScriptRunner.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" #include "core/inspector/InjectedScript.h" #include "core/inspector/InjectedScriptHost.h" #include "core/inspector/InspectorDOMAgent.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h deleted file mode 100644 index f5a7c83..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int16ArrayCustom_h -#define V8Int16ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int16Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int16Array> { -public: - typedef v8::Int16Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt16Array(); - } - - static size_t length(v8::Handle<v8::Int16Array> value) - { - return value->Length(); - } - - static size_t length(Int16Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int16Array> V8Int16Array; - -template<> -class WrapperTypeTraits<Int16Array> : public TypedArrayWrapperTraits<Int16Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int16Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int16Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h deleted file mode 100644 index 29a927b..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int32ArrayCustom_h -#define V8Int32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int32Array> { -public: - typedef v8::Int32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt32Array(); - } - - static size_t length(v8::Handle<v8::Int32Array> value) - { - return value->Length(); - } - - static size_t length(Int32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int32Array> V8Int32Array; - -template<> -class WrapperTypeTraits<Int32Array> : public TypedArrayWrapperTraits<Int32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h deleted file mode 100644 index f325aba..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int8ArrayCustom_h -#define V8Int8ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int8Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int8Array> { -public: - typedef v8::Int8Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt8Array(); - } - - static size_t length(v8::Handle<v8::Int8Array> value) - { - return value->Length(); - } - - static size_t length(Int8Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int8Array> V8Int8Array; - -template<> -class WrapperTypeTraits<Int8Array> : public TypedArrayWrapperTraits<Int8Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int8Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int8Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h deleted file mode 100644 index 864a4ad..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8TypedArrayCustom_h -#define V8TypedArrayCustom_h - -#include "bindings/v8/V8Binding.h" -#include "bindings/v8/V8DOMWrapper.h" -#include "bindings/v8/WrapperTypeInfo.h" -#include "bindings/v8/custom/V8ArrayBufferCustom.h" - -#include "wtf/ArrayBuffer.h" - -#include <v8.h> - -namespace WebCore { - -template<typename T> -class TypedArrayTraits -{ }; - -template<typename TypedArray> -class V8TypedArray { -public: - static bool HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, WrapperWorldType) - { - return TypedArrayTraits<TypedArray>::IsInstance(value); - } - - static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) - { - return TypedArrayTraits<TypedArray>::IsInstance(value); - } - - static TypedArray* toNative(v8::Handle<v8::Object>); - static void derefObject(void*); - static WrapperTypeInfo info; - static const int internalFieldCount = v8DefaultWrapperInternalFieldCount; - - static v8::Handle<v8::Object> wrap(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - ASSERT(impl); - ASSERT((DOMDataStore::template getWrapper<Binding>(impl, isolate).IsEmpty())); - return V8TypedArray<TypedArray>::createWrapper(impl, creationContext, isolate); - } - - static v8::Handle<v8::Value> toV8(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - if (UNLIKELY(!impl)) - return v8NullWithCheck(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<Binding>(impl, isolate); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); - } - - static v8::Handle<v8::Value> toV8ForMainWorld(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - ASSERT(worldType(isolate) == MainWorld); - if (UNLIKELY(!impl)) - return v8NullWithCheck(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<Binding>(impl); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); - } - - template<class HolderContainer, class Wrappable> - static v8::Handle<v8::Value> toV8Fast(TypedArray* impl, const HolderContainer& container, Wrappable* wrappable) - { - if (UNLIKELY(!impl)) - return v8::Null(container.GetIsolate()); - v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<Binding>(impl, container, wrappable); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, container.Holder(), container.GetIsolate()); - } - - template<class HolderContainer, class Wrappable> - static v8::Handle<v8::Value> toV8FastForMainWorld(TypedArray* impl, const HolderContainer& container, Wrappable* wrappable) - { - ASSERT(worldType(container.GetIsolate()) == MainWorld); - if (UNLIKELY(!impl)) - return v8::Null(container.GetIsolate()); - v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<Binding>(impl); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, container.Holder(), container.GetIsolate()); - } - - static inline void* toInternalPointer(TypedArray* impl) - { - return impl; - } -private: - typedef TypedArrayTraits<TypedArray> Traits; - typedef typename Traits::V8Type V8Type; - typedef V8TypedArray<TypedArray> Binding; - - static v8::Handle<v8::Object> createWrapper(PassRefPtr<TypedArray>, v8::Handle<v8::Object> creationContext, v8::Isolate*); -}; - -template<typename TypedArray> -class TypedArrayWrapperTraits { -public: - static WrapperTypeInfo* info() { return &V8TypedArray<TypedArray>::info; } -}; - - -template <typename TypedArray> -v8::Handle<v8::Object> V8TypedArray<TypedArray>::createWrapper(PassRefPtr<TypedArray> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - ASSERT(impl.get()); - ASSERT(DOMDataStore::getWrapper<Binding>(impl.get(), isolate).IsEmpty()); - - RefPtr<ArrayBuffer> buffer = impl->buffer(); - v8::Handle<v8::Value> v8Buffer = WebCore::toV8(buffer.get(), creationContext, isolate); - - v8::Handle<v8::Object> wrapper = V8Type::New(v8Buffer.As<v8::ArrayBuffer>(), impl->byteOffset(), Traits::length(impl.get())); - - V8DOMWrapper::associateObjectWithWrapper<Binding>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent); - return wrapper; -} - -template <typename TypedArray> -TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object) -{ - ASSERT(Traits::IsInstance(object)); - void* typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - if (typedarrayPtr) - return reinterpret_cast<TypedArray*>(typedarrayPtr); - - v8::Handle<V8Type> view = object.As<V8Type>(); - RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(view->Buffer()); - RefPtr<TypedArray> typedArray = TypedArray::create(arrayBuffer, view->ByteOffset(), Traits::length(view)); - ASSERT(typedArray.get()); - V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &info, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Independent); - - typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - ASSERT(typedarrayPtr); - return reinterpret_cast<TypedArray*>(typedarrayPtr); -} - - -template <typename TypedArray> -WrapperTypeInfo V8TypedArray<TypedArray>::info = { - 0, V8TypedArray<TypedArray>::derefObject, - 0, 0, 0, 0, 0, WrapperTypeObjectPrototype -}; - -template <typename TypedArray> -void V8TypedArray<TypedArray>::derefObject(void* object) -{ - static_cast<TypedArray*>(object)->deref(); -} - - -} // namespace WebCode - -#endif // V8TypedArrayCustom_h diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h deleted file mode 100644 index 30a7403..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint16ArrayCustom_h -#define V8Uint16ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint16Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint16Array> { -public: - typedef v8::Uint16Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint16Array(); - } - - static size_t length(v8::Handle<v8::Uint16Array> value) - { - return value->Length(); - } - - static size_t length(Uint16Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint16Array> V8Uint16Array; - -template<> -class WrapperTypeTraits<Uint16Array> : public TypedArrayWrapperTraits<Uint16Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint16Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint16Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h deleted file mode 100644 index 0f86baa..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint32ArrayCustom_h -#define V8Uint32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint32Array> { -public: - typedef v8::Uint32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint32Array(); - } - - static size_t length(v8::Handle<v8::Uint32Array> value) - { - return value->Length(); - } - - static size_t length(Uint32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint32Array> V8Uint32Array; - -template<> -class WrapperTypeTraits<Uint32Array> : public TypedArrayWrapperTraits<Uint32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h deleted file mode 100644 index fffaecd..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint8ArrayCustom_h -#define V8Uint8ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint8Array> { -public: - typedef v8::Uint8Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint8Array(); - } - - static size_t length(v8::Handle<v8::Uint8Array> value) - { - return value->Length(); - } - - static size_t length(Uint8Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint8Array> V8Uint8Array; - -template<> -class WrapperTypeTraits<Uint8Array> : public TypedArrayWrapperTraits<Uint8Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h deleted file mode 100644 index 2edd476..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint8ClampedArrayCustom_h -#define V8Uint8ClampedArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8ClampedArray.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint8ClampedArray> { -public: - typedef v8::Uint8ClampedArray V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint8ClampedArray(); - } - - static size_t length(v8::Handle<v8::Uint8ClampedArray> value) - { - return value->Length(); - } - - static size_t length(Uint8ClampedArray* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint8ClampedArray> V8Uint8ClampedArray; - -template<> -class WrapperTypeTraits<Uint8ClampedArray> : public TypedArrayWrapperTraits<Uint8ClampedArray> { }; - - -inline v8::Handle<v8::Object> wrap(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint8ClampedArray* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8ClampedArray>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint8ClampedArray* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8ClampedArray>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint8ClampedArray > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint8ClampedArray > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8ClampedArray > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 7617d97..fa3532e 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -32,12 +32,17 @@ #include "V8WebGLRenderingContext.h" #include "V8ANGLEInstancedArrays.h" +#include "V8ArrayBufferView.h" #include "V8EXTFragDepth.h" #include "V8EXTTextureFilterAnisotropic.h" +#include "V8Float32Array.h" #include "V8HTMLCanvasElement.h" #include "V8HTMLImageElement.h" #include "V8HTMLVideoElement.h" #include "V8ImageData.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8OESElementIndexUint.h" #include "V8OESStandardDerivatives.h" #include "V8OESTextureFloat.h" @@ -45,6 +50,9 @@ #include "V8OESTextureHalfFloat.h" #include "V8OESTextureHalfFloatLinear.h" #include "V8OESVertexArrayObject.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" #include "V8WebGLBuffer.h" #include "V8WebGLCompressedTextureATC.h" #include "V8WebGLCompressedTexturePVRTC.h" @@ -64,14 +72,6 @@ #include "bindings/v8/ExceptionState.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "core/html/canvas/WebGLRenderingContext.h" #include "core/platform/NotImplemented.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 89a6d19..a5196e7 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "V8XMLHttpRequest.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8Document.h" #include "V8FormData.h" @@ -39,7 +40,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/Document.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/page/Frame.h" diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index ccbc333..dfe8ffa 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -203,13 +203,20 @@ 'html/ValidityState.idl', 'html/VoidCallback.idl', 'html/canvas/ANGLEInstancedArrays.idl', + 'html/canvas/ArrayBufferView.idl', 'html/canvas/CanvasGradient.idl', 'html/canvas/CanvasPattern.idl', 'html/canvas/CanvasRenderingContext.idl', 'html/canvas/CanvasRenderingContext2D.idl', 'html/canvas/Canvas2DContextAttributes.idl', + 'html/canvas/DataView.idl', 'html/canvas/EXTFragDepth.idl', 'html/canvas/EXTTextureFilterAnisotropic.idl', + 'html/canvas/Float32Array.idl', + 'html/canvas/Float64Array.idl', + 'html/canvas/Int16Array.idl', + 'html/canvas/Int32Array.idl', + 'html/canvas/Int8Array.idl', 'html/canvas/OESStandardDerivatives.idl', 'html/canvas/OESTextureFloat.idl', 'html/canvas/OESTextureFloatLinear.idl', @@ -218,6 +225,10 @@ 'html/canvas/OESVertexArrayObject.idl', 'html/canvas/OESElementIndexUint.idl', 'html/canvas/Path.idl', + 'html/canvas/Uint16Array.idl', + 'html/canvas/Uint32Array.idl', + 'html/canvas/Uint8Array.idl', + 'html/canvas/Uint8ClampedArray.idl', 'html/canvas/WebGLActiveInfo.idl', 'html/canvas/WebGLBuffer.idl', 'html/canvas/WebGLCompressedTextureATC.idl', diff --git a/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl b/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl new file mode 100644 index 0000000..0f0aba6 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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. + */ + +[ + NoInterfaceObject, + CustomToV8 +] interface ArrayBufferView { + readonly attribute ArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/core/html/canvas/DataView.idl b/third_party/WebKit/Source/core/html/canvas/DataView.idl new file mode 100644 index 0000000..5847f9c --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/DataView.idl @@ -0,0 +1,55 @@ +/* + * 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength), + CustomToV8 +] interface DataView : ArrayBufferView { + // All these methods raise an exception if they would read or write beyond the end of the view. + + [RaisesException] byte getInt8(unsigned long byteOffset); + [RaisesException] octet getUint8(unsigned long byteOffset); + + [StrictTypeChecking, RaisesException] short getInt16(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] unsigned short getUint16(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] long getInt32(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] unsigned long getUint32(unsigned long byteOffset, optional boolean littleEndian); + + // Use custom code to handle NaN case for JSC. + [StrictTypeChecking, RaisesException] float getFloat32(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] double getFloat64(unsigned long byteOffset, optional boolean littleEndian); + + [RaisesException] void setInt8(unsigned long byteOffset, byte value); + [RaisesException] void setUint8(unsigned long byteOffset, octet value); + + [StrictTypeChecking, RaisesException] void setInt16(unsigned long byteOffset, short value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setUint16(unsigned long byteOffset, unsigned short value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setInt32(unsigned long byteOffset, long value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setUint32(unsigned long byteOffset, unsigned long value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setFloat32(unsigned long byteOffset, float value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setFloat64(unsigned long byteOffset, double value, optional boolean littleEndian); +}; + diff --git a/third_party/WebKit/Source/core/html/canvas/Float32Array.idl b/third_party/WebKit/Source/core/html/canvas/Float32Array.idl new file mode 100644 index 0000000..7d5818d --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Float32Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006, 2010 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Float32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Float32Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Float32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Float64Array.idl b/third_party/WebKit/Source/core/html/canvas/Float64Array.idl new file mode 100644 index 0000000..3215e80 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Float64Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Float64Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 8; + + readonly attribute unsigned long length; + Float64Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Float64Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int16Array.idl b/third_party/WebKit/Source/core/html/canvas/Int16Array.idl new file mode 100644 index 0000000..63640db --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int16Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006, 2010 Apple Computer, 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; + + readonly attribute unsigned long length; + Int16Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int16Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int32Array.idl b/third_party/WebKit/Source/core/html/canvas/Int32Array.idl new file mode 100644 index 0000000..012e6a8 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int32Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Int32Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int8Array.idl b/third_party/WebKit/Source/core/html/canvas/Int8Array.idl new file mode 100644 index 0000000..5c65ac1 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int8Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Int8Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int8Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl new file mode 100644 index 0000000..96e95ee --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; + + readonly attribute unsigned long length; + Uint16Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint16Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl new file mode 100644 index 0000000..a964686 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Uint32Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl new file mode 100644 index 0000000..afa941c --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Uint8Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint8Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl b/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl new file mode 100644 index 0000000..66c9289 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 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 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. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint8ClampedArray : Uint8Array { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Uint8ClampedArray subarray([Default=Undefined] optional long start, optional long end); + + // FIXME: Missing other setters! + // void set(Uint8ClampedArray array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/web/WebArrayBufferView.cpp b/third_party/WebKit/Source/web/WebArrayBufferView.cpp index 044ace4..ae05b7c 100644 --- a/third_party/WebKit/Source/web/WebArrayBufferView.cpp +++ b/third_party/WebKit/Source/web/WebArrayBufferView.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "WebArrayBufferView.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" +#include "V8ArrayBufferView.h" #include "wtf/ArrayBufferView.h" using namespace WTF; @@ -63,7 +63,7 @@ unsigned WebArrayBufferView::byteLength() const WebArrayBufferView* WebArrayBufferView::createFromV8Value(v8::Handle<v8::Value> value) { - if (!value->IsArrayBufferView()) + if (!WebCore::V8ArrayBufferView::HasInstanceInAnyWorld(value, v8::Isolate::GetCurrent())) return 0; ArrayBufferView* view = WebCore::V8ArrayBufferView::toNative(value->ToObject()); return new WebArrayBufferView(view); diff --git a/third_party/WebKit/Source/web/WebBindings.cpp b/third_party/WebKit/Source/web/WebBindings.cpp index 664b8d7..dacdc25 100644 --- a/third_party/WebKit/Source/web/WebBindings.cpp +++ b/third_party/WebKit/Source/web/WebBindings.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebBindings.h" +#include "V8ArrayBufferView.h" #include "V8Element.h" #include "V8Range.h" #include "WebArrayBufferView.h" @@ -41,7 +42,6 @@ #include "bindings/v8/V8DOMWrapper.h" #include "bindings/v8/V8NPUtils.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "bindings/v8/npruntime_impl.h" #include "bindings/v8/npruntime_priv.h" #include "core/dom/Range.h" diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index 918034d..3e16662 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp @@ -103,8 +103,8 @@ void initialize(Platform* platform) v8::V8::SetEntropySource(&generateEntropy); v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator()); - static const char* kTypedArraysFlag = "--harmony_array_buffer --harmony_typed_arrays"; - v8::V8::SetFlagsFromString(kTypedArraysFlag, strlen(kTypedArraysFlag)); + static const char* kArrayBufferFlag = "--harmony_array_buffer"; + v8::V8::SetFlagsFromString(kArrayBufferFlag, strlen(kArrayBufferFlag)); v8::V8::Initialize(); WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); |