diff options
author | yukishiino@chromium.org <yukishiino@chromium.org> | 2014-10-20 11:37:28 +0000 |
---|---|---|
committer | yukishiino@chromium.org <yukishiino@chromium.org> | 2014-10-20 11:37:28 +0000 |
commit | 3dfbd2ef9d62505887e29f276625cdd31257c54c (patch) | |
tree | 9d363dd3aae0d81be38edc82168e47e801a6e0c1 | |
parent | 70786e51a29bb33581c9145bddc56f195e03fbec (diff) | |
download | chromium_src-3dfbd2ef9d62505887e29f276625cdd31257c54c.zip chromium_src-3dfbd2ef9d62505887e29f276625cdd31257c54c.tar.gz chromium_src-3dfbd2ef9d62505887e29f276625cdd31257c54c.tar.bz2 |
bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc.
and make them inherit from ScriptWrappable.
This CL adds:
- DOMArrayBuffer
- DOMArrayBufferView
- DOM<TYPE>Array
where TYPE is {Int,Uint}{8,16,32}, Float{32,64},
and Uint8Clamped.
- DOMDataView
- DOMArrayPiece
Each class corresponds to WTF::CLASSNAME where CLASSNAME is
the class name without the prefix DOM (say, ArrayBuffer).
DOMxxx classes have a similar class hierarchy as the original
Xxx classes. i.e. DOM<TYPE>Array and DOMDataView inherit from
DOMArrayBufferView.
BUG=235436
NOPRESUBMIT=true
R=haraken@chromium.org, tkent@chromium.org
Review URL: https://codereview.chromium.org/606653006
git-svn-id: svn://svn.chromium.org/blink/trunk@183972 bbb929c8-8fbe-4397-9dbb-9b2b20218538
183 files changed, 2126 insertions, 2481 deletions
diff --git a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp index 7bf0a302..88026ad 100644 --- a/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/Dictionary.cpp @@ -29,6 +29,7 @@ #include "bindings/core/v8/ArrayValue.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8DOMError.h" #include "bindings/core/v8/V8Element.h" @@ -40,8 +41,6 @@ #include "bindings/core/v8/V8TextTrack.h" #include "bindings/core/v8/V8VoidCallback.h" #include "bindings/core/v8/V8Window.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" #include "bindings/modules/v8/V8Gamepad.h" #include "bindings/modules/v8/V8Headers.h" #include "bindings/modules/v8/V8IDBKeyRange.h" diff --git a/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp b/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp index 31d2e24..af2a3b9 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp @@ -29,6 +29,7 @@ #include "bindings/core/v8/DictionaryHelperForBindings.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8DOMError.h" #include "bindings/core/v8/V8Element.h" @@ -38,10 +39,9 @@ #include "bindings/core/v8/V8Path2D.h" #include "bindings/core/v8/V8Storage.h" #include "bindings/core/v8/V8TextTrack.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "bindings/core/v8/V8VoidCallback.h" #include "bindings/core/v8/V8Window.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" #include "core/html/track/TrackBase.h" #include "wtf/MathExtras.h" @@ -453,12 +453,12 @@ bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers } template <> -struct DictionaryHelperTraits<Uint8Array> { +struct DictionaryHelperTraits<DOMUint8Array> { typedef V8Uint8Array type; }; template <> -struct DictionaryHelperTraits<ArrayBufferView> { +struct DictionaryHelperTraits<DOMArrayBufferView> { typedef V8ArrayBufferView type; }; @@ -487,8 +487,8 @@ struct DictionaryHelperTraits<Path2D> { typedef V8Path2D type; }; -template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr<Uint8Array>& value); -template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr<ArrayBufferView>& value); +template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr<DOMUint8Array>& value); +template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr<DOMArrayBufferView>& value); template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); template bool DictionaryHelper::get(const Dictionary&, const String& key, Member<DOMError>& value); template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtrWillBeMember<Storage>& value); @@ -654,8 +654,8 @@ template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<Storage>& value); -template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtr<Uint8Array>& value); -template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtr<ArrayBufferView>& value); +template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtr<DOMUint8Array>& value); +template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtr<DOMArrayBufferView>& value); template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<TrackBase>& value); template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); diff --git a/third_party/WebKit/Source/bindings/core/v8/PostMessage.h b/third_party/WebKit/Source/bindings/core/v8/PostMessage.h index eaed55e..efafd31 100644 --- a/third_party/WebKit/Source/bindings/core/v8/PostMessage.h +++ b/third_party/WebKit/Source/bindings/core/v8/PostMessage.h @@ -9,8 +9,8 @@ #include "bindings/core/v8/SerializedScriptValue.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8BindingMacros.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/MessagePort.h" -#include "wtf/ArrayBuffer.h" #include <v8.h> namespace blink { diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp index ce0499b..e13f780 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp @@ -32,25 +32,25 @@ #include "bindings/core/v8/SerializedScriptValue.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Blob.h" +#include "bindings/core/v8/V8DataView.h" #include "bindings/core/v8/V8File.h" #include "bindings/core/v8/V8FileList.h" +#include "bindings/core/v8/V8Float32Array.h" +#include "bindings/core/v8/V8Float64Array.h" #include "bindings/core/v8/V8ImageData.h" +#include "bindings/core/v8/V8Int16Array.h" +#include "bindings/core/v8/V8Int32Array.h" +#include "bindings/core/v8/V8Int8Array.h" #include "bindings/core/v8/V8MessagePort.h" +#include "bindings/core/v8/V8Uint16Array.h" +#include "bindings/core/v8/V8Uint32Array.h" +#include "bindings/core/v8/V8Uint8Array.h" +#include "bindings/core/v8/V8Uint8ClampedArray.h" #include "bindings/core/v8/WorkerScriptController.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8DataViewCustom.h" -#include "bindings/core/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" #include "bindings/modules/v8/V8CryptoKey.h" #include "bindings/modules/v8/V8DOMFileSystem.h" #include "core/dom/ExceptionCode.h" @@ -914,7 +914,7 @@ static v8::Handle<v8::Object> toV8Object(MessagePort* impl, v8::Handle<v8::Objec return wrapper.As<v8::Object>(); } -static v8::Handle<v8::ArrayBuffer> toV8Object(ArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +static v8::Handle<v8::ArrayBuffer> toV8Object(DOMArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) { if (!impl) return v8::Handle<v8::ArrayBuffer>(); @@ -1376,7 +1376,7 @@ private: StateBase* writeAndGreyArrayBufferView(v8::Handle<v8::Object> object, StateBase* next) { ASSERT(!object.IsEmpty()); - ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(object); + DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(object); if (!arrayBufferView) return 0; if (!arrayBufferView->buffer()) @@ -1387,7 +1387,7 @@ private: StateBase* stateOut = doSerializeArrayBuffer(underlyingBuffer, next); if (stateOut) return stateOut; - m_writer.writeArrayBufferView(*arrayBufferView); + m_writer.writeArrayBufferView(*arrayBufferView->view()); // This should be safe: we serialize something that we know to be a wrapper (see // the toV8 call above), so the call to doSerializeArrayBuffer should neither // cause the system stack to overflow nor should it have potential to reach @@ -1404,19 +1404,19 @@ private: StateBase* writeArrayBuffer(v8::Handle<v8::Value> value, StateBase* next) { - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); + DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); if (!arrayBuffer) return 0; if (arrayBuffer->isNeutered()) return handleError(DataCloneError, "An ArrayBuffer is neutered and could not be cloned.", next); ASSERT(!m_transferredArrayBuffers.contains(value.As<v8::Object>())); - m_writer.writeArrayBuffer(*arrayBuffer); + m_writer.writeArrayBuffer(*arrayBuffer->buffer()); return 0; } StateBase* writeTransferredArrayBuffer(v8::Handle<v8::Value> value, uint32_t index, StateBase* next) { - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); + DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(value.As<v8::Object>()); if (!arrayBuffer) return 0; if (arrayBuffer->isNeutered()) @@ -2037,10 +2037,8 @@ private: if (m_position + byteLength > m_length) return nullptr; const void* bufferStart = m_buffer + m_position; - RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(bufferStart, byteLength); - arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); m_position += byteLength; - return arrayBuffer.release(); + return ArrayBuffer::create(bufferStart, byteLength); } bool readArrayBuffer(v8::Handle<v8::Value>* value) @@ -2048,7 +2046,7 @@ private: RefPtr<ArrayBuffer> arrayBuffer = doReadArrayBuffer(); if (!arrayBuffer) return false; - *value = toV8(arrayBuffer.release(), m_scriptState->context()->Global(), isolate()); + *value = toV8(DOMArrayBuffer::create(arrayBuffer.release()), m_scriptState->context()->Global(), isolate()); return true; } @@ -2057,7 +2055,7 @@ private: ArrayBufferViewSubTag subTag; uint32_t byteOffset; uint32_t byteLength; - RefPtr<ArrayBuffer> arrayBuffer; + RefPtr<DOMArrayBuffer> arrayBuffer; v8::Handle<v8::Value> arrayBufferV8Value; if (!readArrayBufferViewSubTag(&subTag)) return false; @@ -2076,58 +2074,58 @@ private: v8::Handle<v8::Object> creationContext = m_scriptState->context()->Global(); switch (subTag) { case ByteArrayTag: - *value = toV8(Int8Array::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); + *value = toV8(DOMInt8Array::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); break; case UnsignedByteArrayTag: - *value = toV8(Uint8Array::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); + *value = toV8(DOMUint8Array::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); break; case UnsignedByteClampedArrayTag: - *value = toV8(Uint8ClampedArray::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); + *value = toV8(DOMUint8ClampedArray::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); break; case ShortArrayTag: { uint32_t shortLength = byteLength / sizeof(int16_t); if (shortLength * sizeof(int16_t) != byteLength) return false; - *value = toV8(Int16Array::create(arrayBuffer.release(), byteOffset, shortLength), creationContext, isolate()); + *value = toV8(DOMInt16Array::create(arrayBuffer.release(), byteOffset, shortLength), creationContext, isolate()); break; } case UnsignedShortArrayTag: { uint32_t shortLength = byteLength / sizeof(uint16_t); if (shortLength * sizeof(uint16_t) != byteLength) return false; - *value = toV8(Uint16Array::create(arrayBuffer.release(), byteOffset, shortLength), creationContext, isolate()); + *value = toV8(DOMUint16Array::create(arrayBuffer.release(), byteOffset, shortLength), creationContext, isolate()); break; } case IntArrayTag: { uint32_t intLength = byteLength / sizeof(int32_t); if (intLength * sizeof(int32_t) != byteLength) return false; - *value = toV8(Int32Array::create(arrayBuffer.release(), byteOffset, intLength), creationContext, isolate()); + *value = toV8(DOMInt32Array::create(arrayBuffer.release(), byteOffset, intLength), creationContext, isolate()); break; } case UnsignedIntArrayTag: { uint32_t intLength = byteLength / sizeof(uint32_t); if (intLength * sizeof(uint32_t) != byteLength) return false; - *value = toV8(Uint32Array::create(arrayBuffer.release(), byteOffset, intLength), creationContext, isolate()); + *value = toV8(DOMUint32Array::create(arrayBuffer.release(), byteOffset, intLength), creationContext, isolate()); break; } case FloatArrayTag: { uint32_t floatLength = byteLength / sizeof(float); if (floatLength * sizeof(float) != byteLength) return false; - *value = toV8(Float32Array::create(arrayBuffer.release(), byteOffset, floatLength), creationContext, isolate()); + *value = toV8(DOMFloat32Array::create(arrayBuffer.release(), byteOffset, floatLength), creationContext, isolate()); break; } case DoubleArrayTag: { uint32_t floatLength = byteLength / sizeof(double); if (floatLength * sizeof(double) != byteLength) return false; - *value = toV8(Float64Array::create(arrayBuffer.release(), byteOffset, floatLength), creationContext, isolate()); + *value = toV8(DOMFloat64Array::create(arrayBuffer.release(), byteOffset, floatLength), creationContext, isolate()); break; } case DataViewTag: - *value = toV8(DataView::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); + *value = toV8(DOMDataView::create(arrayBuffer.release(), byteOffset, byteLength), creationContext, isolate()); break; default: return false; @@ -2703,11 +2701,9 @@ public: return false; v8::Handle<v8::Object> result = m_arrayBuffers.at(index); if (result.IsEmpty()) { - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(m_arrayBufferContents->at(index)); - buffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); + RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(m_arrayBufferContents->at(index)); v8::Isolate* isolate = m_reader.scriptState()->isolate(); v8::Handle<v8::Object> creationContext = m_reader.scriptState()->context()->Global(); - isolate->AdjustAmountOfExternalAllocatedMemory(buffer->byteLength()); result = toV8Object(buffer.get(), creationContext, isolate); m_arrayBuffers[index] = result; } @@ -2887,7 +2883,7 @@ SerializedScriptValue::SerializedScriptValue() { } -static void neuterArrayBufferInAllWorlds(ArrayBuffer* object) +static void neuterArrayBufferInAllWorlds(DOMArrayBuffer* object) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); if (isMainThread()) { @@ -2922,7 +2918,7 @@ PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); - HashSet<ArrayBuffer*> visited; + HashSet<DOMArrayBuffer*> visited; for (size_t i = 0; i < arrayBuffers.size(); i++) { if (visited.contains(arrayBuffers[i].get())) continue; @@ -3042,7 +3038,7 @@ bool SerializedScriptValue::extractTransferables(v8::Local<v8::Value> value, int } ports.append(port.release()); } else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) { - RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(transferrable)); + RefPtr<DOMArrayBuffer> arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(transferrable)); if (arrayBuffers.contains(arrayBuffer)) { exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); return false; diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h index 8e9b576..dbfe07b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h @@ -46,12 +46,13 @@ class ArrayBufferContents; namespace blink { class BlobDataHandle; +class DOMArrayBuffer; class ExceptionState; class MessagePort; class WebBlobInfo; typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; -typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; +typedef Vector<RefPtr<DOMArrayBuffer>, 1> ArrayBufferArray; typedef HashMap<String, RefPtr<BlobDataHandle> > BlobDataHandleMap; typedef Vector<blink::WebBlobInfo> WebBlobInfoArray; diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.cpp deleted file mode 100644 index ace4393..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" - -#include "bindings/core/v8/V8Binding.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/StdLibExtras.h" - -namespace blink { - -using namespace WTF; - -V8ArrayBufferDeallocationObserver* V8ArrayBufferDeallocationObserver::instanceTemplate() -{ - DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver, ()); - return &deallocationObserver; -} - -const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { - gin::kEmbedderBlink, - 0, - V8ArrayBuffer::refObject, - V8ArrayBuffer::derefObject, - V8ArrayBuffer::trace, - 0, 0, 0, 0, 0, 0, - WrapperTypeInfo::WrapperTypeObjectPrototype, - WrapperTypeInfo::ObjectClassId, - WrapperTypeInfo::Independent, - WrapperTypeInfo::RefCountedObject -}; - -bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) -{ - return value->IsArrayBuffer(); -} - -void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) -{ - toImpl(internalPointer)->ref(); -} - -void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) -{ - toImpl(internalPointer)->deref(); -} - -v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - ASSERT(impl.get()); - ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); - - v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(), impl->byteLength()); - impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); - - V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeInfo, wrapper, isolate); - return wrapper; -} - -ArrayBuffer* V8ArrayBuffer::toImpl(v8::Handle<v8::Object> object) -{ - ASSERT(object->IsArrayBuffer()); - v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); - if (v8buffer->IsExternal()) { - RELEASE_ASSERT(toWrapperTypeInfo(object)->ginEmbedder == gin::kEmbedderBlink); - return reinterpret_cast<ArrayBuffer*>(blink::toScriptWrappableBase(object)); - } - - v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); - ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), - V8ArrayBufferDeallocationObserver::instanceTemplate()); - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents); - V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &wrapperTypeInfo, object, v8::Isolate::GetCurrent()); - - return reinterpret_cast<ArrayBuffer*>(blink::toScriptWrappableBase(object)); -} - -ArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) -{ - return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; -} - -template<> -v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl, creationContext, isolate); -} - -} // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.h deleted file mode 100644 index 20401c1..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferCustom.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef V8ArrayBufferCustom_h -#define V8ArrayBufferCustom_h - -#include "bindings/core/v8/V8Binding.h" -#include "bindings/core/v8/V8DOMWrapper.h" -#include "bindings/core/v8/WrapperTypeInfo.h" -#include "wtf/ArrayBuffer.h" -#include <v8.h> - -namespace blink { - -class V8ArrayBufferDeallocationObserver final: public WTF::ArrayBufferDeallocationObserver { -public: - virtual void arrayBufferDeallocated(unsigned sizeInBytes) override - { - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-static_cast<int>(sizeInBytes)); - } - static V8ArrayBufferDeallocationObserver* instanceTemplate(); - -protected: - virtual void blinkAllocatedMemory(unsigned sizeInBytes) override - { - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(static_cast<int>(sizeInBytes)); - } -}; - -class V8ArrayBuffer { -public: - static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); - static ArrayBuffer* toImpl(v8::Handle<v8::Object>); - static ArrayBuffer* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); - static void refObject(ScriptWrappableBase* internalPointer); - static void derefObject(ScriptWrappableBase* internalPointer); - static void trace(Visitor*, ScriptWrappableBase* internalPointer) { } - static const WrapperTypeInfo wrapperTypeInfo; - static const int internalFieldCount = v8DefaultWrapperInternalFieldCount; - - static inline ScriptWrappableBase* toScriptWrappableBase(ArrayBuffer* impl) - { - return reinterpret_cast<ScriptWrappableBase*>(impl); - } - - static inline ArrayBuffer* toImpl(ScriptWrappableBase* internalPointer) - { - return reinterpret_cast<ArrayBuffer*>(internalPointer); - } - -private: - friend v8::Handle<v8::Object> wrap(ArrayBuffer*, v8::Handle<v8::Object> creationContext, v8::Isolate*); - static v8::Handle<v8::Object> createWrapper(PassRefPtr<ArrayBuffer>, v8::Handle<v8::Object> creationContext, v8::Isolate*); -}; - -inline v8::Handle<v8::Object> wrap(ArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - ASSERT(impl); - ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl, isolate)); - return V8ArrayBuffer::createWrapper(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(ArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - if (UNLIKELY(!impl)) - return v8::Null(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBuffer>(impl, isolate); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, ArrayBuffer* impl) -{ - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapper<V8ArrayBuffer>(info.GetReturnValue(), impl)) - return; - v8::Handle<v8::Object> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - v8SetReturnValue(info, wrapper); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, ArrayBuffer* impl) -{ - ASSERT(DOMWrapperWorld::current(info.GetIsolate()).isMainWorld()); - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8ArrayBuffer>(info.GetReturnValue(), impl)) - return; - v8::Handle<v8::Value> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - v8SetReturnValue(info, wrapper); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, ArrayBuffer* impl, Wrappable* wrappable) -{ - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapperFast<V8ArrayBuffer>(info.GetReturnValue(), impl, info.Holder(), wrappable)) - return; - v8::Handle<v8::Object> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - v8SetReturnValue(info, wrapper); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< ArrayBuffer > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr< ArrayBuffer > impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr< ArrayBuffer > impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr< ArrayBuffer > impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif // V8ArrayBufferCustom_h diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.cpp deleted file mode 100644 index 8fdd9f3..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" - -#include "bindings/core/v8/custom/V8DataViewCustom.h" -#include "bindings/core/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" -#include <v8.h> - -namespace blink { - -using namespace WTF; - -ArrayBufferView* V8ArrayBufferView::toImpl(v8::Handle<v8::Object> object) -{ - ASSERT(object->IsArrayBufferView()); - ScriptWrappableBase* viewPtr = blink::toScriptWrappableBase(object); - if (viewPtr) - return reinterpret_cast<ArrayBufferView*>(viewPtr); - - if (object->IsUint8Array()) { - return V8Uint8Array::toImpl(object); - } - if (object->IsInt8Array()) { - return V8Int8Array::toImpl(object); - } - if (object->IsUint16Array()) { - return V8Uint16Array::toImpl(object); - } - if (object->IsInt16Array()) { - return V8Int16Array::toImpl(object); - } - if (object->IsUint32Array()) { - return V8Uint32Array::toImpl(object); - } - if (object->IsInt32Array()) { - return V8Int32Array::toImpl(object); - } - if (object->IsFloat32Array()) { - return V8Float32Array::toImpl(object); - } - if (object->IsFloat64Array()) { - return V8Float64Array::toImpl(object); - } - if (object->IsUint8ClampedArray()) { - return V8Uint8ClampedArray::toImpl(object); - } - if (object->IsDataView()) { - return V8DataView::toImpl(object); - } - ASSERT_NOT_REACHED(); - return 0; -} - -ArrayBufferView* V8ArrayBufferView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) -{ - return V8ArrayBufferView::hasInstance(value, isolate) ? V8ArrayBufferView::toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; -} - -} // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.h deleted file mode 100644 index 380aeb9..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2009, 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8ArrayBufferViewCustom_h -#define V8ArrayBufferViewCustom_h - -#include "bindings/core/v8/V8Binding.h" -#include "bindings/core/v8/V8ObjectConstructor.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "core/dom/ExceptionCode.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" - -namespace blink { - - -class V8ArrayBufferView { -public: - static bool hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) - { - return value->IsArrayBufferView(); - } - static ArrayBufferView* toImpl(v8::Handle<v8::Object>); - static ArrayBufferView* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); - - static inline ScriptWrappableBase* toScriptWrappableBase(ArrayBufferView* impl) - { - return reinterpret_cast<ScriptWrappableBase*>(impl); - } -}; - - -} // namespace blink -#endif // V8ArrayBufferViewCustom_h diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8BlobCustomHelpers.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8BlobCustomHelpers.cpp index 51af63d..dd4f4a5 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8BlobCustomHelpers.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8BlobCustomHelpers.cpp @@ -33,10 +33,11 @@ #include "bindings/core/v8/Dictionary.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Blob.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" +#include "core/dom/ExceptionCode.h" #include "wtf/DateMath.h" namespace blink { @@ -117,13 +118,13 @@ bool processBlobParts(v8::Local<v8::Object> blobParts, bool normalizeLineEndings return false; if (V8ArrayBuffer::hasInstance(item, isolate)) { - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(item)); + DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(item)); ASSERT(arrayBuffer); - blobData.appendArrayBuffer(arrayBuffer); + blobData.appendArrayBuffer(arrayBuffer->buffer()); } else if (V8ArrayBufferView::hasInstance(item, isolate)) { - ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Handle<v8::Object>::Cast(item)); + DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Handle<v8::Object>::Cast(item)); ASSERT(arrayBufferView); - blobData.appendArrayBufferView(arrayBufferView); + blobData.appendArrayBufferView(arrayBufferView->view()); } else if (V8Blob::hasInstance(item, isolate)) { Blob* blob = V8Blob::toImpl(v8::Handle<v8::Object>::Cast(item)); ASSERT(blob); diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.cpp deleted file mode 100644 index 02b85b2..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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. - */ - -#include "config.h" -#include "bindings/core/v8/custom/V8DataViewCustom.h" - -#include "bindings/core/v8/custom/V8TypedArrayCustom.h" -#include "core/html/canvas/DataView.h" - -namespace blink { - -const WrapperTypeInfo& DataView::s_wrapperTypeInfo = V8TypedArray<DataView>::wrapperTypeInfo; - -} // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.h deleted file mode 100644 index 1cf348b..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8DataViewCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "core/html/canvas/DataView.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, DataView* impl) -{ - V8TypedArray<DataView>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, DataView* impl) -{ - V8TypedArray<DataView>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, DataView* impl, Wrappable* wrappable) -{ - V8TypedArray<DataView>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< DataView > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<DataView> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<DataView> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<DataView> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8FileReaderCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8FileReaderCustom.cpp index 5cfb8f7..89dfe5b 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8FileReaderCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8FileReaderCustom.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "bindings/core/v8/V8FileReader.h" +#include "bindings/core/v8/V8ArrayBuffer.h" #include "bindings/core/v8/V8Binding.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" #include "core/dom/ExecutionContext.h" namespace blink { @@ -42,7 +42,7 @@ void V8FileReader::resultAttributeGetterCustom(const v8::PropertyCallbackInfo<v8 v8::Handle<v8::Object> holder = info.Holder(); FileReader* impl = V8FileReader::toImpl(holder); if (impl->readType() == FileReaderLoader::ReadAsArrayBuffer) { - v8SetReturnValueFast(info, impl->arrayBufferResult(), impl); + v8SetReturnValueFast(info, DOMArrayBuffer::create(impl->arrayBufferResult()), impl); return; } v8SetReturnValueStringOrNull(info, impl->stringResult(), info.GetIsolate()); diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Float32ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Float32ArrayCustom.h deleted file mode 100644 index 0bc1a06..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Float32ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float32Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Float32Array* impl) -{ - V8TypedArray<Float32Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Float32Array* impl) -{ - V8TypedArray<Float32Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Float32Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Float32Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr< Float32Array > impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr< Float32Array > impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr< Float32Array > impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Float64ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Float64ArrayCustom.h deleted file mode 100644 index eb8a625..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Float64ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float64Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Float64Array* impl) -{ - V8TypedArray<Float64Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Float64Array* impl) -{ - V8TypedArray<Float64Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Float64Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Float64Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float64Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Float64Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Float64Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Float64Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp index b395b52..cad04caf 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp @@ -45,15 +45,6 @@ #include "bindings/core/v8/V8NodeList.h" #include "bindings/core/v8/V8ScriptRunner.h" #include "bindings/core/v8/V8Storage.h" -#include "bindings/core/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" #include "core/events/EventTarget.h" #include "core/frame/LocalDOMWindow.h" #include "core/inspector/InjectedScript.h" diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int16ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Int16ArrayCustom.h deleted file mode 100644 index 756b5c8..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int16ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int16Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Int16Array* impl) -{ - V8TypedArray<Int16Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Int16Array* impl) -{ - V8TypedArray<Int16Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Int16Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Int16Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Int16Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Int16Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Int16Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int32ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Int32ArrayCustom.h deleted file mode 100644 index 97f26d5..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int32ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int32Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Int32Array* impl) -{ - V8TypedArray<Int32Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Int32Array* impl) -{ - V8TypedArray<Int32Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Int32Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Int32Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Int32Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Int32Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Int32Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int8ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Int8ArrayCustom.h deleted file mode 100644 index 1081b30..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Int8ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int8Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Int8Array* impl) -{ - V8TypedArray<Int8Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Int8Array* impl) -{ - V8TypedArray<Int8Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Int8Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Int8Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Int8Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Int8Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Int8Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp index fda2283..a13e750 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp @@ -32,12 +32,12 @@ #include "bindings/core/v8/V8MessageEvent.h" #include "bindings/core/v8/SerializedScriptValue.h" +#include "bindings/core/v8/V8ArrayBuffer.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Blob.h" #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8MessagePort.h" #include "bindings/core/v8/V8Window.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" #include "core/events/MessageEvent.h" namespace blink { diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8TypedArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8TypedArrayCustom.h deleted file mode 100644 index ad49ba9..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8TypedArrayCustom.h +++ /dev/null @@ -1,219 +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/core/v8/V8Binding.h" -#include "bindings/core/v8/V8DOMWrapper.h" -#include "bindings/core/v8/WrapperTypeInfo.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "wtf/ArrayBuffer.h" -#include <v8.h> - -namespace blink { - -template<typename T> -class TypedArrayTraits -{ }; - -template<typename TypedArray> -class V8TypedArray { -public: - static bool hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) - { - return TypedArrayTraits<TypedArray>::IsInstance(value); - } - - static TypedArray* toImpl(v8::Handle<v8::Object>); - static TypedArray* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); - static void refObject(ScriptWrappableBase* internalPointer); - static void derefObject(ScriptWrappableBase* internalPointer); - static void trace(Visitor*, ScriptWrappableBase* internalPointer); - static const WrapperTypeInfo wrapperTypeInfo; - 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::containsWrapper<Binding>(impl, isolate)); - 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 v8::Null(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<Binding>(impl, isolate); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); - } - - template<typename CallbackInfo> - static void v8SetReturnValue(const CallbackInfo& info, TypedArray* impl) - { - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapper<Binding>(info.GetReturnValue(), impl)) - return; - v8::Handle<v8::Object> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - info.GetReturnValue().Set(wrapper); - } - - template<typename CallbackInfo> - static void v8SetReturnValueForMainWorld(const CallbackInfo& info, TypedArray* impl) - { - ASSERT(DOMWrapperWorld::current(info.GetIsolate()).isMainWorld()); - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapperForMainWorld<Binding>(info.GetReturnValue(), impl)) - return; - v8::Handle<v8::Value> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - info.GetReturnValue().Set(wrapper); - } - - template<class CallbackInfo, class Wrappable> - static void v8SetReturnValueFast(const CallbackInfo& info, TypedArray* impl, Wrappable* wrappable) - { - if (UNLIKELY(!impl)) { - v8SetReturnValueNull(info); - return; - } - if (DOMDataStore::setReturnValueFromWrapperFast<Binding>(info.GetReturnValue(), impl, info.Holder(), wrappable)) - return; - v8::Handle<v8::Object> wrapper = wrap(impl, info.Holder(), info.GetIsolate()); - info.GetReturnValue().Set(wrapper); - } - - static inline ScriptWrappableBase* toScriptWrappableBase(TypedArray* impl) - { - return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl)); - } - - static inline TypedArray* toImpl(ScriptWrappableBase* internalPointer) - { - return reinterpret_cast<TypedArray*>(static_cast<void*>(internalPointer)); - } -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 const WrapperTypeInfo* info() { return &V8TypedArray<TypedArray>::wrapperTypeInfo; } -}; - - -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::containsWrapper<Binding>(impl.get(), isolate)); - - RefPtr<ArrayBuffer> buffer = impl->buffer(); - v8::Local<v8::Value> v8Buffer = blink::toV8(buffer.get(), creationContext, isolate); - - ASSERT(v8Buffer->IsArrayBuffer()); - - v8::Local<v8::Object> wrapper = V8Type::New(v8Buffer.As<v8::ArrayBuffer>(), impl->byteOffset(), Traits::length(impl.get())); - - V8DOMWrapper::associateObjectWithWrapper<Binding>(impl, &wrapperTypeInfo, wrapper, isolate); - return wrapper; -} - -template <typename TypedArray> -TypedArray* V8TypedArray<TypedArray>::toImpl(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::toImpl(view->Buffer()); - RefPtr<TypedArray> typedArray = TypedArray::create(arrayBuffer, view->ByteOffset(), Traits::length(view)); - ASSERT(typedArray.get()); - V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &wrapperTypeInfo, object, v8::Isolate::GetCurrent()); - - typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - ASSERT(typedarrayPtr); - return reinterpret_cast<TypedArray*>(typedarrayPtr); -} - -template <typename TypedArray> -TypedArray* V8TypedArray<TypedArray>::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) -{ - return V8TypedArray<TypedArray>::hasInstance(value, isolate) ? V8TypedArray<TypedArray>::toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; -} - -template <typename TypedArray> -const WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = { - gin::kEmbedderBlink, - 0, - V8TypedArray<TypedArray>::refObject, - V8TypedArray<TypedArray>::derefObject, - V8TypedArray<TypedArray>::trace, - 0, 0, 0, 0, 0, 0, - WrapperTypeInfo::WrapperTypeObjectPrototype, - WrapperTypeInfo::ObjectClassId, - WrapperTypeInfo::Independent, - WrapperTypeInfo::RefCountedObject -}; - -template <typename TypedArray> -void V8TypedArray<TypedArray>::refObject(ScriptWrappableBase* internalPointer) -{ - toImpl(internalPointer)->ref(); -} - -template <typename TypedArray> -void V8TypedArray<TypedArray>::derefObject(ScriptWrappableBase* internalPointer) -{ - toImpl(internalPointer)->deref(); -} - -template <typename TypedArray> -void V8TypedArray<TypedArray>::trace(Visitor*, ScriptWrappableBase*) -{ -} - -} // namespace blink - -#endif // V8TypedArrayCustom_h diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint16ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint16ArrayCustom.h deleted file mode 100644 index cfb996b..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint16ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint16Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Uint16Array* impl) -{ - V8TypedArray<Uint16Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Uint16Array* impl) -{ - V8TypedArray<Uint16Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Uint16Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Uint16Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Uint16Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Uint16Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Uint16Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint32ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint32ArrayCustom.h deleted file mode 100644 index 60b82c4..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint32ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint32Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Uint32Array* impl) -{ - V8TypedArray<Uint32Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Uint32Array* impl) -{ - V8TypedArray<Uint32Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Uint32Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Uint32Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Uint32Array> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Uint32Array> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Uint32Array> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ArrayCustom.h deleted file mode 100644 index da60a89..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8Array.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Uint8Array* impl) -{ - V8TypedArray<Uint8Array>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Uint8Array* impl) -{ - V8TypedArray<Uint8Array>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Uint8Array* impl, Wrappable* wrappable) -{ - V8TypedArray<Uint8Array>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr< Uint8Array > impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr< Uint8Array > impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr< Uint8Array > impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h b/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h deleted file mode 100644 index c8e1d9b..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h +++ /dev/null @@ -1,115 +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/core/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8ClampedArray.h" - -namespace blink { - -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; - -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); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, Uint8ClampedArray* impl) -{ - V8TypedArray<Uint8ClampedArray>::v8SetReturnValue(info, impl); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, Uint8ClampedArray* impl) -{ - V8TypedArray<Uint8ClampedArray>::v8SetReturnValueForMainWorld(info, impl); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, Uint8ClampedArray* impl, Wrappable* wrappable) -{ - V8TypedArray<Uint8ClampedArray>::v8SetReturnValueFast(info, impl, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8ClampedArray > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -template<class CallbackInfo> -inline void v8SetReturnValue(const CallbackInfo& info, PassRefPtr<Uint8ClampedArray> impl) -{ - v8SetReturnValue(info, impl.get()); -} - -template<class CallbackInfo> -inline void v8SetReturnValueForMainWorld(const CallbackInfo& info, PassRefPtr<Uint8ClampedArray> impl) -{ - v8SetReturnValueForMainWorld(info, impl.get()); -} - -template<class CallbackInfo, class Wrappable> -inline void v8SetReturnValueFast(const CallbackInfo& info, PassRefPtr<Uint8ClampedArray> impl, Wrappable* wrappable) -{ - v8SetReturnValueFast(info, impl.get(), wrappable); -} - -} // namespace blink - -#endif diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WebGLRenderingContextCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WebGLRenderingContextCustom.cpp index 0b61b74..68bdb8d 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -33,16 +33,19 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/V8ANGLEInstancedArrays.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8EXTBlendMinMax.h" #include "bindings/core/v8/V8EXTFragDepth.h" #include "bindings/core/v8/V8EXTShaderTextureLOD.h" #include "bindings/core/v8/V8EXTTextureFilterAnisotropic.h" +#include "bindings/core/v8/V8Float32Array.h" #include "bindings/core/v8/V8HTMLCanvasElement.h" #include "bindings/core/v8/V8HTMLImageElement.h" #include "bindings/core/v8/V8HTMLVideoElement.h" #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8ImageData.h" +#include "bindings/core/v8/V8Int32Array.h" #include "bindings/core/v8/V8OESElementIndexUint.h" #include "bindings/core/v8/V8OESStandardDerivatives.h" #include "bindings/core/v8/V8OESTextureFloat.h" @@ -50,6 +53,8 @@ #include "bindings/core/v8/V8OESTextureHalfFloat.h" #include "bindings/core/v8/V8OESTextureHalfFloatLinear.h" #include "bindings/core/v8/V8OESVertexArrayObject.h" +#include "bindings/core/v8/V8Uint32Array.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "bindings/core/v8/V8WebGLBuffer.h" #include "bindings/core/v8/V8WebGLCompressedTextureATC.h" #include "bindings/core/v8/V8WebGLCompressedTextureETC1.h" @@ -67,19 +72,9 @@ #include "bindings/core/v8/V8WebGLTexture.h" #include "bindings/core/v8/V8WebGLUniformLocation.h" #include "bindings/core/v8/V8WebGLVertexArrayObjectOES.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "core/html/canvas/WebGLRenderingContext.h" #include "platform/NotImplemented.h" -#include "wtf/FastMalloc.h" -#include <limits> namespace blink { @@ -513,7 +508,7 @@ static void vertexAttribAndUniformHelperf(const v8::FunctionCallbackInfo<v8::Val const int indexArrayArgument = 1; if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate())) { - Float32Array* array = V8Float32Array::toImpl(info[indexArrayArgument]->ToObject()); + DOMFloat32Array* array = V8Float32Array::toImpl(info[indexArrayArgument]->ToObject()); ASSERT(array); switch (functionToCall) { case kUniform1v: context->uniform1fv(location, array); break; @@ -584,7 +579,7 @@ static void uniformHelperi(const v8::FunctionCallbackInfo<v8::Value>& info, Func const int indexArrayArgumentIndex = 1; if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate())) { - Int32Array* array = V8Int32Array::toImpl(info[indexArrayArgumentIndex]->ToObject()); + DOMInt32Array* array = V8Int32Array::toImpl(info[indexArrayArgumentIndex]->ToObject()); ASSERT(array); switch (functionToCall) { case kUniform1v: context->uniform1iv(location, array); break; @@ -696,7 +691,7 @@ static void uniformMatrixHelper(const v8::FunctionCallbackInfo<v8::Value>& info, bool transpose = info[1]->BooleanValue(); const int arrayArgumentIndex = 2; if (V8Float32Array::hasInstance(info[arrayArgumentIndex], info.GetIsolate())) { - Float32Array* array = V8Float32Array::toImpl(info[arrayArgumentIndex]->ToObject()); + DOMFloat32Array* array = V8Float32Array::toImpl(info[arrayArgumentIndex]->ToObject()); ASSERT(array); switch (matrixSize) { case 2: context->uniformMatrix2fv(location, transpose, array); break; diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp index 6a82931..2b607c7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp @@ -45,6 +45,7 @@ #include "bindings/core/v8/V8HTMLCollection.h" #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8Node.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/ExceptionCode.h" #include "core/dom/MessagePort.h" #include "core/frame/DOMTimer.h" @@ -62,7 +63,6 @@ #include "core/storage/Storage.h" #include "platform/PlatformScreen.h" #include "platform/graphics/media/MediaPlayer.h" -#include "wtf/ArrayBuffer.h" #include "wtf/Assertions.h" #include "wtf/OwnPtr.h" diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp index 415a88c..090eeae 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8XMLHttpRequestCustom.cpp @@ -33,6 +33,8 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Blob.h" #include "bindings/core/v8/V8Document.h" @@ -40,15 +42,12 @@ #include "bindings/core/v8/V8HTMLDocument.h" #include "bindings/core/v8/V8ReadableStream.h" #include "bindings/core/v8/V8Stream.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/Document.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/streams/ReadableStream.h" #include "core/streams/Stream.h" #include "core/workers/WorkerGlobalScope.h" #include "core/xml/XMLHttpRequest.h" -#include "wtf/ArrayBuffer.h" #include <v8.h> namespace blink { @@ -67,7 +66,7 @@ void V8XMLHttpRequest::constructorCustom(const v8::FunctionCallbackInfo<v8::Valu RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context, securityOrigin); v8::Handle<v8::Object> wrapper = info.Holder(); - V8DOMWrapper::associateObjectWithWrapper<V8XMLHttpRequest>(xmlHttpRequest.release(), &wrapperTypeInfo, wrapper, info.GetIsolate()); + xmlHttpRequest->associateWithWrapper(xmlHttpRequest->wrapperTypeInfo(), wrapper, info.GetIsolate()); info.GetReturnValue().Set(wrapper); } @@ -148,10 +147,7 @@ void V8XMLHttpRequest::responseAttributeGetterCustom(const v8::PropertyCallbackI case XMLHttpRequest::ResponseTypeArrayBuffer: { - ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); - if (arrayBuffer) { - arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); - } + DOMArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); v8SetReturnValueFast(info, arrayBuffer, xmlHttpRequest); return; } @@ -240,14 +236,14 @@ void V8XMLHttpRequest::sendMethodCustom(const v8::FunctionCallbackInfo<v8::Value xmlHttpRequest->send(domFormData, exceptionState); } else if (V8ArrayBuffer::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(object); + DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(object); ASSERT(arrayBuffer); - xmlHttpRequest->send(arrayBuffer, exceptionState); + xmlHttpRequest->send(arrayBuffer->buffer(), exceptionState); } else if (V8ArrayBufferView::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); - ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(object); + DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(object); ASSERT(arrayBufferView); - xmlHttpRequest->send(arrayBufferView, exceptionState); + xmlHttpRequest->send(arrayBufferView->view(), exceptionState); } else { TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, argString, arg); xmlHttpRequest->send(argString, exceptionState); diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/custom.gypi b/third_party/WebKit/Source/bindings/core/v8/custom/custom.gypi index 110deed..eedc2b7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/custom.gypi +++ b/third_party/WebKit/Source/bindings/core/v8/custom/custom.gypi @@ -5,10 +5,6 @@ { 'variables': { 'bindings_core_v8_custom_files': [ - 'V8ArrayBufferCustom.cpp', - 'V8ArrayBufferCustom.h', - 'V8ArrayBufferViewCustom.cpp', - 'V8ArrayBufferViewCustom.h', 'V8BlobCustom.cpp', 'V8BlobCustomHelpers.cpp', 'V8BlobCustomHelpers.h', @@ -19,8 +15,6 @@ 'V8CustomEventCustom.cpp', 'V8CustomXPathNSResolver.cpp', 'V8CustomXPathNSResolver.h', - 'V8DataViewCustom.cpp', - 'V8DataViewCustom.h', 'V8DedicatedWorkerGlobalScopeCustom.cpp', 'V8DocumentCustom.cpp', 'V8ElementCustom.cpp', @@ -29,8 +23,6 @@ 'V8EventTargetCustom.cpp', 'V8FileCustom.cpp', 'V8FileReaderCustom.cpp', - 'V8Float32ArrayCustom.h', - 'V8Float64ArrayCustom.h', 'V8HTMLAllCollectionCustom.cpp', 'V8HTMLCanvasElementCustom.cpp', 'V8HTMLDocumentCustom.cpp', @@ -40,9 +32,6 @@ 'V8InjectedScriptHostCustom.cpp', 'V8InjectedScriptManager.cpp', 'V8InspectorFrontendHostCustom.cpp', - 'V8Int16ArrayCustom.h', - 'V8Int32ArrayCustom.h', - 'V8Int8ArrayCustom.h', 'V8JavaScriptCallFrameCustom.cpp', 'V8LocationCustom.cpp', 'V8MessageChannelCustom.cpp', @@ -51,11 +40,6 @@ 'V8MutationObserverCustom.cpp', 'V8PopStateEventCustom.cpp', 'V8TrackEventCustom.cpp', - 'V8TypedArrayCustom.h', - 'V8Uint16ArrayCustom.h', - 'V8Uint32ArrayCustom.h', - 'V8Uint8ArrayCustom.h', - 'V8Uint8ClampedArrayCustom.h', 'V8WebGLRenderingContextCustom.cpp', 'V8WindowCustom.cpp', 'V8WorkerCustom.cpp', diff --git a/third_party/WebKit/Source/bindings/modules/v8/IDBBindingUtilities.cpp b/third_party/WebKit/Source/bindings/modules/v8/IDBBindingUtilities.cpp index a4d335b..ccfefa7 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/IDBBindingUtilities.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/IDBBindingUtilities.cpp @@ -27,11 +27,11 @@ #include "bindings/modules/v8/IDBBindingUtilities.h" #include "bindings/core/v8/SerializedScriptValue.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8DOMStringList.h" #include "bindings/core/v8/V8HiddenValue.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "bindings/modules/v8/V8IDBCursor.h" #include "bindings/modules/v8/V8IDBCursorWithValue.h" #include "bindings/modules/v8/V8IDBDatabase.h" @@ -46,7 +46,6 @@ #include "modules/indexeddb/IDBTracing.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/SharedBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/MathExtras.h" #include "wtf/Uint8Array.h" #include "wtf/Vector.h" @@ -90,7 +89,7 @@ static v8::Local<v8::Value> toV8(const IDBKey* key, v8::Local<v8::Object> creati case IDBKey::StringType: return v8String(isolate, key->string()); case IDBKey::BinaryType: - return toV8(Uint8Array::create(reinterpret_cast<const unsigned char*>(key->binary()->data()), key->binary()->size()), creationContext, isolate); + return toV8(DOMUint8Array::create(reinterpret_cast<const unsigned char*>(key->binary()->data()), key->binary()->size()), creationContext, isolate); case IDBKey::DateType: return v8::Date::New(isolate, key->date()); case IDBKey::ArrayType: @@ -184,7 +183,7 @@ static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Local<v8::Value> if (value->IsUint8Array() && (allowExperimentalTypes || RuntimeEnabledFeatures::indexedDBExperimentalEnabled())) { // Per discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=23332 the // input type is constrained to Uint8Array to match the output type. - ArrayBufferView* view = blink::V8ArrayBufferView::toImpl(value->ToObject()); + DOMArrayBufferView* view = blink::V8ArrayBufferView::toImpl(value->ToObject()); const char* start = static_cast<const char*>(view->baseAddress()); size_t length = view->byteLength(); return IDBKey::createBinary(SharedBuffer::create(start, length)); diff --git a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoCustom.cpp b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoCustom.cpp index e3ae3fc..d85dc06 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoCustom.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoCustom.cpp @@ -27,11 +27,10 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/ExceptionCode.h" #include "modules/crypto/Crypto.h" -#include "wtf/ArrayBufferView.h" namespace blink { @@ -48,11 +47,11 @@ void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Va if (!V8ArrayBufferView::hasInstance(buffer, info.GetIsolate())) { exceptionState.throwTypeError("First argument is not an ArrayBufferView"); } else { - ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(buffer)); + DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Local<v8::Object>::Cast(buffer)); ASSERT(arrayBufferView); Crypto* crypto = V8Crypto::toImpl(info.Holder()); - crypto->getRandomValues(arrayBufferView, exceptionState); + crypto->getRandomValues(arrayBufferView->view(), exceptionState); } if (exceptionState.throwIfNeeded()) diff --git a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp index 5dab691..a40bb37 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp @@ -7,7 +7,7 @@ #include "bindings/core/v8/Dictionary.h" #include "bindings/core/v8/V8Binding.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "public/platform/WebCryptoKeyAlgorithm.h" #include "wtf/Uint8Array.h" @@ -43,8 +43,7 @@ public: virtual void setUint8Array(const char* propertyName, const blink::WebVector<unsigned char>& vector) { - RefPtr<Uint8Array> uint8Array = Uint8Array::create(vector.data(), vector.size()); - m_dictionary.set(propertyName, toV8(uint8Array.get(), m_holder, m_isolate)); + m_dictionary.set(propertyName, toV8(DOMUint8Array::create(vector.data(), vector.size()), m_holder, m_isolate)); } const Dictionary& dictionary() const { return m_dictionary; } diff --git a/third_party/WebKit/Source/bindings/modules/v8/custom/V8SubtleCryptoCustom.cpp b/third_party/WebKit/Source/bindings/modules/v8/custom/V8SubtleCryptoCustom.cpp index 054ab38..990f8ee 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/custom/V8SubtleCryptoCustom.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/custom/V8SubtleCryptoCustom.cpp @@ -6,8 +6,8 @@ #include "bindings/modules/v8/V8SubtleCrypto.h" #include "bindings/core/v8/Dictionary.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/modules/v8/V8CryptoKey.h" namespace blink { @@ -27,8 +27,8 @@ void verify1Method(const v8::FunctionCallbackInfo<v8::Value>& info) return; } TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsolate(), info[1])); - TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0); - TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0); + TONATIVE_VOID(DOMArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0); + TONATIVE_VOID(DOMArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0); v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value()); } @@ -42,8 +42,8 @@ void verify2Method(const v8::FunctionCallbackInfo<v8::Value>& info) return; } TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsolate(), info[1])); - TONATIVE_VOID(ArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0); - TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0); + TONATIVE_VOID(DOMArrayBuffer*, signature, info[2]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[2])) : 0); + TONATIVE_VOID(DOMArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0); v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value()); } @@ -57,8 +57,8 @@ void verify3Method(const v8::FunctionCallbackInfo<v8::Value>& info) return; } TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsolate(), info[1])); - TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0); - TONATIVE_VOID(ArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0); + TONATIVE_VOID(DOMArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0); + TONATIVE_VOID(DOMArrayBuffer*, data, info[3]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Local<v8::ArrayBuffer>::Cast(info[3])) : 0); v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value()); } @@ -72,8 +72,8 @@ void verify4Method(const v8::FunctionCallbackInfo<v8::Value>& info) return; } TONATIVE_VOID(CryptoKey*, key, V8CryptoKey::toImplWithTypeCheck(info.GetIsolate(), info[1])); - TONATIVE_VOID(ArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0); - TONATIVE_VOID(ArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0); + TONATIVE_VOID(DOMArrayBufferView*, signature, info[2]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[2])) : 0); + TONATIVE_VOID(DOMArrayBufferView*, data, info[3]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Local<v8::ArrayBufferView>::Cast(info[3])) : 0); v8SetReturnValue(info, impl->verifySignature(ScriptState::current(info.GetIsolate()), algorithm, key, signature, data).v8Value()); } diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py index 065873d..b23f63f 100644 --- a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py +++ b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py @@ -168,7 +168,10 @@ class CodeGeneratorV8(CodeGeneratorBase): template_context = interface_context(interface) # Add the include for interface itself - template_context['header_includes'].add(interface_info['include_path']) + if IdlType(interface_name).is_typed_array: + template_context['header_includes'].add('core/dom/DOMTypedArray.h') + else: + template_context['header_includes'].add(interface_info['include_path']) header_text, cpp_text = render_template( interface_info, header_template, cpp_template, template_context) header_path, cpp_path = self.output_paths(interface_name) diff --git a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py index 51cecee..d7c2385 100644 --- a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py +++ b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py @@ -284,6 +284,7 @@ class IdlInterface(object): self.is_partial = node.GetProperty('Partial') or False self.idl_name = idl_name self.name = node.GetName() + self.idl_type = IdlType(self.name) children = node.GetChildren() for child in children: @@ -350,6 +351,7 @@ class IdlException(IdlInterface): self.is_partial = False self.idl_name = idl_name self.name = node.GetName() + self.idl_type = IdlType(self.name) children = node.GetChildren() for child in children: diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py index 9cb32a5..2cbc138 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py @@ -82,6 +82,25 @@ def interface_context(interface): header_includes.update(v8_types.includes_for_interface(parent_interface)) extended_attributes = interface.extended_attributes + is_array_buffer_or_view = interface.idl_type.is_array_buffer_or_view + is_typed_array_type = interface.idl_type.is_typed_array + if is_array_buffer_or_view: + includes.add('bindings/core/v8/V8ArrayBuffer.h') + if interface.name == 'ArrayBuffer': + includes.add('core/dom/DOMArrayBufferDeallocationObserver.h') + if interface.name == 'ArrayBufferView': + includes.update(( + 'bindings/core/v8/V8Int8Array.h', + 'bindings/core/v8/V8Int16Array.h', + 'bindings/core/v8/V8Int32Array.h', + 'bindings/core/v8/V8Uint8Array.h', + 'bindings/core/v8/V8Uint8ClampedArray.h', + 'bindings/core/v8/V8Uint16Array.h', + 'bindings/core/v8/V8Uint32Array.h', + 'bindings/core/v8/V8Float32Array.h', + 'bindings/core/v8/V8Float64Array.h', + 'bindings/core/v8/V8DataView.h')) + # [ActiveDOMObject] is_active_dom_object = 'ActiveDOMObject' in extended_attributes @@ -157,12 +176,14 @@ def interface_context(interface): 'header_includes': header_includes, 'interface_name': interface.name, 'is_active_dom_object': is_active_dom_object, + 'is_array_buffer_or_view': is_array_buffer_or_view, 'is_check_security': is_check_security, 'is_dependent_lifetime': is_dependent_lifetime, 'is_event_target': inherits_interface(interface.name, 'EventTarget'), 'is_exception': interface.is_exception, 'is_node': inherits_interface(interface.name, 'Node'), 'is_script_wrappable': is_script_wrappable, + 'is_typed_array_type': is_typed_array_type, 'iterator_method': iterator_method, 'lifetime': 'Dependent' if (has_visit_dom_wrapper or diff --git a/third_party/WebKit/Source/bindings/scripts/v8_types.py b/third_party/WebKit/Source/bindings/scripts/v8_types.py index 41899fd..c394619 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_types.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py @@ -55,23 +55,28 @@ NON_WRAPPER_TYPES = frozenset([ 'NodeFilter', 'SerializedScriptValue', ]) -TYPED_ARRAYS = { - # (cpp_type, v8_type), used by constructor templates - 'ArrayBuffer': None, - 'ArrayBufferView': None, - 'Float32Array': ('float', 'v8::kExternalFloatArray'), - 'Float64Array': ('double', 'v8::kExternalDoubleArray'), - 'Int8Array': ('signed char', 'v8::kExternalByteArray'), - 'Int16Array': ('short', 'v8::kExternalShortArray'), - 'Int32Array': ('int', 'v8::kExternalIntArray'), - 'Uint8Array': ('unsigned char', 'v8::kExternalUnsignedByteArray'), - 'Uint8ClampedArray': ('unsigned char', 'v8::kExternalPixelArray'), - 'Uint16Array': ('unsigned short', 'v8::kExternalUnsignedShortArray'), - 'Uint32Array': ('unsigned int', 'v8::kExternalUnsignedIntArray'), -} +TYPED_ARRAY_TYPES = frozenset([ + 'Float32Array', + 'Float64Array', + 'Int8Array', + 'Int16Array', + 'Int32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Uint16Array', + 'Uint32Array', +]) +ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ + 'ArrayBuffer', + 'ArrayBufferView', + 'DataView', +])) + +IdlType.is_array_buffer_or_view = property( + lambda self: self.base_type in ARRAY_BUFFER_AND_VIEW_TYPES) -IdlType.is_typed_array_element_type = property( - lambda self: self.base_type in TYPED_ARRAYS) +IdlType.is_typed_array = property( + lambda self: self.base_type in TYPED_ARRAY_TYPES) IdlType.is_wrapper_type = property( lambda self: (self.is_interface_type and @@ -176,8 +181,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ return 'String' return 'V8StringResource<%s>' % string_mode() - if idl_type.is_typed_array_element_type and raw_type: - return base_idl_type + '*' + if idl_type.is_array_buffer_or_view and raw_type: + return idl_type.implemented_as + '*' if idl_type.is_interface_type: implemented_as_class = idl_type.implemented_as if raw_type: @@ -361,8 +366,6 @@ def includes_for_type(idl_type): return INCLUDES_FOR_TYPE[base_idl_type] if idl_type.is_basic_type: return set() - if idl_type.is_typed_array_element_type: - return set(['bindings/core/v8/custom/V8%sCustom.h' % base_idl_type]) if base_idl_type.endswith('ConstructorConstructor'): # FIXME: rename to NamedConstructor # FIXME: replace with a [NamedConstructorAttribute] extended attribute @@ -528,7 +531,7 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name if base_idl_type in V8_VALUE_TO_CPP_VALUE: cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] - elif idl_type.is_typed_array_element_type: + elif idl_type.is_array_buffer_or_view: cpp_expression_format = ( '{v8_value}->Is{idl_type}() ? ' 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp b/third_party/WebKit/Source/bindings/templates/interface.cpp index 62ef120..0823552 100644 --- a/third_party/WebKit/Source/bindings/templates/interface.cpp +++ b/third_party/WebKit/Source/bindings/templates/interface.cpp @@ -727,11 +727,13 @@ V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8 {##############################################################################} {% block get_dom_template %} +{% if not is_array_buffer_or_view %} v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) { return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), install{{v8_class}}Template); } +{% endif %} {% endblock %} @@ -739,14 +741,98 @@ v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate) {% block has_instance %} bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) { + {% if is_array_buffer_or_view %} + return v8Value->Is{{interface_name}}(); + {% else %} return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); + {% endif %} } +{% if not is_array_buffer_or_view %} v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) { return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); } +{% endif %} +{% endblock %} + + +{##############################################################################} +{% block to_impl %} +{% if interface_name == 'ArrayBuffer' %} +{{cpp_class}}* V8ArrayBuffer::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsArrayBuffer()); + v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); + if (v8buffer->IsExternal()) { + const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); + RELEASE_ASSERT(wrapperTypeInfo); + RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); + return blink::toScriptWrappableBase(object)->toImpl<{{cpp_class}}>(); + } + + v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); + // This special way to create ArrayBuffer via ArrayBufferContents makes the + // underlying ArrayBufferContents not call ArrayBufferDeallocationObserver:: + // blinkAllocatedMemory. The array buffer created by V8 already called it, + // so we shouldn't call it. + WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), DOMArrayBufferDeallocationObserver::instance()); + RefPtr<{{cpp_class}}> buffer = {{cpp_class}}::create(contents); + buffer->associateWithWrapper(buffer->wrapperTypeInfo(), object, v8::Isolate::GetCurrent()); + + return blink::toScriptWrappableBase(object)->toImpl<{{cpp_class}}>(); +} + +{% elif interface_name == 'ArrayBufferView' %} +{{cpp_class}}* V8ArrayBufferView::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsArrayBufferView()); + ScriptWrappableBase* internalPointer = blink::toScriptWrappableBase(object); + if (internalPointer) + return internalPointer->toImpl<{{cpp_class}}>(); + + if (object->IsInt8Array()) + return V8Int8Array::toImpl(object); + if (object->IsInt16Array()) + return V8Int16Array::toImpl(object); + if (object->IsInt32Array()) + return V8Int32Array::toImpl(object); + if (object->IsUint8Array()) + return V8Uint8Array::toImpl(object); + if (object->IsUint8ClampedArray()) + return V8Uint8ClampedArray::toImpl(object); + if (object->IsUint16Array()) + return V8Uint16Array::toImpl(object); + if (object->IsUint32Array()) + return V8Uint32Array::toImpl(object); + if (object->IsFloat32Array()) + return V8Float32Array::toImpl(object); + if (object->IsFloat64Array()) + return V8Float64Array::toImpl(object); + if (object->IsDataView()) + return V8DataView::toImpl(object); + + ASSERT_NOT_REACHED(); + return 0; +} + +{% elif is_array_buffer_or_view %} +{{cpp_class}}* {{v8_class}}::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->Is{{interface_name}}()); + ScriptWrappableBase* internalPointer = blink::toScriptWrappableBase(object); + if (internalPointer) + return internalPointer->toImpl<{{cpp_class}}>(); + + v8::Handle<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>(); + RefPtr<{{cpp_class}}> typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(v8View->Buffer()), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length()); + typedArray->associateWithWrapper(typedArray->wrapperTypeInfo(), object, v8::Isolate::GetCurrent()); + + return typedArray->toImpl<{{cpp_class}}>(); +} + +{% endif %} {% endblock %} @@ -754,7 +840,11 @@ v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8: {% block to_impl_with_type_check %} {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) { + {% if is_array_buffer_or_view %} + return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; + {% else %} return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; + {% endif %} } {% endblock %} @@ -855,7 +945,6 @@ v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H {##############################################################################} {% block deref_object_and_to_v8_no_inline %} - void {{v8_class}}::refObject(ScriptWrappableBase* internalPointer) { {% if gc_type == 'WillBeGarbageCollectedObject' %} diff --git a/third_party/WebKit/Source/bindings/templates/interface.h b/third_party/WebKit/Source/bindings/templates/interface.h index edfdc4b..7f4ecba 100644 --- a/third_party/WebKit/Source/bindings/templates/interface.h +++ b/third_party/WebKit/Source/bindings/templates/interface.h @@ -43,12 +43,16 @@ public: {% endif %} static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + {% if is_array_buffer_or_view %} + static {{cpp_class}}* toImpl(v8::Handle<v8::Object> object); + {% else %} static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*); static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); static {{cpp_class}}* toImpl(v8::Handle<v8::Object> object) { return blink::toScriptWrappableBase(object)->toImpl<{{cpp_class}}>(); } + {% endif %} static {{cpp_class}}* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); static const WrapperTypeInfo wrapperTypeInfo; static void refObject(ScriptWrappableBase* internalPointer); diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp index f2c8991..2da59d7 100644 --- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp +++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp @@ -23,16 +23,21 @@ namespace blink { if parent_interface else '0' %} {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 'WrapperTypeObjectPrototype' %} +{% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_view else '0' %} -const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; +const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; {% if is_script_wrappable %} // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}}.h. // For details, see the comment of DEFINE_WRAPPERTYPEINFO in // bindings/core/v8/ScriptWrappable.h. +{% if is_typed_array_type %} +template<> +{% endif %} const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperTypeInfo; {% endif %} +{% if not is_array_buffer_or_view %} namespace {{cpp_class}}V8Internal { {# Constants #} @@ -229,6 +234,7 @@ static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = { {% endif %} {% endblock %} +{% endif %}{# not is_array_buffer_or_view #} {##############################################################################} {% block named_constructor %}{% endblock %} {% block initialize_event %}{% endblock %} @@ -236,6 +242,7 @@ static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = { {% block configure_shadow_object_template %}{% endblock %} {##############################################################################} {% block install_dom_template %} +{% if not is_array_buffer_or_view %} {% from 'methods.cpp' import install_custom_signature with context %} {% from 'constants.cpp' import install_constants with context %} static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) @@ -306,7 +313,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio {{install_constants() | indent}} {% endif %} {# Special operations #} - {# V8 has access-check callback API and it's used on Window instead of + {# V8 has access-check callback API and it is used on Window instead of deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. In addition, the getter should be set on the prototype template, to get the implementation straight out of the Window prototype, regardless of @@ -400,10 +407,12 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); } +{% endif %}{# not is_array_buffer_or_view #} {% endblock %} {##############################################################################} {% block get_dom_template %}{% endblock %} {% block has_instance %}{% endblock %} +{% block to_impl %}{% endblock %} {% block to_impl_with_type_check %}{% endblock %} {##############################################################################} {% block install_conditional_attributes %} diff --git a/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBuffer.idl b/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBuffer.idl new file mode 100644 index 0000000..7878c57 --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBuffer.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#ARRAYBUFFER + +[ + ImplementedAs=TestArrayBuffer, +] interface ArrayBuffer { + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBufferView.idl b/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBufferView.idl new file mode 100644 index 0000000..e6e9262 --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/idls/core/ArrayBufferView.idl @@ -0,0 +1,13 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#ARRAYBUFFERVIEW + +[ + ImplementedAs=TestArrayBufferView, +] interface ArrayBufferView { + readonly attribute ArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/bindings/tests/idls/core/DataView.idl b/third_party/WebKit/Source/bindings/tests/idls/core/DataView.idl new file mode 100644 index 0000000..e26468d --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/idls/core/DataView.idl @@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#DATAVIEW + +[ + ImplementedAs=TestDataView, +] interface DataView : ArrayBufferView { + [RaisesException] octet getUint8(unsigned long byteOffset); + [RaisesException] double getFloat64(unsigned long byteOffset, optional boolean littleEndian); + + [RaisesException] void setUint8(unsigned long byteOffset, octet value); + [RaisesException] void setFloat64(unsigned long byteOffset, double value, optional boolean littleEndian); +}; diff --git a/third_party/WebKit/Source/bindings/tests/idls/core/Uint8ClampedArray.idl b/third_party/WebKit/Source/bindings/tests/idls/core/Uint8ClampedArray.idl new file mode 100644 index 0000000..13f411c --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/idls/core/Uint8ClampedArray.idl @@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=TestUint8ClampedArray, +] interface Uint8ClampedArray : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp new file mode 100644 index 0000000..3e85776 --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp @@ -0,0 +1,81 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#include "config.h" +#include "V8ArrayBuffer.h" + +#include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMConfiguration.h" +#include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8ObjectConstructor.h" +#include "core/dom/ContextFeatures.h" +#include "core/dom/DOMArrayBufferDeallocationObserver.h" +#include "core/dom/Document.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/TraceEvent.h" +#include "wtf/GetPtr.h" +#include "wtf/RefPtr.h" + +namespace blink { + +const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8ArrayBuffer::refObject, V8ArrayBuffer::derefObject, V8ArrayBuffer::trace, 0, 0, 0, V8ArrayBuffer::installConditionallyEnabledMethods, V8ArrayBuffer::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; + +// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestArrayBuffer.h. +// For details, see the comment of DEFINE_WRAPPERTYPEINFO in +// bindings/core/v8/ScriptWrappable.h. +const WrapperTypeInfo& TestArrayBuffer::s_wrapperTypeInfo = V8ArrayBuffer::wrapperTypeInfo; + +bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return v8Value->IsArrayBuffer(); +} + +TestArrayBuffer* V8ArrayBuffer::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsArrayBuffer()); + v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); + if (v8buffer->IsExternal()) { + const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); + RELEASE_ASSERT(wrapperTypeInfo); + RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); + return blink::toScriptWrappableBase(object)->toImpl<TestArrayBuffer>(); + } + + v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); + // This special way to create ArrayBuffer via ArrayBufferContents makes the + // underlying ArrayBufferContents not call ArrayBufferDeallocationObserver:: + // blinkAllocatedMemory. The array buffer created by V8 already called it, + // so we shouldn't call it. + WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), DOMArrayBufferDeallocationObserver::instance()); + RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); + buffer->associateWithWrapper(buffer->wrapperTypeInfo(), object, v8::Isolate::GetCurrent()); + + return blink::toScriptWrappableBase(object)->toImpl<TestArrayBuffer>(); +} + +TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) +{ + return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; +} + +void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestArrayBuffer>()->ref(); +} + +void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestArrayBuffer>()->deref(); +} + +template<> +v8::Handle<v8::Value> toV8NoInline(TestArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl, creationContext, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.h b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.h new file mode 100644 index 0000000..e63ddad --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.h @@ -0,0 +1,120 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#ifndef V8ArrayBuffer_h +#define V8ArrayBuffer_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "bindings/core/v8/V8Binding.h" +#include "bindings/core/v8/V8DOMWrapper.h" +#include "bindings/core/v8/WrapperTypeInfo.h" +#include "bindings/tests/idls/core/TestArrayBuffer.h" +#include "platform/heap/Handle.h" + +namespace blink { + +class V8ArrayBuffer { +public: + static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + static TestArrayBuffer* toImpl(v8::Handle<v8::Object> object); + static TestArrayBuffer* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); + static const WrapperTypeInfo wrapperTypeInfo; + static void refObject(ScriptWrappableBase* internalPointer); + static void derefObject(ScriptWrappableBase* internalPointer); + static void trace(Visitor* visitor, ScriptWrappableBase* internalPointer) + { + } + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static inline ScriptWrappableBase* toScriptWrappableBase(TestArrayBuffer* impl) + { + return impl->toScriptWrappableBase(); + } + static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { } + static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { } +}; + +inline v8::Handle<v8::Object> wrap(TestArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return impl->wrap(creationContext, isolate); +} + +inline v8::Handle<v8::Value> toV8(TestArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + if (UNLIKELY(!impl)) + return v8::Null(isolate); + v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBuffer>(impl, isolate); + if (!wrapper.IsEmpty()) + return wrapper; + + return impl->wrap(creationContext, isolate); +} + +template<typename CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestArrayBuffer* impl) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapper<V8ArrayBuffer>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<typename CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestArrayBuffer* impl) +{ + ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8ArrayBuffer>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestArrayBuffer* impl, Wrappable* wrappable) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperFast<V8ArrayBuffer>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +inline v8::Handle<v8::Value> toV8(PassRefPtr<TestArrayBuffer> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl.get(), creationContext, isolate); +} + +template<class CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBuffer> impl) +{ + v8SetReturnValue(callbackInfo, impl.get()); +} + +template<class CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBuffer> impl) +{ + v8SetReturnValueForMainWorld(callbackInfo, impl.get()); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBuffer> impl, Wrappable* wrappable) +{ + v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); +} + +} // namespace blink + +#endif // V8ArrayBuffer_h diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.cpp new file mode 100644 index 0000000..a2bba6a --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.cpp @@ -0,0 +1,99 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#include "config.h" +#include "V8ArrayBufferView.h" + +#include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMConfiguration.h" +#include "bindings/core/v8/V8DataView.h" +#include "bindings/core/v8/V8Float32Array.h" +#include "bindings/core/v8/V8Float64Array.h" +#include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8Int16Array.h" +#include "bindings/core/v8/V8Int32Array.h" +#include "bindings/core/v8/V8Int8Array.h" +#include "bindings/core/v8/V8ObjectConstructor.h" +#include "bindings/core/v8/V8Uint16Array.h" +#include "bindings/core/v8/V8Uint32Array.h" +#include "bindings/core/v8/V8Uint8Array.h" +#include "bindings/core/v8/V8Uint8ClampedArray.h" +#include "core/dom/ContextFeatures.h" +#include "core/dom/Document.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/TraceEvent.h" +#include "wtf/GetPtr.h" +#include "wtf/RefPtr.h" + +namespace blink { + +const WrapperTypeInfo V8ArrayBufferView::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8ArrayBufferView::refObject, V8ArrayBufferView::derefObject, V8ArrayBufferView::trace, 0, 0, 0, V8ArrayBufferView::installConditionallyEnabledMethods, V8ArrayBufferView::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; + +// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestArrayBufferView.h. +// For details, see the comment of DEFINE_WRAPPERTYPEINFO in +// bindings/core/v8/ScriptWrappable.h. +const WrapperTypeInfo& TestArrayBufferView::s_wrapperTypeInfo = V8ArrayBufferView::wrapperTypeInfo; + +bool V8ArrayBufferView::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return v8Value->IsArrayBufferView(); +} + +TestArrayBufferView* V8ArrayBufferView::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsArrayBufferView()); + ScriptWrappableBase* internalPointer = blink::toScriptWrappableBase(object); + if (internalPointer) + return internalPointer->toImpl<TestArrayBufferView>(); + + if (object->IsInt8Array()) + return V8Int8Array::toImpl(object); + if (object->IsInt16Array()) + return V8Int16Array::toImpl(object); + if (object->IsInt32Array()) + return V8Int32Array::toImpl(object); + if (object->IsUint8Array()) + return V8Uint8Array::toImpl(object); + if (object->IsUint8ClampedArray()) + return V8Uint8ClampedArray::toImpl(object); + if (object->IsUint16Array()) + return V8Uint16Array::toImpl(object); + if (object->IsUint32Array()) + return V8Uint32Array::toImpl(object); + if (object->IsFloat32Array()) + return V8Float32Array::toImpl(object); + if (object->IsFloat64Array()) + return V8Float64Array::toImpl(object); + if (object->IsDataView()) + return V8DataView::toImpl(object); + + ASSERT_NOT_REACHED(); + return 0; +} + +TestArrayBufferView* V8ArrayBufferView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) +{ + return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; +} + +void V8ArrayBufferView::refObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestArrayBufferView>()->ref(); +} + +void V8ArrayBufferView::derefObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestArrayBufferView>()->deref(); +} + +template<> +v8::Handle<v8::Value> toV8NoInline(TestArrayBufferView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl, creationContext, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.h b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.h new file mode 100644 index 0000000..57b67d3 --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBufferView.h @@ -0,0 +1,120 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#ifndef V8ArrayBufferView_h +#define V8ArrayBufferView_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "bindings/core/v8/V8Binding.h" +#include "bindings/core/v8/V8DOMWrapper.h" +#include "bindings/core/v8/WrapperTypeInfo.h" +#include "bindings/tests/idls/core/TestArrayBufferView.h" +#include "platform/heap/Handle.h" + +namespace blink { + +class V8ArrayBufferView { +public: + static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + static TestArrayBufferView* toImpl(v8::Handle<v8::Object> object); + static TestArrayBufferView* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); + static const WrapperTypeInfo wrapperTypeInfo; + static void refObject(ScriptWrappableBase* internalPointer); + static void derefObject(ScriptWrappableBase* internalPointer); + static void trace(Visitor* visitor, ScriptWrappableBase* internalPointer) + { + } + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static inline ScriptWrappableBase* toScriptWrappableBase(TestArrayBufferView* impl) + { + return impl->toScriptWrappableBase(); + } + static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { } + static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { } +}; + +inline v8::Handle<v8::Object> wrap(TestArrayBufferView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return impl->wrap(creationContext, isolate); +} + +inline v8::Handle<v8::Value> toV8(TestArrayBufferView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + if (UNLIKELY(!impl)) + return v8::Null(isolate); + v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBufferView>(impl, isolate); + if (!wrapper.IsEmpty()) + return wrapper; + + return impl->wrap(creationContext, isolate); +} + +template<typename CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestArrayBufferView* impl) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapper<V8ArrayBufferView>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<typename CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestArrayBufferView* impl) +{ + ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8ArrayBufferView>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestArrayBufferView* impl, Wrappable* wrappable) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperFast<V8ArrayBufferView>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +inline v8::Handle<v8::Value> toV8(PassRefPtr<TestArrayBufferView> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl.get(), creationContext, isolate); +} + +template<class CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBufferView> impl) +{ + v8SetReturnValue(callbackInfo, impl.get()); +} + +template<class CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBufferView> impl) +{ + v8SetReturnValueForMainWorld(callbackInfo, impl.get()); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestArrayBufferView> impl, Wrappable* wrappable) +{ + v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); +} + +} // namespace blink + +#endif // V8ArrayBufferView_h diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.cpp new file mode 100644 index 0000000..75f0dc3 --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.cpp @@ -0,0 +1,71 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#include "config.h" +#include "V8DataView.h" + +#include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMConfiguration.h" +#include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8ObjectConstructor.h" +#include "core/dom/ContextFeatures.h" +#include "core/dom/Document.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/TraceEvent.h" +#include "wtf/GetPtr.h" +#include "wtf/RefPtr.h" + +namespace blink { + +const WrapperTypeInfo V8DataView::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8DataView::refObject, V8DataView::derefObject, V8DataView::trace, 0, 0, 0, V8DataView::installConditionallyEnabledMethods, V8DataView::installConditionallyEnabledProperties, &V8ArrayBufferView::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; + +// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestDataView.h. +// For details, see the comment of DEFINE_WRAPPERTYPEINFO in +// bindings/core/v8/ScriptWrappable.h. +const WrapperTypeInfo& TestDataView::s_wrapperTypeInfo = V8DataView::wrapperTypeInfo; + +bool V8DataView::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return v8Value->IsDataView(); +} + +TestDataView* V8DataView::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsDataView()); + ScriptWrappableBase* internalPointer = blink::toScriptWrappableBase(object); + if (internalPointer) + return internalPointer->toImpl<TestDataView>(); + + v8::Handle<v8::DataView> v8View = object.As<v8::DataView>(); + RefPtr<TestDataView> typedArray = TestDataView::create(V8ArrayBuffer::toImpl(v8View->Buffer()), v8View->ByteOffset(), v8View->ByteLength()); + typedArray->associateWithWrapper(typedArray->wrapperTypeInfo(), object, v8::Isolate::GetCurrent()); + + return typedArray->toImpl<TestDataView>(); +} + +TestDataView* V8DataView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) +{ + return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; +} + +void V8DataView::refObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestDataView>()->ref(); +} + +void V8DataView::derefObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestDataView>()->deref(); +} + +template<> +v8::Handle<v8::Value> toV8NoInline(TestDataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl, creationContext, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.h b/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.h new file mode 100644 index 0000000..e643aac --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8DataView.h @@ -0,0 +1,121 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#ifndef V8DataView_h +#define V8DataView_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "bindings/core/v8/V8ArrayBufferView.h" +#include "bindings/core/v8/V8Binding.h" +#include "bindings/core/v8/V8DOMWrapper.h" +#include "bindings/core/v8/WrapperTypeInfo.h" +#include "bindings/tests/idls/core/TestDataView.h" +#include "platform/heap/Handle.h" + +namespace blink { + +class V8DataView { +public: + static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + static TestDataView* toImpl(v8::Handle<v8::Object> object); + static TestDataView* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); + static const WrapperTypeInfo wrapperTypeInfo; + static void refObject(ScriptWrappableBase* internalPointer); + static void derefObject(ScriptWrappableBase* internalPointer); + static void trace(Visitor* visitor, ScriptWrappableBase* internalPointer) + { + } + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static inline ScriptWrappableBase* toScriptWrappableBase(TestDataView* impl) + { + return impl->toScriptWrappableBase(); + } + static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { } + static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { } +}; + +inline v8::Handle<v8::Object> wrap(TestDataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return impl->wrap(creationContext, isolate); +} + +inline v8::Handle<v8::Value> toV8(TestDataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + if (UNLIKELY(!impl)) + return v8::Null(isolate); + v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8DataView>(impl, isolate); + if (!wrapper.IsEmpty()) + return wrapper; + + return impl->wrap(creationContext, isolate); +} + +template<typename CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestDataView* impl) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapper<V8DataView>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<typename CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestDataView* impl) +{ + ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8DataView>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestDataView* impl, Wrappable* wrappable) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperFast<V8DataView>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +inline v8::Handle<v8::Value> toV8(PassRefPtr<TestDataView> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl.get(), creationContext, isolate); +} + +template<class CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestDataView> impl) +{ + v8SetReturnValue(callbackInfo, impl.get()); +} + +template<class CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestDataView> impl) +{ + v8SetReturnValueForMainWorld(callbackInfo, impl.get()); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestDataView> impl, Wrappable* wrappable) +{ + v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); +} + +} // namespace blink + +#endif // V8DataView_h diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp index 88afb69..7ef5086 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp @@ -107,7 +107,6 @@ SVGTestInterface* V8SVGTestInterface::toImplWithTypeCheck(v8::Isolate* isolate, return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<SVGTestInterface>() : 0; } - void V8SVGTestInterface::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<SVGTestInterface>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp index a502f10..12028b1 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp @@ -124,7 +124,6 @@ TestException* V8TestException::toImplWithTypeCheck(v8::Isolate* isolate, v8::Ha return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestException>() : 0; } - void V8TestException::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestException>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp index 5324764..112edea 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp @@ -2068,7 +2068,6 @@ ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> wrapp return toImpl(wrapper); } - void V8TestInterface::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceImplementation>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp index 4b50de8..a2cedfd 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp @@ -499,7 +499,6 @@ TestInterface2* V8TestInterface2::toImplWithTypeCheck(v8::Isolate* isolate, v8:: return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterface2>() : 0; } - void V8TestInterface2::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterface2>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp index a32a491..3fecab2 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp @@ -129,7 +129,6 @@ TestInterface3* V8TestInterface3::toImplWithTypeCheck(v8::Isolate* isolate, v8:: return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterface3>() : 0; } - void V8TestInterface3::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterface3>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp index 4c894e1..180bae3 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp @@ -523,7 +523,6 @@ TestInterfaceCheckSecurity* V8TestInterfaceCheckSecurity::toImplWithTypeCheck(v8 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceCheckSecurity>() : 0; } - void V8TestInterfaceCheckSecurity::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceCheckSecurity>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp index 38fc55b..c7ffa58 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp @@ -335,7 +335,6 @@ TestInterfaceConstructor* V8TestInterfaceConstructor::toImplWithTypeCheck(v8::Is return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor>() : 0; } - void V8TestInterfaceConstructor::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceConstructor>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp index 2e84d81..3e4065d 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp @@ -228,7 +228,6 @@ TestInterfaceConstructor2* V8TestInterfaceConstructor2::toImplWithTypeCheck(v8:: return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor2>() : 0; } - void V8TestInterfaceConstructor2::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceConstructor2>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp index 5f65e95..66e6a4e 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp @@ -105,7 +105,6 @@ TestInterfaceConstructor3* V8TestInterfaceConstructor3::toImplWithTypeCheck(v8:: return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor3>() : 0; } - void V8TestInterfaceConstructor3::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceConstructor3>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp index 960d4dc..2ab10ac 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp @@ -138,7 +138,6 @@ TestInterfaceConstructor4* V8TestInterfaceConstructor4::toImplWithTypeCheck(v8:: return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor4>() : 0; } - void V8TestInterfaceConstructor4::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceConstructor4>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp index 031766e..02e1ee4 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp @@ -89,7 +89,6 @@ TestInterfaceCustomConstructor* V8TestInterfaceCustomConstructor::toImplWithType return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceCustomConstructor>() : 0; } - void V8TestInterfaceCustomConstructor::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceCustomConstructor>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp index f2f5cc4..19fe74a 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp @@ -75,7 +75,6 @@ EventTarget* V8TestInterfaceDocument::toEventTarget(v8::Handle<v8::Object> objec return toImpl(object); } - void V8TestInterfaceDocument::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp index 13af51c..cee5eab 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp @@ -70,7 +70,6 @@ TestInterfaceEmpty* V8TestInterfaceEmpty::toImplWithTypeCheck(v8::Isolate* isola return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceEmpty>() : 0; } - void V8TestInterfaceEmpty::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceEmpty>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp index a2f3283..e55d4bd 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp @@ -15,7 +15,7 @@ #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8ObjectConstructor.h" #include "bindings/core/v8/V8TestInterfaceEmpty.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" #include "core/frame/LocalDOMWindow.h" @@ -110,7 +110,7 @@ static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet { v8::Handle<v8::Object> holder = info.Holder(); TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder); - RefPtr<Uint8Array> cppValue(impl->initializedByEventConstructorReadonlyUint8ArrayAttribute()); + RefPtr<DOMUint8Array> cppValue(impl->initializedByEventConstructorReadonlyUint8ArrayAttribute()); if (cppValue && DOMDataStore::setReturnValueFromWrapper<V8Uint8Array>(info.GetReturnValue(), cppValue.get())) return; v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate()); @@ -373,7 +373,6 @@ TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toImplWithTypeCh return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceEventConstructor>() : 0; } - void V8TestInterfaceEventConstructor::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp index ae408fc..61ab24b 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp @@ -114,7 +114,6 @@ EventTarget* V8TestInterfaceEventTarget::toEventTarget(v8::Handle<v8::Object> ob return toImpl(object); } - void V8TestInterfaceEventTarget::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp index 2941b54..4484b48 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp @@ -169,7 +169,6 @@ EventTarget* V8TestInterfaceGarbageCollected::toEventTarget(v8::Handle<v8::Objec return toImpl(object); } - void V8TestInterfaceGarbageCollected::refObject(ScriptWrappableBase* internalPointer) { } diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp index 04120fd..e372455 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp @@ -179,7 +179,6 @@ ActiveDOMObject* V8TestInterfaceNamedConstructor::toActiveDOMObject(v8::Handle<v return toImpl(wrapper); } - void V8TestInterfaceNamedConstructor::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceNamedConstructor>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp index 6e72ae18..1ebb3c3 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp @@ -116,7 +116,6 @@ TestInterfaceNamedConstructor2* V8TestInterfaceNamedConstructor2::toImplWithType return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceNamedConstructor2>() : 0; } - void V8TestInterfaceNamedConstructor2::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceNamedConstructor2>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp index a0021ca..2729259 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp @@ -336,7 +336,6 @@ EventTarget* V8TestInterfaceNode::toEventTarget(v8::Handle<v8::Object> object) return toImpl(object); } - void V8TestInterfaceNode::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNotScriptWrappable.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNotScriptWrappable.cpp index 064f4f9..1dddcea 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNotScriptWrappable.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNotScriptWrappable.cpp @@ -145,7 +145,6 @@ v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::createWrapper(PassRefP return wrapper; } - void V8TestInterfaceNotScriptWrappable::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceWillBeGarbageCollected.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceWillBeGarbageCollected.cpp index 9fb6bf3..7704b92 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceWillBeGarbageCollected.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceWillBeGarbageCollected.cpp @@ -214,7 +214,6 @@ EventTarget* V8TestInterfaceWillBeGarbageCollected::toEventTarget(v8::Handle<v8: return toImpl(object); } - void V8TestInterfaceWillBeGarbageCollected::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp index c4ea674..37b05f2 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp @@ -229,7 +229,6 @@ EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object) return toImpl(object); } - void V8TestNode::refObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp index 9665844..93b95a4 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp @@ -17,6 +17,8 @@ #include "bindings/core/v8/ScriptValue.h" #include "bindings/core/v8/SerializedScriptValue.h" #include "bindings/core/v8/V8AbstractEventListener.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Attr.h" #include "bindings/core/v8/V8DOMActivityLogger.h" #include "bindings/core/v8/V8DOMConfiguration.h" @@ -26,9 +28,11 @@ #include "bindings/core/v8/V8Element.h" #include "bindings/core/v8/V8EventListenerList.h" #include "bindings/core/v8/V8EventTarget.h" +#include "bindings/core/v8/V8Float32Array.h" #include "bindings/core/v8/V8HTMLCollection.h" #include "bindings/core/v8/V8HTMLElement.h" #include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8Int32Array.h" #include "bindings/core/v8/V8Node.h" #include "bindings/core/v8/V8NodeFilter.h" #include "bindings/core/v8/V8ObjectConstructor.h" @@ -41,13 +45,9 @@ #include "bindings/core/v8/V8TestInterfaceWillBeGarbageCollected.h" #include "bindings/core/v8/V8TestNode.h" #include "bindings/core/v8/V8TestObject.h" +#include "bindings/core/v8/V8Uint8Array.h" #include "bindings/core/v8/V8Window.h" #include "bindings/core/v8/V8XPathNSResolver.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/core/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" #include "core/HTMLNames.h" #include "core/dom/ClassCollection.h" #include "core/dom/ContextFeatures.h" @@ -1283,7 +1283,7 @@ static void arrayBufferAttributeAttributeSetter(v8::Local<v8::Value> v8Value, co { v8::Handle<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::toImpl(holder); - ArrayBuffer* cppValue = v8Value->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(v8Value)) : 0; + TestArrayBuffer* cppValue = v8Value->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(v8Value)) : 0; impl->setArrayBufferAttribute(WTF::getPtr(cppValue)); } @@ -1312,7 +1312,7 @@ static void float32ArrayAttributeAttributeSetter(v8::Local<v8::Value> v8Value, c { v8::Handle<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::toImpl(holder); - Float32Array* cppValue = v8Value->IsFloat32Array() ? V8Float32Array::toImpl(v8::Handle<v8::Float32Array>::Cast(v8Value)) : 0; + DOMFloat32Array* cppValue = v8Value->IsFloat32Array() ? V8Float32Array::toImpl(v8::Handle<v8::Float32Array>::Cast(v8Value)) : 0; impl->setFloat32ArrayAttribute(WTF::getPtr(cppValue)); } @@ -1341,7 +1341,7 @@ static void uint8ArrayAttributeAttributeSetter(v8::Local<v8::Value> v8Value, con { v8::Handle<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::toImpl(holder); - Uint8Array* cppValue = v8Value->IsUint8Array() ? V8Uint8Array::toImpl(v8::Handle<v8::Uint8Array>::Cast(v8Value)) : 0; + DOMUint8Array* cppValue = v8Value->IsUint8Array() ? V8Uint8Array::toImpl(v8::Handle<v8::Uint8Array>::Cast(v8Value)) : 0; impl->setUint8ArrayAttribute(WTF::getPtr(cppValue)); } @@ -5913,7 +5913,7 @@ static void voidMethodArrayBufferArgMethod(const v8::FunctionCallbackInfo<v8::Va return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - ArrayBuffer* arrayBufferArg; + TestArrayBuffer* arrayBufferArg; { arrayBufferArg = info[0]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[0])) : 0; } @@ -5934,7 +5934,7 @@ static void voidMethodArrayBufferOrNullArgMethod(const v8::FunctionCallbackInfo< return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - ArrayBuffer* arrayBufferArg; + TestArrayBuffer* arrayBufferArg; { arrayBufferArg = info[0]->IsArrayBuffer() ? V8ArrayBuffer::toImpl(v8::Handle<v8::ArrayBuffer>::Cast(info[0])) : 0; } @@ -5955,7 +5955,7 @@ static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8 return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - ArrayBufferView* arrayBufferViewArg; + TestArrayBufferView* arrayBufferViewArg; { arrayBufferViewArg = info[0]->IsArrayBufferView() ? V8ArrayBufferView::toImpl(v8::Handle<v8::ArrayBufferView>::Cast(info[0])) : 0; } @@ -5976,7 +5976,7 @@ static void voidMethodFloat32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::V return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - Float32Array* float32ArrayArg; + DOMFloat32Array* float32ArrayArg; { float32ArrayArg = info[0]->IsFloat32Array() ? V8Float32Array::toImpl(v8::Handle<v8::Float32Array>::Cast(info[0])) : 0; } @@ -5997,7 +5997,7 @@ static void voidMethodInt32ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Val return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - Int32Array* int32ArrayArg; + DOMInt32Array* int32ArrayArg; { int32ArrayArg = info[0]->IsInt32Array() ? V8Int32Array::toImpl(v8::Handle<v8::Int32Array>::Cast(info[0])) : 0; } @@ -6018,7 +6018,7 @@ static void voidMethodUint8ArrayArgMethod(const v8::FunctionCallbackInfo<v8::Val return; } TestObject* impl = V8TestObject::toImpl(info.Holder()); - Uint8Array* uint8ArrayArg; + DOMUint8Array* uint8ArrayArg; { uint8ArrayArg = info[0]->IsUint8Array() ? V8Uint8Array::toImpl(v8::Handle<v8::Uint8Array>::Cast(info[0])) : 0; } @@ -10675,7 +10675,6 @@ void V8TestObject::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro } } - void V8TestObject::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestObject>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp index 3ebd410..71430e0 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp @@ -200,7 +200,6 @@ TestSpecialOperations* V8TestSpecialOperations::toImplWithTypeCheck(v8::Isolate* return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestSpecialOperations>() : 0; } - void V8TestSpecialOperations::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestSpecialOperations>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp index 65db875..eba7cbe 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp @@ -110,7 +110,6 @@ TestSpecialOperationsNotEnumerable* V8TestSpecialOperationsNotEnumerable::toImpl return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestSpecialOperationsNotEnumerable>() : 0; } - void V8TestSpecialOperationsNotEnumerable::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestSpecialOperationsNotEnumerable>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp index 4933371..b77e887 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp @@ -364,7 +364,6 @@ TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Hand return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestTypedefs>() : 0; } - void V8TestTypedefs::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestTypedefs>()->ref(); diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.cpp new file mode 100644 index 0000000..c54eb5a --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.cpp @@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#include "config.h" +#include "V8Uint8ClampedArray.h" + +#include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMConfiguration.h" +#include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8ObjectConstructor.h" +#include "core/dom/ContextFeatures.h" +#include "core/dom/Document.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/TraceEvent.h" +#include "wtf/GetPtr.h" +#include "wtf/RefPtr.h" + +namespace blink { + +const WrapperTypeInfo V8Uint8ClampedArray::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8Uint8ClampedArray::refObject, V8Uint8ClampedArray::derefObject, V8Uint8ClampedArray::trace, 0, 0, 0, V8Uint8ClampedArray::installConditionallyEnabledMethods, V8Uint8ClampedArray::installConditionallyEnabledProperties, &V8ArrayBufferView::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; + +// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestUint8ClampedArray.h. +// For details, see the comment of DEFINE_WRAPPERTYPEINFO in +// bindings/core/v8/ScriptWrappable.h. +template<> +const WrapperTypeInfo& TestUint8ClampedArray::s_wrapperTypeInfo = V8Uint8ClampedArray::wrapperTypeInfo; + +bool V8Uint8ClampedArray::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return v8Value->IsUint8ClampedArray(); +} + +TestUint8ClampedArray* V8Uint8ClampedArray::toImpl(v8::Handle<v8::Object> object) +{ + ASSERT(object->IsUint8ClampedArray()); + ScriptWrappableBase* internalPointer = blink::toScriptWrappableBase(object); + if (internalPointer) + return internalPointer->toImpl<TestUint8ClampedArray>(); + + v8::Handle<v8::Uint8ClampedArray> v8View = object.As<v8::Uint8ClampedArray>(); + RefPtr<TestUint8ClampedArray> typedArray = TestUint8ClampedArray::create(V8ArrayBuffer::toImpl(v8View->Buffer()), v8View->ByteOffset(), v8View->Length()); + typedArray->associateWithWrapper(typedArray->wrapperTypeInfo(), object, v8::Isolate::GetCurrent()); + + return typedArray->toImpl<TestUint8ClampedArray>(); +} + +TestUint8ClampedArray* V8Uint8ClampedArray::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) +{ + return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(value)) : 0; +} + +void V8Uint8ClampedArray::refObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestUint8ClampedArray>()->ref(); +} + +void V8Uint8ClampedArray::derefObject(ScriptWrappableBase* internalPointer) +{ + internalPointer->toImpl<TestUint8ClampedArray>()->deref(); +} + +template<> +v8::Handle<v8::Value> toV8NoInline(TestUint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl, creationContext, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.h b/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.h new file mode 100644 index 0000000..ebccfbb --- /dev/null +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8Uint8ClampedArray.h @@ -0,0 +1,121 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#ifndef V8Uint8ClampedArray_h +#define V8Uint8ClampedArray_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "bindings/core/v8/V8ArrayBufferView.h" +#include "bindings/core/v8/V8Binding.h" +#include "bindings/core/v8/V8DOMWrapper.h" +#include "bindings/core/v8/WrapperTypeInfo.h" +#include "core/dom/DOMTypedArray.h" +#include "platform/heap/Handle.h" + +namespace blink { + +class V8Uint8ClampedArray { +public: + static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + static TestUint8ClampedArray* toImpl(v8::Handle<v8::Object> object); + static TestUint8ClampedArray* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); + static const WrapperTypeInfo wrapperTypeInfo; + static void refObject(ScriptWrappableBase* internalPointer); + static void derefObject(ScriptWrappableBase* internalPointer); + static void trace(Visitor* visitor, ScriptWrappableBase* internalPointer) + { + } + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static inline ScriptWrappableBase* toScriptWrappableBase(TestUint8ClampedArray* impl) + { + return impl->toScriptWrappableBase(); + } + static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { } + static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { } +}; + +inline v8::Handle<v8::Object> wrap(TestUint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return impl->wrap(creationContext, isolate); +} + +inline v8::Handle<v8::Value> toV8(TestUint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + if (UNLIKELY(!impl)) + return v8::Null(isolate); + v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8Uint8ClampedArray>(impl, isolate); + if (!wrapper.IsEmpty()) + return wrapper; + + return impl->wrap(creationContext, isolate); +} + +template<typename CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestUint8ClampedArray* impl) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapper<V8Uint8ClampedArray>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<typename CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestUint8ClampedArray* impl) +{ + ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8Uint8ClampedArray>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestUint8ClampedArray* impl, Wrappable* wrappable) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperFast<V8Uint8ClampedArray>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +inline v8::Handle<v8::Value> toV8(PassRefPtr<TestUint8ClampedArray> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl.get(), creationContext, isolate); +} + +template<class CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestUint8ClampedArray> impl) +{ + v8SetReturnValue(callbackInfo, impl.get()); +} + +template<class CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestUint8ClampedArray> impl) +{ + v8SetReturnValueForMainWorld(callbackInfo, impl.get()); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestUint8ClampedArray> impl, Wrappable* wrappable) +{ + v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); +} + +} // namespace blink + +#endif // V8Uint8ClampedArray_h diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp index 1fd0b50..89f9c68 100644 --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp @@ -858,7 +858,6 @@ ActiveDOMObject* V8TestInterface5::toActiveDOMObject(v8::Handle<v8::Object> wrap return toImpl(wrapper); } - void V8TestInterface5::refObject(ScriptWrappableBase* internalPointer) { internalPointer->toImpl<TestInterface5Implementation>()->ref(); diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index c44acc7..dbf1d0d 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -7,8 +7,8 @@ 'core_idl_files': [ 'animation/Animation.idl', 'animation/AnimationEffect.idl', - 'animation/AnimationPlayer.idl', 'animation/AnimationNode.idl', + 'animation/AnimationPlayer.idl', 'animation/AnimationTimeline.idl', 'animation/Timing.idl', 'clipboard/DataTransfer.idl', @@ -50,6 +50,8 @@ 'css/WebKitCSSFilterValue.idl', 'css/WebKitCSSMatrix.idl', 'css/WebKitCSSTransformValue.idl', + 'dom/ArrayBuffer.idl', + 'dom/ArrayBufferView.idl', 'dom/Attr.idl', 'dom/CDATASection.idl', 'dom/CharacterData.idl', @@ -69,10 +71,16 @@ 'dom/DOMStringList.idl', 'dom/DOMStringMap.idl', 'dom/DOMTokenList.idl', + 'dom/DataView.idl', 'dom/Document.idl', 'dom/DocumentFragment.idl', 'dom/DocumentType.idl', 'dom/Element.idl', + 'dom/Float32Array.idl', + 'dom/Float64Array.idl', + 'dom/Int16Array.idl', + 'dom/Int32Array.idl', + 'dom/Int8Array.idl', 'dom/Iterator.idl', 'dom/MessageChannel.idl', 'dom/MessagePort.idl', @@ -92,6 +100,10 @@ 'dom/TouchList.idl', 'dom/TreeWalker.idl', 'dom/URL.idl', + 'dom/Uint16Array.idl', + 'dom/Uint32Array.idl', + 'dom/Uint8Array.idl', + 'dom/Uint8ClampedArray.idl', 'dom/XMLDocument.idl', 'dom/shadow/ShadowRoot.idl', 'editing/Selection.idl', @@ -2041,6 +2053,14 @@ 'dom/ContextLifecycleObserver.cpp', 'dom/ContextLifecycleObserver.h', 'dom/CrossThreadTask.h', + 'dom/DOMArrayBuffer.cpp', + 'dom/DOMArrayBuffer.h', + 'dom/DOMArrayBufferDeallocationObserver.cpp', + 'dom/DOMArrayBufferDeallocationObserver.h', + 'dom/DOMArrayBufferView.h', + 'dom/DOMArrayPiece.h', + 'dom/DOMDataView.cpp', + 'dom/DOMDataView.h', 'dom/DOMError.cpp', 'dom/DOMError.h', 'dom/DOMException.cpp', @@ -2066,6 +2086,8 @@ 'dom/DOMStringMap.h', 'dom/DOMTokenList.cpp', 'dom/DOMTokenList.h', + 'dom/DOMTypedArray.cpp', + 'dom/DOMTypedArray.h', 'dom/DOMURL.cpp', 'dom/DOMURL.h', 'dom/DOMURLUtils.cpp', diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp index 0cd6f5e..306cdfd 100644 --- a/third_party/WebKit/Source/core/css/FontFace.cpp +++ b/third_party/WebKit/Source/core/css/FontFace.cpp @@ -47,6 +47,8 @@ #include "core/css/StylePropertySet.h" #include "core/css/StyleRule.h" #include "core/css/parser/CSSParser.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/DOMException.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" @@ -81,14 +83,14 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con return fontFace.release(); } -PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const FontFaceDescriptors& descriptors) +PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors& descriptors) { RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(context, family, descriptors)); fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->data()), source->byteLength()); return fontFace.release(); } -PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBufferView> source, const FontFaceDescriptors& descriptors) +PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<DOMArrayBufferView> source, const FontFaceDescriptors& descriptors) { RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(context, family, descriptors)); fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->baseAddress()), source->byteLength()); diff --git a/third_party/WebKit/Source/core/css/FontFace.h b/third_party/WebKit/Source/core/css/FontFace.h index ea61a91..3bc52d5 100644 --- a/third_party/WebKit/Source/core/css/FontFace.h +++ b/third_party/WebKit/Source/core/css/FontFace.h @@ -47,6 +47,8 @@ namespace blink { class CSSFontFace; class CSSValueList; +class DOMArrayBuffer; +class DOMArrayBufferView; class Dictionary; class Document; class ExceptionState; @@ -59,8 +61,8 @@ class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub public: enum LoadStatus { Unloaded, Loading, Loaded, Error }; - static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const FontFaceDescriptors&); - static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBufferView>, const FontFaceDescriptors&); + static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<DOMArrayBuffer> source, const FontFaceDescriptors&); + static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<DOMArrayBufferView>, const FontFaceDescriptors&); static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, const String& source, const FontFaceDescriptors&); static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFontFace*); diff --git a/third_party/WebKit/Source/core/dom/ArrayBuffer.idl b/third_party/WebKit/Source/core/dom/ArrayBuffer.idl new file mode 100644 index 0000000..12c506b --- /dev/null +++ b/third_party/WebKit/Source/core/dom/ArrayBuffer.idl @@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#ARRAYBUFFER + +[ + ImplementedAs=DOMArrayBuffer, + NoInterfaceObject, +] interface ArrayBuffer { + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/core/dom/ArrayBufferView.idl b/third_party/WebKit/Source/core/dom/ArrayBufferView.idl new file mode 100644 index 0000000..d300904 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/ArrayBufferView.idl @@ -0,0 +1,14 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#ARRAYBUFFERVIEW + +[ + ImplementedAs=DOMArrayBufferView, + NoInterfaceObject, +] interface ArrayBufferView { + readonly attribute ArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.cpp b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.cpp new file mode 100644 index 0000000..b3c0d52 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.cpp @@ -0,0 +1,35 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" +#include "core/dom/DOMArrayBuffer.h" + +#include "bindings/core/v8/DOMDataStore.h" +#include "bindings/core/v8/V8DOMWrapper.h" +#include "core/dom/DOMArrayBufferDeallocationObserver.h" + +namespace blink { + +v8::Handle<v8::Object> DOMArrayBuffer::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + // It's possible that no one except for the new wrapper owns this object at + // this moment, so we have to prevent GC to collect this object until the + // object gets associated with the wrapper. + RefPtr<DOMArrayBuffer> protect(this); + + ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate)); + + const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); + v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, data(), byteLength()); + + buffer()->setDeallocationObserver(DOMArrayBufferDeallocationObserver::instance()); + return associateWithWrapper(wrapperTypeInfo, wrapper, isolate); +} + +v8::Handle<v8::Object> DOMArrayBuffer::associateWithWrapper(const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) +{ + return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperTypeInfo, wrapper, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h new file mode 100644 index 0000000..821834f --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h @@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMArrayBuffer_h +#define DOMArrayBuffer_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "wtf/ArrayBuffer.h" +#include "wtf/RefCounted.h" + +namespace blink { + +class DOMArrayBuffer final : public RefCounted<DOMArrayBuffer>, public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr<DOMArrayBuffer> create(PassRefPtr<WTF::ArrayBuffer> buffer) + { + if (!buffer) + return nullptr; + return adoptRef(new DOMArrayBuffer(buffer)); + } + static PassRefPtr<DOMArrayBuffer> create(unsigned numElements, unsigned elementByteSize) + { + return adoptRef(new DOMArrayBuffer(WTF::ArrayBuffer::create(numElements, elementByteSize))); + } + static PassRefPtr<DOMArrayBuffer> create(const void* source, unsigned byteLength) + { + return adoptRef(new DOMArrayBuffer(WTF::ArrayBuffer::create(source, byteLength))); + } + static PassRefPtr<DOMArrayBuffer> create(WTF::ArrayBufferContents& contents) + { + return adoptRef(new DOMArrayBuffer(WTF::ArrayBuffer::create(contents))); + } + + const WTF::ArrayBuffer* buffer() const { return m_buffer.get(); } + WTF::ArrayBuffer* buffer() { return m_buffer.get(); } + + const void* data() const { return buffer()->data(); } + unsigned long byteLength() const { return buffer()->byteLength(); } + void* data() { return buffer()->data(); } + bool transfer(WTF::ArrayBufferContents& result) { return buffer()->transfer(result); } + bool isNeutered() { return buffer()->isNeutered(); } + + virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override; + virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) override; + +private: + explicit DOMArrayBuffer(PassRefPtr<WTF::ArrayBuffer> buffer) + : m_buffer(buffer) + { + ASSERT(m_buffer); + } + + RefPtr<WTF::ArrayBuffer> m_buffer; +}; + +} // namespace blink + +#endif // DOMArrayBuffer_h diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.cpp b/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.cpp new file mode 100644 index 0000000..024f4f5 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.cpp @@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" +#include "core/dom/DOMArrayBufferDeallocationObserver.h" + +#include "wtf/StdLibExtras.h" +#include <v8.h> + +namespace blink { + +DOMArrayBufferDeallocationObserver* DOMArrayBufferDeallocationObserver::instance() +{ + DEFINE_STATIC_LOCAL(DOMArrayBufferDeallocationObserver, deallocationObserver, ()); + return &deallocationObserver; +} + +void DOMArrayBufferDeallocationObserver::arrayBufferDeallocated(unsigned sizeInBytes) +{ + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-static_cast<int>(sizeInBytes)); +} + +void DOMArrayBufferDeallocationObserver::blinkAllocatedMemory(unsigned sizeInBytes) +{ + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(static_cast<int>(sizeInBytes)); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.h b/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.h new file mode 100644 index 0000000..1560942 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayBufferDeallocationObserver.h @@ -0,0 +1,24 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMArrayBufferDeallocationObserver_h +#define DOMArrayBufferDeallocationObserver_h + +#include "wtf/ArrayBufferDeallocationObserver.h" + +namespace blink { + +class DOMArrayBufferDeallocationObserver final : public WTF::ArrayBufferDeallocationObserver { +public: + static DOMArrayBufferDeallocationObserver* instance(); + + virtual void arrayBufferDeallocated(unsigned sizeInBytes) override; + +protected: + virtual void blinkAllocatedMemory(unsigned sizeInBytes) override; +}; + +} // namespace blink + +#endif // DOMArrayBufferDeallocationObserver_h diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h b/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h new file mode 100644 index 0000000..d6963b6 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h @@ -0,0 +1,65 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMArrayBufferView_h +#define DOMArrayBufferView_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMArrayBuffer.h" +#include "wtf/ArrayBufferView.h" +#include "wtf/RefCounted.h" + +namespace blink { + +class DOMArrayBufferView : public RefCounted<DOMArrayBufferView>, public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + PassRefPtr<DOMArrayBuffer> buffer() const + { + if (!m_domArrayBuffer) + m_domArrayBuffer = DOMArrayBuffer::create(view()->buffer()); + return m_domArrayBuffer; + } + + const WTF::ArrayBufferView* view() const { return m_bufferView.get(); } + WTF::ArrayBufferView* view() { return m_bufferView.get(); } + + WTF::ArrayBufferView::ViewType type() const { return view()->type(); } + void* baseAddress() const { return view()->baseAddress(); } + unsigned long byteOffset() const { return view()->byteOffset(); } + unsigned long byteLength() const { return view()->byteLength(); } + + virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override + { + ASSERT_NOT_REACHED(); + return v8::Handle<v8::Object>(); + } + virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) override + { + ASSERT_NOT_REACHED(); + return v8::Handle<v8::Object>(); + } + +protected: + explicit DOMArrayBufferView(PassRefPtr<WTF::ArrayBufferView> bufferView) + : m_bufferView(bufferView) + { + ASSERT(m_bufferView); + } + DOMArrayBufferView(PassRefPtr<WTF::ArrayBufferView> bufferView, PassRefPtr<DOMArrayBuffer> domArrayBuffer) + : m_bufferView(bufferView), m_domArrayBuffer(domArrayBuffer) + { + ASSERT(m_bufferView); + ASSERT(m_domArrayBuffer); + ASSERT(m_domArrayBuffer->buffer() == m_bufferView->buffer()); + } + +private: + RefPtr<WTF::ArrayBufferView> m_bufferView; + mutable RefPtr<DOMArrayBuffer> m_domArrayBuffer; +}; + +} // namespace blink + +#endif // DOMArrayBufferView_h diff --git a/third_party/WebKit/Source/core/dom/DOMArrayPiece.h b/third_party/WebKit/Source/core/dom/DOMArrayPiece.h new file mode 100644 index 0000000..bf69e16 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMArrayPiece.h @@ -0,0 +1,24 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMArrayPiece_h +#define DOMArrayPiece_h + +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" +#include "wtf/ArrayPiece.h" + +namespace blink { + +class DOMArrayPiece : public WTF::ArrayPiece { +public: + DOMArrayPiece(DOMArrayBuffer* buffer) + : ArrayPiece(buffer->buffer()) { } + DOMArrayPiece(DOMArrayBufferView* view) + : ArrayPiece(view->view()) { } +}; + +} // namespace blink + +#endif // DOMArrayPiece_h diff --git a/third_party/WebKit/Source/core/dom/DOMDataView.cpp b/third_party/WebKit/Source/core/dom/DOMDataView.cpp new file mode 100644 index 0000000..9abfe03 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMDataView.cpp @@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" +#include "core/dom/DOMDataView.h" + +#include "bindings/core/v8/DOMDataStore.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMWrapper.h" + +namespace blink { + +PassRefPtr<DOMDataView> DOMDataView::create(PassRefPtr<DOMArrayBuffer> prpBuffer, unsigned byteOffset, unsigned byteLength) +{ + RefPtr<DOMArrayBuffer> buffer = prpBuffer; + return adoptRef(new DOMDataView(DataView::create(buffer->buffer(), byteOffset, byteLength), buffer)); +} + +v8::Handle<v8::Object> DOMDataView::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + // It's possible that no one except for the new wrapper owns this object at + // this moment, so we have to prevent GC to collect this object until the + // object gets associated with the wrapper. + RefPtr<DOMDataView> protect(this); + + ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate)); + + const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); + v8::Local<v8::Value> v8Buffer = toV8(buffer(), creationContext, isolate); + ASSERT(v8Buffer->IsArrayBuffer()); + + v8::Handle<v8::Object> wrapper = v8::DataView::New(v8Buffer.As<v8::ArrayBuffer>(), byteOffset(), byteLength()); + + return associateWithWrapper(wrapperTypeInfo, wrapper, isolate); +} + +v8::Handle<v8::Object> DOMDataView::associateWithWrapper(const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) +{ + return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperTypeInfo, wrapper, isolate); +} + +} // namespace blink diff --git a/third_party/WebKit/Source/core/dom/DOMDataView.h b/third_party/WebKit/Source/core/dom/DOMDataView.h new file mode 100644 index 0000000..85576b0 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMDataView.h @@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMDataView_h +#define DOMDataView_h + +#include "core/dom/DOMArrayBufferView.h" +#include "core/html/canvas/DataView.h" + +namespace blink { + +class DOMDataView final : public DOMArrayBufferView { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr<DOMDataView> create(PassRefPtr<DOMArrayBuffer>, unsigned byteOffset, unsigned byteLength); + + const DataView* view() const { return static_cast<const DataView*>(DOMArrayBufferView::view()); } + DataView* view() { return static_cast<DataView*>(DOMArrayBufferView::view()); } + + virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override; + virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) override; + +private: + DOMDataView(PassRefPtr<DataView> dataView, PassRefPtr<DOMArrayBuffer> domArrayBuffer) + : DOMArrayBufferView(dataView, domArrayBuffer) { } +}; + +} // namespace blink + +#endif // DOMDataView_h diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp index 8148ac0..4ce3c35 100644 --- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp +++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp @@ -43,7 +43,7 @@ DOMMatrix* DOMMatrixReadOnly::scaleNonUniform(double sx, double sy, double sz, return DOMMatrix::create(this)->scaleNonUniformSelf(sx, sy, sz, ox, oy, oz); } -PassRefPtr<Float32Array> DOMMatrixReadOnly::toFloat32Array() const +PassRefPtr<DOMFloat32Array> DOMMatrixReadOnly::toFloat32Array() const { float array[] = { m_matrix.m11(), m_matrix.m12(), m_matrix.m13(), m_matrix.m14(), @@ -52,10 +52,10 @@ PassRefPtr<Float32Array> DOMMatrixReadOnly::toFloat32Array() const m_matrix.m41(), m_matrix.m42(), m_matrix.m43(), m_matrix.m44() }; - return Float32Array::create(array, 16); + return DOMFloat32Array::create(array, 16); } -PassRefPtr<Float64Array> DOMMatrixReadOnly::toFloat64Array() const +PassRefPtr<DOMFloat64Array> DOMMatrixReadOnly::toFloat64Array() const { double array[] = { m_matrix.m11(), m_matrix.m12(), m_matrix.m13(), m_matrix.m14(), @@ -64,7 +64,7 @@ PassRefPtr<Float64Array> DOMMatrixReadOnly::toFloat64Array() const m_matrix.m41(), m_matrix.m42(), m_matrix.m43(), m_matrix.m44() }; - return Float64Array::create(array, 16); + return DOMFloat64Array::create(array, 16); } } // namespace blink diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h index 5933420..6b9002d 100644 --- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h +++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h @@ -6,10 +6,9 @@ #define DOMMatrixReadOnly_h #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMTypedArray.h" #include "platform/heap/Handle.h" #include "platform/transforms/TransformationMatrix.h" -#include "wtf/Float32Array.h" -#include "wtf/Float64Array.h" namespace blink { @@ -51,8 +50,8 @@ public: DOMMatrix* scaleNonUniform(double sx, double sy = 1, double sz = 1, double ox = 0, double oy = 0, double oz = 0); - PassRefPtr<Float32Array> toFloat32Array() const; - PassRefPtr<Float64Array> toFloat64Array() const; + PassRefPtr<DOMFloat32Array> toFloat32Array() const; + PassRefPtr<DOMFloat64Array> toFloat64Array() const; const TransformationMatrix& matrix() const { return m_matrix; } diff --git a/third_party/WebKit/Source/core/dom/DOMTypedArray.cpp b/third_party/WebKit/Source/core/dom/DOMTypedArray.cpp new file mode 100644 index 0000000..dd34998 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMTypedArray.cpp @@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" +#include "core/dom/DOMTypedArray.h" + +#include "bindings/core/v8/DOMDataStore.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8DOMWrapper.h" + +namespace blink { + +template<typename WTFTypedArray, typename V8TypedArray> +v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + // It's possible that no one except for the new wrapper owns this object at + // this moment, so we have to prevent GC to collect this object until the + // object gets associated with the wrapper. + RefPtr<ThisType> protect(this); + + ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate)); + + const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); + RefPtr<DOMArrayBuffer> buffer = this->buffer(); + v8::Local<v8::Value> v8Buffer = toV8(buffer.get(), creationContext, isolate); + ASSERT(v8Buffer->IsArrayBuffer()); + + v8::Handle<v8::Object> wrapper = V8TypedArray::New(v8Buffer.As<v8::ArrayBuffer>(), byteOffset(), length()); + + return associateWithWrapper(wrapperTypeInfo, wrapper, isolate); +} + +template<typename WTFTypedArray, typename V8TypedArray> +v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::associateWithWrapper(const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate) +{ + return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperTypeInfo, wrapper, isolate); +} + +// Instantiation of the non-inline functions of the template classes. +#define INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Type) \ + INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL(WTF::Type##Array, v8::Type##Array) +#define INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL(WTFTypedArray, V8TypedArray) \ +template v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); \ +template v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) + +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int8); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int16); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int32); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint8); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint8Clamped); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint16); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint32); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Float32); +INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Float64); + +#undef INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS +#undef INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL + +} // namespace blink diff --git a/third_party/WebKit/Source/core/dom/DOMTypedArray.h b/third_party/WebKit/Source/core/dom/DOMTypedArray.h new file mode 100644 index 0000000..38d60ef --- /dev/null +++ b/third_party/WebKit/Source/core/dom/DOMTypedArray.h @@ -0,0 +1,82 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DOMTypedArray_h +#define DOMTypedArray_h + +#include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMArrayBufferView.h" +#include "wtf/Float32Array.h" +#include "wtf/Float64Array.h" +#include "wtf/Int16Array.h" +#include "wtf/Int32Array.h" +#include "wtf/Int8Array.h" +#include "wtf/Uint16Array.h" +#include "wtf/Uint32Array.h" +#include "wtf/Uint8Array.h" +#include "wtf/Uint8ClampedArray.h" +#include <v8.h> + +namespace blink { + +template<typename WTFTypedArray, typename V8TypedArray> +class DOMTypedArray final : public DOMArrayBufferView { + DEFINE_WRAPPERTYPEINFO(); + typedef DOMTypedArray<WTFTypedArray, V8TypedArray> ThisType; +public: + typedef typename WTFTypedArray::ValueType ValueType; + + static PassRefPtr<ThisType> create(PassRefPtr<WTFTypedArray> bufferView) + { + if (!bufferView.get()) + return nullptr; + return adoptRef(new ThisType(bufferView)); + } + static PassRefPtr<ThisType> create(unsigned length) + { + return adoptRef(new ThisType(WTFTypedArray::create(length))); + } + static PassRefPtr<ThisType> create(const ValueType* array, unsigned length) + { + return adoptRef(new ThisType(WTFTypedArray::create(array, length))); + } + static PassRefPtr<ThisType> create(PassRefPtr<WTF::ArrayBuffer> buffer, unsigned byteOffset, unsigned length) + { + return adoptRef(new ThisType(WTFTypedArray::create(buffer, byteOffset, length))); + } + static PassRefPtr<ThisType> create(PassRefPtr<DOMArrayBuffer> prpBuffer, unsigned byteOffset, unsigned length) + { + RefPtr<DOMArrayBuffer> buffer = prpBuffer; + return adoptRef(new ThisType(WTFTypedArray::create(buffer->buffer(), byteOffset, length), buffer)); + } + + const WTFTypedArray* view() const { return static_cast<const WTFTypedArray*>(DOMArrayBufferView::view()); } + WTFTypedArray* view() { return static_cast<WTFTypedArray*>(DOMArrayBufferView::view()); } + + ValueType* data() const { return view()->data(); } + unsigned length() const { return view()->length(); } + + virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override; + virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*) override; + +private: + explicit DOMTypedArray(PassRefPtr<WTFTypedArray> bufferView) + : DOMArrayBufferView(bufferView) { } + DOMTypedArray(PassRefPtr<WTFTypedArray> bufferView, PassRefPtr<DOMArrayBuffer> domArrayBuffer) + : DOMArrayBufferView(bufferView, domArrayBuffer) { } +}; + +typedef DOMTypedArray<WTF::Int8Array, v8::Int8Array> DOMInt8Array; +typedef DOMTypedArray<WTF::Int16Array, v8::Int16Array> DOMInt16Array; +typedef DOMTypedArray<WTF::Int32Array, v8::Int32Array> DOMInt32Array; +typedef DOMTypedArray<WTF::Uint8Array, v8::Uint8Array> DOMUint8Array; +typedef DOMTypedArray<WTF::Uint8ClampedArray, v8::Uint8ClampedArray> DOMUint8ClampedArray; +typedef DOMTypedArray<WTF::Uint16Array, v8::Uint16Array> DOMUint16Array; +typedef DOMTypedArray<WTF::Uint32Array, v8::Uint32Array> DOMUint32Array; +typedef DOMTypedArray<WTF::Float32Array, v8::Float32Array> DOMFloat32Array; +typedef DOMTypedArray<WTF::Float64Array, v8::Float64Array> DOMFloat64Array; + +} // namespace blink + +#endif // DOMTypedArray_h diff --git a/third_party/WebKit/Source/core/html/canvas/DataView.idl b/third_party/WebKit/Source/core/dom/DataView.idl index 9744bdae..7332c71 100644 --- a/third_party/WebKit/Source/core/html/canvas/DataView.idl +++ b/third_party/WebKit/Source/core/dom/DataView.idl @@ -23,10 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// https://www.khronos.org/registry/typedarray/specs/latest/#DATAVIEW + [ - Custom=Wrap, - CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength), Exposed=(Window,Worker), + ImplementedAs=DOMDataView, TypeChecking=Interface, ] interface DataView : ArrayBufferView { // All these methods raise an exception if they would read or write beyond the end of the view. diff --git a/third_party/WebKit/Source/core/dom/Float32Array.idl b/third_party/WebKit/Source/core/dom/Float32Array.idl new file mode 100644 index 0000000..a0f1e1a --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Float32Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMFloat32Array, + NoInterfaceObject, +] interface Float32Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Float64Array.idl b/third_party/WebKit/Source/core/dom/Float64Array.idl new file mode 100644 index 0000000..f3843402 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Float64Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMFloat64Array, + NoInterfaceObject, +] interface Float64Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Int16Array.idl b/third_party/WebKit/Source/core/dom/Int16Array.idl new file mode 100644 index 0000000..19edc3c --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Int16Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMInt16Array, + NoInterfaceObject, +] interface Int16Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Int32Array.idl b/third_party/WebKit/Source/core/dom/Int32Array.idl new file mode 100644 index 0000000..76a42f6 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Int32Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMInt32Array, + NoInterfaceObject, +] interface Int32Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Int8Array.idl b/third_party/WebKit/Source/core/dom/Int8Array.idl new file mode 100644 index 0000000..a56cf6d --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Int8Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMInt8Array, + NoInterfaceObject, +] interface Int8Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Uint16Array.idl b/third_party/WebKit/Source/core/dom/Uint16Array.idl new file mode 100644 index 0000000..c494d06 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Uint16Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMUint16Array, + NoInterfaceObject, +] interface Uint16Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Uint32Array.idl b/third_party/WebKit/Source/core/dom/Uint32Array.idl new file mode 100644 index 0000000..c68b421 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Uint32Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMUint32Array, + NoInterfaceObject, +] interface Uint32Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Uint8Array.idl b/third_party/WebKit/Source/core/dom/Uint8Array.idl new file mode 100644 index 0000000..5070342 --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Uint8Array.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMUint8Array, + NoInterfaceObject, +] interface Uint8Array : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/dom/Uint8ClampedArray.idl b/third_party/WebKit/Source/core/dom/Uint8ClampedArray.idl new file mode 100644 index 0000000..0b74baf --- /dev/null +++ b/third_party/WebKit/Source/core/dom/Uint8ClampedArray.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS + +[ + ImplementedAs=DOMUint8ClampedArray, + NoInterfaceObject, +] interface Uint8ClampedArray : ArrayBufferView { +}; diff --git a/third_party/WebKit/Source/core/events/MessageEvent.cpp b/third_party/WebKit/Source/core/events/MessageEvent.cpp index 030d17f..4879f59 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.cpp +++ b/third_party/WebKit/Source/core/events/MessageEvent.cpp @@ -30,7 +30,7 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" +#include "bindings/core/v8/V8ArrayBuffer.h" namespace blink { @@ -114,7 +114,7 @@ MessageEvent::MessageEvent(Blob* data, const String& origin) { } -MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin) +MessageEvent::MessageEvent(PassRefPtr<DOMArrayBuffer> data, const String& origin) : Event(EventTypeNames::message, false, false) , m_dataType(DataTypeArrayBuffer) , m_dataAsArrayBuffer(data) diff --git a/third_party/WebKit/Source/core/events/MessageEvent.h b/third_party/WebKit/Source/core/events/MessageEvent.h index 574e13c..5afcaf5 100644 --- a/third_party/WebKit/Source/core/events/MessageEvent.h +++ b/third_party/WebKit/Source/core/events/MessageEvent.h @@ -29,12 +29,12 @@ #define MessageEvent_h #include "bindings/core/v8/SerializedScriptValue.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/MessagePort.h" #include "core/events/Event.h" #include "core/events/EventTarget.h" -#include "core/dom/MessagePort.h" #include "core/fileapi/Blob.h" #include "core/frame/LocalDOMWindow.h" -#include "wtf/ArrayBuffer.h" namespace blink { @@ -74,7 +74,7 @@ public: { return adoptRefWillBeNoop(new MessageEvent(data, origin)); } - static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data, const String& origin = String()) + static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<DOMArrayBuffer> data, const String& origin = String()) { return adoptRefWillBeNoop(new MessageEvent(data, origin)); } @@ -103,7 +103,7 @@ public: SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue || m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); } String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; } Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); } - ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); } + DOMArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); } void setSerializedData(PassRefPtr<SerializedScriptValue> data) { @@ -126,13 +126,13 @@ private: MessageEvent(const String& data, const String& origin); MessageEvent(Blob* data, const String& origin); - MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin); + MessageEvent(PassRefPtr<DOMArrayBuffer> data, const String& origin); DataType m_dataType; RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; String m_dataAsString; PersistentWillBeMember<Blob> m_dataAsBlob; - RefPtr<ArrayBuffer> m_dataAsArrayBuffer; + RefPtr<DOMArrayBuffer> m_dataAsArrayBuffer; String m_origin; String m_lastEventId; RefPtrWillBeMember<EventTarget> m_source; diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp b/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp index 2be5a60..1b9788a 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp +++ b/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp @@ -32,11 +32,11 @@ #include "core/fileapi/FileReaderSync.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/ExceptionCode.h" #include "core/fileapi/Blob.h" #include "core/fileapi/FileError.h" #include "core/fileapi/FileReaderLoader.h" -#include "wtf/ArrayBuffer.h" #include "wtf/PassRefPtr.h" namespace blink { @@ -45,7 +45,7 @@ FileReaderSync::FileReaderSync() { } -PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState) +PassRefPtr<DOMArrayBuffer> FileReaderSync::readAsArrayBuffer(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwDOMException(NotFoundError, FileError::notFoundErrorMessage); @@ -55,7 +55,7 @@ PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ExecutionContext* exec FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0); startLoading(executionContext, loader, *blob, exceptionState); - return loader.arrayBufferResult(); + return DOMArrayBuffer::create(loader.arrayBufferResult()); } String FileReaderSync::readAsBinaryString(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState) diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderSync.h b/third_party/WebKit/Source/core/fileapi/FileReaderSync.h index 39b72fb..7ab287e 100644 --- a/third_party/WebKit/Source/core/fileapi/FileReaderSync.h +++ b/third_party/WebKit/Source/core/fileapi/FileReaderSync.h @@ -33,16 +33,16 @@ #include "bindings/core/v8/ScriptWrappable.h" #include "platform/heap/Handle.h" -#include "wtf/Forward.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" namespace blink { class Blob; +class DOMArrayBuffer; class ExceptionState; -class FileReaderLoader; class ExecutionContext; +class FileReaderLoader; class FileReaderSync final : public GarbageCollected<FileReaderSync>, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -52,7 +52,7 @@ public: return new FileReaderSync(); } - PassRefPtr<ArrayBuffer> readAsArrayBuffer(ExecutionContext*, Blob*, ExceptionState&); + PassRefPtr<DOMArrayBuffer> readAsArrayBuffer(ExecutionContext*, Blob*, ExceptionState&); String readAsBinaryString(ExecutionContext*, Blob*, ExceptionState&); String readAsText(ExecutionContext* executionContext, Blob* blob, ExceptionState& ec) { diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp index ceb057a..c9254d2 100644 --- a/third_party/WebKit/Source/core/html/ImageData.cpp +++ b/third_party/WebKit/Source/core/html/ImageData.cpp @@ -30,7 +30,7 @@ #include "core/html/ImageData.h" #include "bindings/core/v8/ExceptionState.h" -#include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" +#include "bindings/core/v8/V8Uint8ClampedArray.h" #include "core/dom/ExceptionCode.h" #include "platform/RuntimeEnabledFeatures.h" @@ -59,7 +59,7 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(const IntSize& size, PassRef || static_cast<unsigned>(dataSize.unsafeGet()) > byteArray->length()) return nullptr; - return adoptRefWillBeNoop(new ImageData(size, byteArray)); + return adoptRefWillBeNoop(new ImageData(size, DOMUint8ClampedArray::create(byteArray))); } PassRefPtrWillBeRawPtr<ImageData> ImageData::create(unsigned width, unsigned height, ExceptionState& exceptionState) @@ -86,7 +86,7 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(unsigned width, unsigned hei return imageData.release(); } -PassRefPtrWillBeRawPtr<ImageData> ImageData::create(Uint8ClampedArray* data, unsigned width, unsigned height, ExceptionState& exceptionState) +PassRefPtrWillBeRawPtr<ImageData> ImageData::create(DOMUint8ClampedArray* data, unsigned width, unsigned height, ExceptionState& exceptionState) { if (!RuntimeEnabledFeatures::imageDataConstructorEnabled()) { exceptionState.throwTypeError("Illegal constructor"); @@ -131,7 +131,7 @@ v8::Handle<v8::Object> ImageData::associateWithWrapper(const WrapperTypeInfo* wr if (!wrapper.IsEmpty()) { // Create a V8 Uint8ClampedArray object. - v8::Handle<v8::Value> pixelArray = toV8(data(), wrapper, isolate); + v8::Handle<v8::Value> pixelArray = toV8(m_data.get(), wrapper, isolate); // Set the "data" property of the ImageData object to // the created v8 object, eliminating the C++ callback // when accessing the "data" property. @@ -143,11 +143,11 @@ v8::Handle<v8::Object> ImageData::associateWithWrapper(const WrapperTypeInfo* wr ImageData::ImageData(const IntSize& size) : m_size(size) - , m_data(Uint8ClampedArray::create(size.width() * size.height() * 4)) + , m_data(DOMUint8ClampedArray::create(size.width() * size.height() * 4)) { } -ImageData::ImageData(const IntSize& size, PassRefPtr<Uint8ClampedArray> byteArray) +ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteArray) : m_size(size) , m_data(byteArray) { diff --git a/third_party/WebKit/Source/core/html/ImageData.h b/third_party/WebKit/Source/core/html/ImageData.h index 9dbe281..f565605 100644 --- a/third_party/WebKit/Source/core/html/ImageData.h +++ b/third_party/WebKit/Source/core/html/ImageData.h @@ -30,11 +30,11 @@ #define ImageData_h #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMTypedArray.h" #include "platform/geometry/IntSize.h" #include "platform/heap/Handle.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" -#include "wtf/Uint8ClampedArray.h" namespace blink { @@ -46,12 +46,13 @@ public: static PassRefPtrWillBeRawPtr<ImageData> create(const IntSize&); static PassRefPtrWillBeRawPtr<ImageData> create(const IntSize&, PassRefPtr<Uint8ClampedArray>); static PassRefPtrWillBeRawPtr<ImageData> create(unsigned width, unsigned height, ExceptionState&); - static PassRefPtrWillBeRawPtr<ImageData> create(Uint8ClampedArray*, unsigned width, unsigned height, ExceptionState&); + static PassRefPtrWillBeRawPtr<ImageData> create(DOMUint8ClampedArray*, unsigned width, unsigned height, ExceptionState&); IntSize size() const { return m_size; } int width() const { return m_size.width(); } int height() const { return m_size.height(); } - Uint8ClampedArray* data() const { return m_data.get(); } + const Uint8ClampedArray* data() const { return m_data->view(); } + Uint8ClampedArray* data() { return m_data->view(); } void trace(Visitor*) { } @@ -59,10 +60,10 @@ public: private: explicit ImageData(const IntSize&); - ImageData(const IntSize&, PassRefPtr<Uint8ClampedArray>); + ImageData(const IntSize&, PassRefPtr<DOMUint8ClampedArray>); IntSize m_size; - RefPtr<Uint8ClampedArray> m_data; + RefPtr<DOMUint8ClampedArray> m_data; }; } // namespace blink diff --git a/third_party/WebKit/Source/core/html/MediaKeyEvent.cpp b/third_party/WebKit/Source/core/html/MediaKeyEvent.cpp index b73870a..bdc4ea1 100644 --- a/third_party/WebKit/Source/core/html/MediaKeyEvent.cpp +++ b/third_party/WebKit/Source/core/html/MediaKeyEvent.cpp @@ -26,8 +26,6 @@ #include "config.h" #include "core/html/MediaKeyEvent.h" -#include "wtf/Uint8Array.h" - namespace blink { MediaKeyEventInit::MediaKeyEventInit() diff --git a/third_party/WebKit/Source/core/html/MediaKeyEvent.h b/third_party/WebKit/Source/core/html/MediaKeyEvent.h index 07945c6..cb69719 100644 --- a/third_party/WebKit/Source/core/html/MediaKeyEvent.h +++ b/third_party/WebKit/Source/core/html/MediaKeyEvent.h @@ -26,6 +26,7 @@ #ifndef MediaKeyEvent_h #define MediaKeyEvent_h +#include "core/dom/DOMTypedArray.h" #include "core/events/Event.h" #include "core/html/MediaKeyError.h" @@ -36,8 +37,8 @@ struct MediaKeyEventInit : public EventInit { String keySystem; String sessionId; - RefPtr<Uint8Array> initData; - RefPtr<Uint8Array> message; + RefPtr<DOMUint8Array> initData; + RefPtr<DOMUint8Array> message; String defaultURL; RefPtrWillBeMember<MediaKeyError> errorCode; unsigned short systemCode; @@ -62,8 +63,8 @@ public: String keySystem() const { return m_keySystem; } String sessionId() const { return m_sessionId; } - Uint8Array* initData() const { return m_initData.get(); } - Uint8Array* message() const { return m_message.get(); } + DOMUint8Array* initData() const { return m_initData.get(); } + DOMUint8Array* message() const { return m_message.get(); } String defaultURL() const { return m_defaultURL; } MediaKeyError* errorCode() const { return m_errorCode.get(); } unsigned short systemCode() const { return m_systemCode; } @@ -76,8 +77,8 @@ private: String m_keySystem; String m_sessionId; - RefPtr<Uint8Array> m_initData; - RefPtr<Uint8Array> m_message; + RefPtr<DOMUint8Array> m_initData; + RefPtr<DOMUint8Array> m_message; String m_defaultURL; RefPtrWillBeMember<MediaKeyError> m_errorCode; unsigned short m_systemCode; diff --git a/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl b/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl deleted file mode 100644 index 478bf25..0000000 --- a/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -[ - Custom=Wrap, - NoInterfaceObject, -] 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.cpp b/third_party/WebKit/Source/core/html/canvas/DataView.cpp index 8ce7fcc..1a6d8b2 100644 --- a/third_party/WebKit/Source/core/html/canvas/DataView.cpp +++ b/third_party/WebKit/Source/core/html/canvas/DataView.cpp @@ -27,8 +27,6 @@ #include "core/html/canvas/DataView.h" #include "bindings/core/v8/ExceptionState.h" -#include "bindings/core/v8/custom/V8DataViewCustom.h" -#include "bindings/core/v8/custom/V8TypedArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "platform/CheckedInt.h" #include "wtf/CPU.h" @@ -240,11 +238,6 @@ void DataView::setFloat64(unsigned byteOffset, double value, bool littleEndian, setData<double>(byteOffset, value, littleEndian, exceptionState); } -v8::Handle<v8::Object> DataView::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::wrap(this, creationContext, isolate); -} - void DataView::neuter() { ArrayBufferView::neuter(); diff --git a/third_party/WebKit/Source/core/html/canvas/DataView.h b/third_party/WebKit/Source/core/html/canvas/DataView.h index c0f4896..a0dbd5c8 100644 --- a/third_party/WebKit/Source/core/html/canvas/DataView.h +++ b/third_party/WebKit/Source/core/html/canvas/DataView.h @@ -26,21 +26,19 @@ #ifndef DataView_h #define DataView_h -#include "bindings/core/v8/ScriptWrappable.h" #include "wtf/ArrayBufferView.h" -#include "wtf/PassRefPtr.h" namespace blink { class ExceptionState; -class DataView final : public ArrayBufferView, public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); +class DataView final : public ArrayBufferView { public: static PassRefPtr<DataView> create(unsigned length); static PassRefPtr<DataView> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength); virtual unsigned byteLength() const override { return m_byteLength; } + virtual ViewType type() const override { return TypeDataView; } int8_t getInt8(unsigned byteOffset, ExceptionState&); uint8_t getUint8(unsigned byteOffset, ExceptionState&); @@ -72,13 +70,6 @@ public: void setFloat64(unsigned byteOffset, double value, ExceptionState& ec) { setFloat64(byteOffset, value, false, ec); } void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionState&); - virtual ViewType type() const override - { - return TypeDataView; - } - - virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*) override; - protected: virtual void neuter() override; @@ -86,7 +77,7 @@ private: DataView(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength); template<typename T> - inline bool beyondRange(unsigned byteOffset) const { return byteOffset >= m_byteLength || byteOffset + sizeof(T) > m_byteLength; } + bool beyondRange(unsigned byteOffset) const { return byteOffset >= m_byteLength || byteOffset + sizeof(T) > m_byteLength; } template<typename T> T getData(unsigned byteOffset, bool littleEndian, ExceptionState&) const; diff --git a/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.cpp b/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.cpp index be26e1c..72538e9 100644 --- a/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.cpp +++ b/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "core/html/canvas/WebGLGetInfo.h" - namespace blink { WebGLGetInfo::WebGLGetInfo(bool value) @@ -109,7 +108,7 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer> value) { } -WebGLGetInfo::WebGLGetInfo(PassRefPtr<Float32Array> value) +WebGLGetInfo::WebGLGetInfo(PassRefPtr<DOMFloat32Array> value) : m_type(kTypeWebGLFloatArray) , m_bool(false) , m_float(0) @@ -129,7 +128,7 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer> value) { } -WebGLGetInfo::WebGLGetInfo(PassRefPtr<Int32Array> value) +WebGLGetInfo::WebGLGetInfo(PassRefPtr<DOMInt32Array> value) : m_type(kTypeWebGLIntArray) , m_bool(false) , m_float(0) @@ -169,7 +168,7 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture> value) { } -WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value) +WebGLGetInfo::WebGLGetInfo(PassRefPtr<DOMUint8Array> value) : m_type(kTypeWebGLUnsignedByteArray) , m_bool(false) , m_float(0) @@ -179,7 +178,7 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value) { } -WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint32Array> value) +WebGLGetInfo::WebGLGetInfo(PassRefPtr<DOMUint32Array> value) : m_type(kTypeWebGLUnsignedIntArray) , m_bool(false) , m_float(0) @@ -246,7 +245,7 @@ PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLGetInfo::getWebGLBuffer() const return m_webglBuffer; } -PassRefPtr<Float32Array> WebGLGetInfo::getWebGLFloatArray() const +PassRefPtr<DOMFloat32Array> WebGLGetInfo::getWebGLFloatArray() const { ASSERT(getType() == kTypeWebGLFloatArray); return m_webglFloatArray; @@ -258,7 +257,7 @@ PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLGetInfo::getWebGLFramebuffer() con return m_webglFramebuffer; } -PassRefPtr<Int32Array> WebGLGetInfo::getWebGLIntArray() const +PassRefPtr<DOMInt32Array> WebGLGetInfo::getWebGLIntArray() const { ASSERT(getType() == kTypeWebGLIntArray); return m_webglIntArray; @@ -282,13 +281,13 @@ PassRefPtrWillBeRawPtr<WebGLTexture> WebGLGetInfo::getWebGLTexture() const return m_webglTexture; } -PassRefPtr<Uint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const +PassRefPtr<DOMUint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const { ASSERT(getType() == kTypeWebGLUnsignedByteArray); return m_webglUnsignedByteArray; } -PassRefPtr<Uint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const +PassRefPtr<DOMUint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const { ASSERT(getType() == kTypeWebGLUnsignedIntArray); return m_webglUnsignedIntArray; diff --git a/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.h b/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.h index 22dc44a..f22a92b 100644 --- a/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.h +++ b/third_party/WebKit/Source/core/html/canvas/WebGLGetInfo.h @@ -27,18 +27,15 @@ #ifndef WebGLGetInfo_h #define WebGLGetInfo_h +#include "core/dom/DOMTypedArray.h" #include "core/html/canvas/WebGLBuffer.h" #include "core/html/canvas/WebGLFramebuffer.h" #include "core/html/canvas/WebGLProgram.h" #include "core/html/canvas/WebGLRenderbuffer.h" #include "core/html/canvas/WebGLTexture.h" #include "core/html/canvas/WebGLVertexArrayObjectOES.h" -#include "wtf/Float32Array.h" -#include "wtf/Int32Array.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" -#include "wtf/Uint32Array.h" -#include "wtf/Uint8Array.h" #include "wtf/text/WTFString.h" namespace blink { @@ -81,16 +78,16 @@ public: explicit WebGLGetInfo(const String& value); explicit WebGLGetInfo(unsigned value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer> value); - explicit WebGLGetInfo(PassRefPtr<Float32Array> value); + explicit WebGLGetInfo(PassRefPtr<DOMFloat32Array> value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer> value); - explicit WebGLGetInfo(PassRefPtr<Int32Array> value); + explicit WebGLGetInfo(PassRefPtr<DOMInt32Array> value); // FIXME: implement WebGLObjectArray // WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLObjectArray> value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram> value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer> value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture> value); - explicit WebGLGetInfo(PassRefPtr<Uint8Array> value); - explicit WebGLGetInfo(PassRefPtr<Uint32Array> value); + explicit WebGLGetInfo(PassRefPtr<DOMUint8Array> value); + explicit WebGLGetInfo(PassRefPtr<DOMUint32Array> value); explicit WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> value); Type getType() const; @@ -102,16 +99,16 @@ public: const String& getString() const; unsigned getUnsignedInt() const; PassRefPtrWillBeRawPtr<WebGLBuffer> getWebGLBuffer() const; - PassRefPtr<Float32Array> getWebGLFloatArray() const; + PassRefPtr<DOMFloat32Array> getWebGLFloatArray() const; PassRefPtrWillBeRawPtr<WebGLFramebuffer> getWebGLFramebuffer() const; - PassRefPtr<Int32Array> getWebGLIntArray() const; + PassRefPtr<DOMInt32Array> getWebGLIntArray() const; // FIXME: implement WebGLObjectArray // PassRefPtr<WebGLObjectArray> getWebGLObjectArray() const; PassRefPtrWillBeRawPtr<WebGLProgram> getWebGLProgram() const; PassRefPtrWillBeRawPtr<WebGLRenderbuffer> getWebGLRenderbuffer() const; PassRefPtrWillBeRawPtr<WebGLTexture> getWebGLTexture() const; - PassRefPtr<Uint8Array> getWebGLUnsignedByteArray() const; - PassRefPtr<Uint32Array> getWebGLUnsignedIntArray() const; + PassRefPtr<DOMUint8Array> getWebGLUnsignedByteArray() const; + PassRefPtr<DOMUint32Array> getWebGLUnsignedIntArray() const; PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const; private: @@ -123,16 +120,16 @@ private: String m_string; unsigned m_unsignedInt; RefPtrWillBeMember<WebGLBuffer> m_webglBuffer; - RefPtr<Float32Array> m_webglFloatArray; + RefPtr<DOMFloat32Array> m_webglFloatArray; RefPtrWillBeMember<WebGLFramebuffer> m_webglFramebuffer; - RefPtr<Int32Array> m_webglIntArray; + RefPtr<DOMInt32Array> m_webglIntArray; // FIXME: implement WebGLObjectArray // RefPtr<WebGLObjectArray> m_webglObjectArray; RefPtrWillBeMember<WebGLProgram> m_webglProgram; RefPtrWillBeMember<WebGLRenderbuffer> m_webglRenderbuffer; RefPtrWillBeMember<WebGLTexture> m_webglTexture; - RefPtr<Uint8Array> m_webglUnsignedByteArray; - RefPtr<Uint32Array> m_webglUnsignedIntArray; + RefPtr<DOMUint8Array> m_webglUnsignedByteArray; + RefPtr<DOMUint32Array> m_webglUnsignedIntArray; RefPtrWillBeMember<WebGLVertexArrayObjectOES> m_webglVertexArrayObject; }; diff --git a/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.cpp index 06443ac..bc1dcd53 100644 --- a/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.cpp @@ -28,6 +28,8 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMTypedArray.h" #include "core/dom/ExceptionCode.h" #include "core/fetch/ImageResource.h" #include "core/frame/LocalFrame.h" @@ -84,9 +86,7 @@ #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" #include "platform/graphics/gpu/DrawingBuffer.h" #include "public/platform/Platform.h" - #include "wtf/PassOwnPtr.h" -#include "wtf/Uint32Array.h" #include "wtf/text/StringBuilder.h" namespace blink { @@ -1263,7 +1263,7 @@ void WebGLRenderingContextBase::bufferData(GLenum target, long long size, GLenum bufferDataImpl(target, size, 0, usage); } -void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBuffer* data, GLenum usage) +void WebGLRenderingContextBase::bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage) { if (isContextLost()) return; @@ -1274,7 +1274,7 @@ void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBuffer* data, GLe bufferDataImpl(target, data->byteLength(), data->data(), usage); } -void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBufferView* data, GLenum usage) +void WebGLRenderingContextBase::bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage) { if (isContextLost()) return; @@ -1298,7 +1298,7 @@ void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, long long offse webContext()->bufferSubData(target, static_cast<GLintptr>(offset), size, data); } -void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, ArrayBuffer* data) +void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data) { if (isContextLost()) return; @@ -1307,7 +1307,7 @@ void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, A bufferSubDataImpl(target, offset, data->byteLength(), data->data()); } -void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, ArrayBufferView* data) +void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, DOMArrayBufferView* data) { if (isContextLost()) return; @@ -1407,7 +1407,7 @@ void WebGLRenderingContextBase::compileShader(WebGLShader* shader) webContext()->compileShader(objectOrZero(shader)); } -void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data) +void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBufferView* data) { if (isContextLost()) return; @@ -1441,7 +1441,7 @@ void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, tex->setLevelInfo(target, level, internalformat, width, height, GL_UNSIGNED_BYTE); } -void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data) +void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* data) { if (isContextLost()) return; @@ -2295,7 +2295,7 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) case GL_COLOR_WRITEMASK: return getBooleanArrayParameter(pname); case GL_COMPRESSED_TEXTURE_FORMATS: - return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())); + return WebGLGetInfo(DOMUint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())); case GL_CULL_FACE: return getBooleanParameter(pname); case GL_CULL_FACE_MODE: @@ -2807,14 +2807,14 @@ WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const webContext()->getUniformfv(objectOrZero(program), location, value); if (length == 1) return WebGLGetInfo(value[0]); - return WebGLGetInfo(Float32Array::create(value, length)); + return WebGLGetInfo(DOMFloat32Array::create(value, length)); } case GL_INT: { GLint value[4] = {0}; webContext()->getUniformiv(objectOrZero(program), location, value); if (length == 1) return WebGLGetInfo(value[0]); - return WebGLGetInfo(Int32Array::create(value, length)); + return WebGLGetInfo(DOMInt32Array::create(value, length)); } case GL_BOOL: { GLint value[4] = {0}; @@ -2887,7 +2887,7 @@ WebGLGetInfo WebGLRenderingContextBase::getVertexAttrib(GLuint index, GLenum pna case GL_VERTEX_ATTRIB_ARRAY_TYPE: return WebGLGetInfo(state.type); case GL_CURRENT_VERTEX_ATTRIB: - return WebGLGetInfo(Float32Array::create(m_vertexAttribValue[index].value, 4)); + return WebGLGetInfo(DOMFloat32Array::create(m_vertexAttribValue[index].value, 4)); default: synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter name"); return WebGLGetInfo(); @@ -3064,7 +3064,7 @@ void WebGLRenderingContextBase::polygonOffset(GLfloat factor, GLfloat units) webContext()->polygonOffset(factor, units); } -void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels) +void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels) { if (isContextLost()) return; @@ -3458,7 +3458,7 @@ PassRefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image* image, i void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& exceptionState) + GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exceptionState) { if (isContextLost() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferView, target, level, internalformat, width, height, border, format, type, 0, 0)) @@ -3715,7 +3715,7 @@ void WebGLRenderingContextBase::texSubImage2DImpl(GLenum target, GLint level, GL void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& exceptionState) + GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exceptionState) { if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed) || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferView, target, level, format, width, height, 0, format, type, xoffset, yoffset)) @@ -3821,7 +3821,7 @@ void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, webContext()->uniform1f(location->location(), x); } -void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32Array* v) +void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, DOMFloat32Array* v) { if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, 1)) return; @@ -3850,7 +3850,7 @@ void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, webContext()->uniform1i(location->location(), x); } -void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32Array* v) +void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, DOMInt32Array* v) { if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, 1)) return; @@ -3879,7 +3879,7 @@ void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, webContext()->uniform2f(location->location(), x, y); } -void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32Array* v) +void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, DOMFloat32Array* v) { if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, 2)) return; @@ -3908,7 +3908,7 @@ void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, webContext()->uniform2i(location->location(), x, y); } -void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32Array* v) +void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, DOMInt32Array* v) { if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, 2)) return; @@ -3937,7 +3937,7 @@ void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, webContext()->uniform3f(location->location(), x, y, z); } -void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32Array* v) +void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, DOMFloat32Array* v) { if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, 3)) return; @@ -3966,7 +3966,7 @@ void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, webContext()->uniform3i(location->location(), x, y, z); } -void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32Array* v) +void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, DOMInt32Array* v) { if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, 3)) return; @@ -3995,7 +3995,7 @@ void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, webContext()->uniform4f(location->location(), x, y, z, w); } -void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32Array* v) +void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, DOMFloat32Array* v) { if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, 4)) return; @@ -4024,7 +4024,7 @@ void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, webContext()->uniform4i(location->location(), x, y, z, w); } -void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32Array* v) +void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, DOMInt32Array* v) { if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, 4)) return; @@ -4040,7 +4040,7 @@ void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, webContext()->uniform4iv(location->location(), size >> 2, v); } -void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v) +void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4)) return; @@ -4054,7 +4054,7 @@ void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc webContext()->uniformMatrix2fv(location->location(), size >> 2, transpose, v); } -void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v) +void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9)) return; @@ -4068,7 +4068,7 @@ void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc webContext()->uniformMatrix3fv(location->location(), size / 9, transpose, v); } -void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v) +void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16)) return; @@ -4115,7 +4115,7 @@ void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f); } -void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, Float32Array* v) +void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, DOMFloat32Array* v) { vertexAttribfvImpl("vertexAttrib1fv", index, v, 1); } @@ -4130,7 +4130,7 @@ void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f); } -void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, Float32Array* v) +void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, DOMFloat32Array* v) { vertexAttribfvImpl("vertexAttrib2fv", index, v, 2); } @@ -4145,7 +4145,7 @@ void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f); } -void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, Float32Array* v) +void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, DOMFloat32Array* v) { vertexAttribfvImpl("vertexAttrib3fv", index, v, 3); } @@ -4160,7 +4160,7 @@ void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3); } -void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, Float32Array* v) +void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, DOMFloat32Array* v) { vertexAttribfvImpl("vertexAttrib4fv", index, v, 4); } @@ -4434,7 +4434,7 @@ WebGLGetInfo WebGLRenderingContextBase::getWebGLFloatArrayParameter(GLenum pname default: notImplemented(); } - return WebGLGetInfo(Float32Array::create(value, length)); + return WebGLGetInfo(DOMFloat32Array::create(value, length)); } WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GLenum pname) @@ -4454,7 +4454,7 @@ WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GLenum pname) default: notImplemented(); } - return WebGLGetInfo(Int32Array::create(value, length)); + return WebGLGetInfo(DOMInt32Array::create(value, length)); } void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionName, bool prepareToDraw) @@ -4812,7 +4812,7 @@ bool WebGLRenderingContextBase::validateTexFuncParameters(const char* functionNa return true; } -bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels, NullDisposition disposition) +bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullDisposition disposition) { // All calling functions check isContextLost, so a duplicate check is not needed here. if (!pixels) { @@ -4851,7 +4851,7 @@ bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GL case GL_HALF_FLOAT_OES: // OES_texture_half_float // As per the specification, ArrayBufferView should be null or a Uint16Array when // OES_texture_half_float is enabled. - if (pixels && pixels->type() != ArrayBufferView::TypeUint16) { + if (pixels->type() != ArrayBufferView::TypeUint16) { synthesizeGLError(GL_INVALID_OPERATION, functionName, "type HALF_FLOAT_OES but ArrayBufferView is not NULL and not Uint16Array"); return false; } @@ -4885,7 +4885,7 @@ bool WebGLRenderingContextBase::validateCompressedTexFormat(GLenum format) return m_compressedTextureFormats.contains(format); } -bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* pixels) +bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* pixels) { if (!pixels) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); @@ -5198,7 +5198,7 @@ bool WebGLRenderingContextBase::validateCapability(const char* functionName, GLe } } -bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array* v, GLsizei requiredMinSize) +bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, DOMFloat32Array* v, GLsizei requiredMinSize) { if (!v) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); @@ -5207,7 +5207,7 @@ bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa return validateUniformMatrixParameters(functionName, location, false, v->data(), v->length(), requiredMinSize); } -bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Int32Array* v, GLsizei requiredMinSize) +bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, DOMInt32Array* v, GLsizei requiredMinSize) { if (!v) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); @@ -5221,7 +5221,7 @@ bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize); } -bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v, GLsizei requiredMinSize) +bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* v, GLsizei requiredMinSize) { if (!v) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); @@ -5444,7 +5444,7 @@ void WebGLRenderingContextBase::vertexAttribfImpl(const char* functionName, GLui attribValue.value[3] = v3; } -void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLuint index, Float32Array* v, GLsizei expectedSize) +void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLuint index, DOMFloat32Array* v, GLsizei expectedSize) { if (isContextLost()) return; diff --git a/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.h b/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.h index b4b47c4..b053c63 100644 --- a/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContextBase.h @@ -28,6 +28,7 @@ #include "bindings/core/v8/Nullable.h" #include "core/dom/ActiveDOMObject.h" +#include "core/dom/DOMTypedArray.h" #include "core/html/canvas/CanvasRenderingContext.h" #include "core/html/canvas/WebGLExtensionName.h" #include "core/html/canvas/WebGLGetInfo.h" @@ -40,8 +41,6 @@ #include "platform/graphics/gpu/Extensions3DUtil.h" #include "platform/graphics/gpu/WebGLImageConversion.h" #include "public/platform/WebGraphicsContext3D.h" -#include "wtf/Float32Array.h" -#include "wtf/Int32Array.h" #include "wtf/OwnPtr.h" #include "wtf/text/WTFString.h" @@ -127,10 +126,10 @@ public: void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); void bufferData(GLenum target, long long size, GLenum usage); - void bufferData(GLenum target, ArrayBuffer* data, GLenum usage); - void bufferData(GLenum target, ArrayBufferView* data, GLenum usage); - void bufferSubData(GLenum target, long long offset, ArrayBuffer* data); - void bufferSubData(GLenum target, long long offset, ArrayBufferView* data); + void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); + void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); + void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); + void bufferSubData(GLenum target, long long offset, DOMArrayBufferView* data); GLenum checkFramebufferStatus(GLenum target); void clear(GLbitfield mask); @@ -140,8 +139,8 @@ public: void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void compileShader(WebGLShader*); - void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data); - void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data); + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBufferView* data); + void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* data); void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); @@ -222,7 +221,7 @@ public: void linkProgram(WebGLProgram*); void pixelStorei(GLenum pname, GLint param); void polygonOffset(GLfloat factor, GLfloat units); - void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels); + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels); void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); void sampleCoverage(GLfloat value, GLboolean invert); void scissor(GLint x, GLint y, GLsizei width, GLsizei height); @@ -236,7 +235,7 @@ public: void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, ArrayBufferView*, ExceptionState&); + GLenum format, GLenum type, DOMArrayBufferView*, ExceptionState&); void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData*, ExceptionState&); void texImage2D(GLenum target, GLint level, GLenum internalformat, @@ -251,7 +250,7 @@ public: void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, ArrayBufferView*, ExceptionState&); + GLenum format, GLenum type, DOMArrayBufferView*, ExceptionState&); void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ImageData*, ExceptionState&); void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -262,50 +261,50 @@ public: GLenum format, GLenum type, HTMLVideoElement*, ExceptionState&); void uniform1f(const WebGLUniformLocation*, GLfloat x); - void uniform1fv(const WebGLUniformLocation*, Float32Array* v); + void uniform1fv(const WebGLUniformLocation*, DOMFloat32Array* v); void uniform1fv(const WebGLUniformLocation*, GLfloat* v, GLsizei); void uniform1i(const WebGLUniformLocation*, GLint x); - void uniform1iv(const WebGLUniformLocation*, Int32Array* v); + void uniform1iv(const WebGLUniformLocation*, DOMInt32Array* v); void uniform1iv(const WebGLUniformLocation*, GLint* v, GLsizei); void uniform2f(const WebGLUniformLocation*, GLfloat x, GLfloat y); - void uniform2fv(const WebGLUniformLocation*, Float32Array* v); + void uniform2fv(const WebGLUniformLocation*, DOMFloat32Array* v); void uniform2fv(const WebGLUniformLocation*, GLfloat* v, GLsizei); void uniform2i(const WebGLUniformLocation*, GLint x, GLint y); - void uniform2iv(const WebGLUniformLocation*, Int32Array* v); + void uniform2iv(const WebGLUniformLocation*, DOMInt32Array* v); void uniform2iv(const WebGLUniformLocation*, GLint* v, GLsizei); void uniform3f(const WebGLUniformLocation*, GLfloat x, GLfloat y, GLfloat z); - void uniform3fv(const WebGLUniformLocation*, Float32Array* v); + void uniform3fv(const WebGLUniformLocation*, DOMFloat32Array* v); void uniform3fv(const WebGLUniformLocation*, GLfloat* v, GLsizei); void uniform3i(const WebGLUniformLocation*, GLint x, GLint y, GLint z); - void uniform3iv(const WebGLUniformLocation*, Int32Array* v); + void uniform3iv(const WebGLUniformLocation*, DOMInt32Array* v); void uniform3iv(const WebGLUniformLocation*, GLint* v, GLsizei); void uniform4f(const WebGLUniformLocation*, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void uniform4fv(const WebGLUniformLocation*, Float32Array* v); + void uniform4fv(const WebGLUniformLocation*, DOMFloat32Array* v); void uniform4fv(const WebGLUniformLocation*, GLfloat* v, GLsizei); void uniform4i(const WebGLUniformLocation*, GLint x, GLint y, GLint z, GLint w); - void uniform4iv(const WebGLUniformLocation*, Int32Array* v); + void uniform4iv(const WebGLUniformLocation*, DOMInt32Array* v); void uniform4iv(const WebGLUniformLocation*, GLint* v, GLsizei); - void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, Float32Array* value); + void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, DOMFloat32Array* value); void uniformMatrix2fv(const WebGLUniformLocation*, GLboolean transpose, GLfloat* value, GLsizei); - void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, Float32Array* value); + void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, DOMFloat32Array* value); void uniformMatrix3fv(const WebGLUniformLocation*, GLboolean transpose, GLfloat* value, GLsizei); - void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, Float32Array* value); + void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, DOMFloat32Array* value); void uniformMatrix4fv(const WebGLUniformLocation*, GLboolean transpose, GLfloat* value, GLsizei); void useProgram(WebGLProgram*); void validateProgram(WebGLProgram*); void vertexAttrib1f(GLuint index, GLfloat x); - void vertexAttrib1fv(GLuint index, Float32Array* values); + void vertexAttrib1fv(GLuint index, DOMFloat32Array* values); void vertexAttrib1fv(GLuint index, GLfloat* values, GLsizei); void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); - void vertexAttrib2fv(GLuint index, Float32Array* values); + void vertexAttrib2fv(GLuint index, DOMFloat32Array* values); void vertexAttrib2fv(GLuint index, GLfloat* values, GLsizei); void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); - void vertexAttrib3fv(GLuint index, Float32Array* values); + void vertexAttrib3fv(GLuint index, DOMFloat32Array* values); void vertexAttrib3fv(GLuint index, GLfloat* values, GLsizei); void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void vertexAttrib4fv(GLuint index, Float32Array* values); + void vertexAttrib4fv(GLuint index, DOMFloat32Array* values); void vertexAttrib4fv(GLuint index, GLfloat* values, GLsizei); void vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long long offset); @@ -797,7 +796,7 @@ protected: // Helper function to validate that the given ArrayBufferView // is of the correct type and contains enough data for the texImage call. // Generates GL error and returns false if parameters are invalid. - bool validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels, NullDisposition); + bool validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullDisposition); // Helper function to validate a given texture format is settable as in // you can supply data to texImage2D, or call texImage2D, copyTexImage2D and @@ -807,7 +806,7 @@ protected: // Helper function to validate compressed texture data is correct size // for the given format and dimensions. - bool validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* pixels); + bool validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* pixels); // Helper function for validating compressed texture formats. bool validateCompressedTexFormat(GLenum format); @@ -853,10 +852,10 @@ protected: bool validateCapability(const char* functionName, GLenum); // Helper function to validate input parameters for uniform functions. - bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Float32Array*, GLsizei mod); - bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Int32Array*, GLsizei mod); + bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, DOMFloat32Array*, GLsizei mod); + bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, DOMInt32Array*, GLsizei mod); bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GLsizei, GLsizei mod); - bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, Float32Array*, GLsizei mod); + bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, DOMFloat32Array*, GLsizei mod); bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, void*, GLsizei, GLsizei mod); // Helper function to validate the target for bufferData. @@ -883,7 +882,7 @@ protected: // Helper functions for vertexAttribNf{v}. void vertexAttribfImpl(const char* functionName, GLuint index, GLsizei expectedSize, GLfloat, GLfloat, GLfloat, GLfloat); - void vertexAttribfvImpl(const char* functionName, GLuint index, Float32Array*, GLsizei expectedSize); + void vertexAttribfvImpl(const char* functionName, GLuint index, DOMFloat32Array*, GLsizei expectedSize); void vertexAttribfvImpl(const char* functionName, GLuint index, GLfloat*, GLsizei, GLsizei expectedSize); // Helper functions to bufferData() and bufferSubData(). diff --git a/third_party/WebKit/Source/core/loader/BeaconLoader.cpp b/third_party/WebKit/Source/core/loader/BeaconLoader.cpp index 9a49fc3..7807f42 100644 --- a/third_party/WebKit/Source/core/loader/BeaconLoader.cpp +++ b/third_party/WebKit/Source/core/loader/BeaconLoader.cpp @@ -55,7 +55,7 @@ bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beac return true; } -bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beaconURL, PassRefPtr<ArrayBufferView>& data, int& payloadLength) +bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beaconURL, PassRefPtr<ArrayBufferView> data, int& payloadLength) { ASSERT(data); unsigned long long entitySize = data->byteLength(); diff --git a/third_party/WebKit/Source/core/loader/BeaconLoader.h b/third_party/WebKit/Source/core/loader/BeaconLoader.h index 6f75212..a955761 100644 --- a/third_party/WebKit/Source/core/loader/BeaconLoader.h +++ b/third_party/WebKit/Source/core/loader/BeaconLoader.h @@ -29,7 +29,7 @@ public: virtual ~BeaconLoader() { } static bool sendBeacon(LocalFrame*, int, const KURL&, const String&, int&); - static bool sendBeacon(LocalFrame*, int, const KURL&, PassRefPtr<WTF::ArrayBufferView>&, int&); + static bool sendBeacon(LocalFrame*, int, const KURL&, PassRefPtr<WTF::ArrayBufferView>, int&); static bool sendBeacon(LocalFrame*, int, const KURL&, Blob*, int&); static bool sendBeacon(LocalFrame*, int, const KURL&, PassRefPtrWillBeRawPtr<DOMFormData>&, int&); diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h b/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h index 775172e..60b8cdc 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h +++ b/third_party/WebKit/Source/core/streams/ReadableStreamImpl.h @@ -9,11 +9,9 @@ #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/ScriptValue.h" #include "bindings/core/v8/V8Binding.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/streams/ReadableStream.h" -#include "wtf/ArrayBuffer.h" #include "wtf/Deque.h" -#include "wtf/Forward.h" -#include "wtf/OwnPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" @@ -37,10 +35,10 @@ public: }; template<> -class ReadableStreamChunkTypeTraits<ArrayBuffer> { +class ReadableStreamChunkTypeTraits<DOMArrayBuffer> { public: - typedef RefPtr<ArrayBuffer> HoldType; - typedef PassRefPtr<ArrayBuffer> PassType; + typedef RefPtr<DOMArrayBuffer> HoldType; + typedef PassRefPtr<DOMArrayBuffer> PassType; static size_t size(const PassType& value) { return value->byteLength(); } static size_t size(const HoldType& value) { return value->byteLength(); } @@ -112,4 +110,3 @@ ScriptValue ReadableStreamImpl<ChunkTypeTraits>::read(ScriptState* scriptState, } // namespace blink #endif // ReadableStreamImpl_h - diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp index 0ef1c14..6986a86 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp @@ -9,6 +9,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/V8Binding.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/DOMException.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" @@ -653,9 +654,8 @@ TEST_F(ReadableStreamTest, CancelWhenReadable) TEST_F(ReadableStreamTest, ReadableArrayBufferCompileTest) { - // This test tests if ReadableStreamImpl<ArrayBuffer> can be instantiated. - new ReadableStreamImpl<ReadableStreamChunkTypeTraits<ArrayBuffer> >(scriptState()->executionContext(), m_underlyingSource); + // This test tests if ReadableStreamImpl<DOMArrayBuffer> can be instantiated. + new ReadableStreamImpl<ReadableStreamChunkTypeTraits<DOMArrayBuffer> >(scriptState()->executionContext(), m_underlyingSource); } } // namespace blink - diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 4d905bd..b98434a 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp @@ -42,6 +42,7 @@ #include "core/css/resolver/ViewportStyleResolver.h" #include "core/dom/ClientRect.h" #include "core/dom/ClientRectList.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/DOMPoint.h" #include "core/dom/DOMStringList.h" #include "core/dom/Document.h" @@ -1981,15 +1982,15 @@ String Internals::getCurrentCursorInfo(Document* document, ExceptionState& excep return result.toString(); } -PassRefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const +PassRefPtr<DOMArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const { String stringValue = value->toWireString(); RefPtr<ArrayBuffer> buffer = ArrayBuffer::createUninitialized(stringValue.length(), sizeof(UChar)); stringValue.copyTo(static_cast<UChar*>(buffer->data()), 0, stringValue.length()); - return buffer.release(); + return DOMArrayBuffer::create(buffer.release()); } -PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayBuffer> buffer) const +PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<DOMArrayBuffer> buffer) const { String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar)); return SerializedScriptValue::createFromWire(value); diff --git a/third_party/WebKit/Source/core/testing/Internals.h b/third_party/WebKit/Source/core/testing/Internals.h index 9d0eb1a..011665c 100644 --- a/third_party/WebKit/Source/core/testing/Internals.h +++ b/third_party/WebKit/Source/core/testing/Internals.h @@ -35,7 +35,6 @@ #include "core/dom/ContextLifecycleObserver.h" #include "core/page/scrolling/ScrollingCoordinator.h" #include "platform/heap/Handle.h" -#include "wtf/ArrayBuffer.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" @@ -45,9 +44,9 @@ namespace blink { class CanvasRenderingContext2D; class ClientRect; class ClientRectList; +class DOMArrayBuffer; class DOMPoint; class DOMStringList; -class LocalDOMWindow; class DictionaryTest; class Document; class DocumentFragment; @@ -63,6 +62,7 @@ class InternalRuntimeFlags; class InternalSettings; class Iterator; class LayerRectList; +class LocalDOMWindow; class LocalFrame; class Node; class Page; @@ -71,9 +71,9 @@ class PrivateScriptTest; class Range; class SerializedScriptValue; class ShadowRoot; +class TypeConversions; template <typename NodeType> class StaticNodeTypeList; typedef StaticNodeTypeList<Node> StaticNodeList; -class TypeConversions; class Internals final : public GarbageCollectedFinalized<Internals>, public ScriptWrappable, public ContextLifecycleObserver { DEFINE_WRAPPERTYPEINFO(); @@ -274,8 +274,8 @@ public: PassRefPtrWillBeRawPtr<ClientRectList> draggableRegions(Document*, ExceptionState&); PassRefPtrWillBeRawPtr<ClientRectList> nonDraggableRegions(Document*, ExceptionState&); - PassRefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const; - PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const; + PassRefPtr<DOMArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const; + PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<DOMArrayBuffer>) const; String getCurrentCursorInfo(Document*, ExceptionState&); diff --git a/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp index d82f6e0..4b99070 100644 --- a/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp @@ -26,6 +26,7 @@ #include "bindings/core/v8/ExceptionState.h" #include "core/FetchInitiatorTypeNames.h" #include "core/dom/ContextFeatures.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/DOMException.h" #include "core/dom/DOMImplementation.h" #include "core/dom/DocumentParser.h" @@ -339,7 +340,7 @@ Blob* XMLHttpRequest::responseBlob() return m_responseBlob.get(); } -ArrayBuffer* XMLHttpRequest::responseArrayBuffer() +DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() { ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); @@ -348,7 +349,7 @@ ArrayBuffer* XMLHttpRequest::responseArrayBuffer() if (!m_responseArrayBuffer) { if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { - m_responseArrayBuffer = m_binaryResponseBuilder->getAsArrayBuffer(); + m_responseArrayBuffer = DOMArrayBuffer::create(m_binaryResponseBuilder->getAsArrayBuffer()); if (!m_responseArrayBuffer) { // m_binaryResponseBuilder failed to allocate an ArrayBuffer. // We need to crash the renderer since there's no way defined in @@ -357,7 +358,7 @@ ArrayBuffer* XMLHttpRequest::responseArrayBuffer() } m_binaryResponseBuilder.clear(); } else { - m_responseArrayBuffer = ArrayBuffer::create(static_cast<void*>(0), 0); + m_responseArrayBuffer = DOMArrayBuffer::create(static_cast<void*>(0), 0); } } @@ -1568,10 +1569,10 @@ void XMLHttpRequest::didReceiveData(const char* data, unsigned len) m_responseLegacyStream->addData(data, len); } else if (m_responseTypeCode == ResponseTypeStream) { if (!m_responseStream) { - m_responseStream = new ReadableStreamImpl<ReadableStreamChunkTypeTraits<ArrayBuffer> >(executionContext(), new ReadableStreamSource(this)); + m_responseStream = new ReadableStreamImpl<ReadableStreamChunkTypeTraits<DOMArrayBuffer> >(executionContext(), new ReadableStreamSource(this)); m_responseStream->didSourceStart(); } - m_responseStream->enqueue(ArrayBuffer::create(data, len)); + m_responseStream->enqueue(DOMArrayBuffer::create(data, len)); } if (m_blobLoader) { diff --git a/third_party/WebKit/Source/core/xml/XMLHttpRequest.h b/third_party/WebKit/Source/core/xml/XMLHttpRequest.h index ac19d1d..973d17a 100644 --- a/third_party/WebKit/Source/core/xml/XMLHttpRequest.h +++ b/third_party/WebKit/Source/core/xml/XMLHttpRequest.h @@ -34,6 +34,7 @@ #include "platform/network/FormData.h" #include "platform/network/ResourceResponse.h" #include "platform/weborigin/SecurityOrigin.h" +#include "wtf/Forward.h" #include "wtf/OwnPtr.h" #include "wtf/text/AtomicStringHash.h" #include "wtf/text/StringBuilder.h" @@ -42,6 +43,7 @@ namespace blink { class Blob; class BlobDataHandle; +class DOMArrayBuffer; class DOMFormData; class Document; class DocumentParser; @@ -143,7 +145,7 @@ public: String responseURL(); // response attribute has custom getter. - ArrayBuffer* responseArrayBuffer(); + DOMArrayBuffer* responseArrayBuffer(); void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; } void setLastSendURL(const String& url) { m_lastSendURL = url; } @@ -255,7 +257,7 @@ private: unsigned long m_timeoutMilliseconds; PersistentWillBeMember<Blob> m_responseBlob; RefPtrWillBeMember<Stream> m_responseLegacyStream; - PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<ArrayBuffer> > > m_responseStream; + PersistentWillBeMember<ReadableStreamImpl<ReadableStreamChunkTypeTraits<DOMArrayBuffer> > > m_responseStream; PersistentWillBeMember<UnderlyingSource> m_streamSource; RefPtr<ThreadableLoader> m_loader; @@ -274,7 +276,7 @@ private: RefPtr<SharedBuffer> m_binaryResponseBuilder; long long m_lengthDownloadedToFile; - RefPtr<ArrayBuffer> m_responseArrayBuffer; + RefPtr<DOMArrayBuffer> m_responseArrayBuffer; // Used for onprogress tracking long long m_receivedLength; diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp index f08108c..aa2ff56 100644 --- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp +++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp @@ -6,6 +6,7 @@ #include "modules/beacon/NavigatorBeacon.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" #include "core/fileapi/Blob.h" @@ -15,7 +16,6 @@ #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/html/DOMFormData.h" #include "core/loader/BeaconLoader.h" -#include "wtf/ArrayBufferView.h" namespace blink { @@ -104,19 +104,19 @@ bool NavigatorBeacon::sendBeacon(ExecutionContext* context, const String& urlstr return beaconResult(context, result, bytes); } -bool NavigatorBeacon::sendBeacon(ExecutionContext* context, Navigator& navigator, const String& urlstring, PassRefPtr<ArrayBufferView> data, ExceptionState& exceptionState) +bool NavigatorBeacon::sendBeacon(ExecutionContext* context, Navigator& navigator, const String& urlstring, PassRefPtr<DOMArrayBufferView> data, ExceptionState& exceptionState) { return NavigatorBeacon::from(navigator).sendBeacon(context, urlstring, data, exceptionState); } -bool NavigatorBeacon::sendBeacon(ExecutionContext* context, const String& urlstring, PassRefPtr<ArrayBufferView> data, ExceptionState& exceptionState) +bool NavigatorBeacon::sendBeacon(ExecutionContext* context, const String& urlstring, PassRefPtr<DOMArrayBufferView> data, ExceptionState& exceptionState) { KURL url = context->completeURL(urlstring); if (!canSendBeacon(context, url, exceptionState)) return false; int bytes = 0; - bool result = BeaconLoader::sendBeacon(m_navigator.frame(), maxAllowance(), url, data, bytes); + bool result = BeaconLoader::sendBeacon(m_navigator.frame(), maxAllowance(), url, data->view(), bytes); return beaconResult(context, result, bytes); } diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h index a8aa5a4..c1ded40 100644 --- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h +++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h @@ -9,13 +9,10 @@ #include "platform/Supplementable.h" #include "platform/heap/Handle.h" -namespace WTF { -class ArrayBufferView; -} - namespace blink { class Blob; +class DOMArrayBufferView; class DOMFormData; class ExceptionState; class ExecutionContext; @@ -27,7 +24,7 @@ public: static NavigatorBeacon& from(Navigator&); static bool sendBeacon(ExecutionContext*, Navigator&, const String&, const String&, ExceptionState&); - static bool sendBeacon(ExecutionContext*, Navigator&, const String&, PassRefPtr<WTF::ArrayBufferView>, ExceptionState&); + static bool sendBeacon(ExecutionContext*, Navigator&, const String&, PassRefPtr<DOMArrayBufferView>, ExceptionState&); static bool sendBeacon(ExecutionContext*, Navigator&, const String&, Blob*, ExceptionState&); static bool sendBeacon(ExecutionContext*, Navigator&, const String&, PassRefPtrWillBeRawPtr<DOMFormData>, ExceptionState&); @@ -37,7 +34,7 @@ private: static const char* supplementName(); bool sendBeacon(ExecutionContext*, const String&, const String&, ExceptionState&); - bool sendBeacon(ExecutionContext*, const String&, PassRefPtr<WTF::ArrayBufferView>, ExceptionState&); + bool sendBeacon(ExecutionContext*, const String&, PassRefPtr<DOMArrayBufferView>, ExceptionState&); bool sendBeacon(ExecutionContext*, const String&, Blob*, ExceptionState&); bool sendBeacon(ExecutionContext*, const String&, PassRefPtrWillBeRawPtr<DOMFormData>, ExceptionState&); diff --git a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp index 6ebe4ee..54e06a6 100644 --- a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp +++ b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp @@ -35,6 +35,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" #include "core/dom/ContextLifecycleObserver.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/dom/DOMError.h" #include "core/dom/DOMException.h" #include "core/dom/ExecutionContext.h" @@ -43,7 +44,6 @@ #include "public/platform/Platform.h" #include "public/platform/WebArrayBuffer.h" #include "public/platform/WebCryptoAlgorithm.h" -#include "wtf/ArrayBufferView.h" namespace blink { @@ -117,7 +117,7 @@ void CryptoResultImpl::completeWithError(WebCryptoErrorType errorType, const Web void CryptoResultImpl::completeWithBuffer(const WebArrayBuffer& buffer) { if (m_resolver) - m_resolver->resolve(PassRefPtr<ArrayBuffer>(buffer)); + m_resolver->resolve(DOMArrayBuffer::create(buffer)); } void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) diff --git a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp index 8a75dde..a3cd0a1 100644 --- a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp +++ b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp @@ -32,12 +32,10 @@ #include "modules/crypto/NormalizeAlgorithm.h" #include "bindings/core/v8/Dictionary.h" +#include "core/dom/DOMTypedArray.h" #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebString.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/MathExtras.h" -#include "wtf/Uint8Array.h" #include "wtf/Vector.h" #include "wtf/text/StringBuilder.h" #include <algorithm> @@ -266,7 +264,7 @@ private: // typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData; // // FIXME: Currently only supports ArrayBufferView. -bool getOptionalCryptoOperationData(const Dictionary& raw, const char* propertyName, bool& hasProperty, RefPtr<ArrayBufferView>& buffer, const ErrorContext& context, AlgorithmError* error) +bool getOptionalCryptoOperationData(const Dictionary& raw, const char* propertyName, bool& hasProperty, RefPtr<DOMArrayBufferView>& buffer, const ErrorContext& context, AlgorithmError* error) { if (!DictionaryHelper::get(raw, propertyName, buffer)) { hasProperty = false; @@ -288,7 +286,7 @@ bool getOptionalCryptoOperationData(const Dictionary& raw, const char* propertyN // typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData; // // FIXME: Currently only supports ArrayBufferView. -bool getCryptoOperationData(const Dictionary& raw, const char* propertyName, RefPtr<ArrayBufferView>& buffer, const ErrorContext& context, AlgorithmError* error) +bool getCryptoOperationData(const Dictionary& raw, const char* propertyName, RefPtr<DOMArrayBufferView>& buffer, const ErrorContext& context, AlgorithmError* error) { bool hasProperty; bool ok = getOptionalCryptoOperationData(raw, propertyName, hasProperty, buffer, context, error); @@ -299,7 +297,7 @@ bool getCryptoOperationData(const Dictionary& raw, const char* propertyName, Ref return ok; } -bool getUint8Array(const Dictionary& raw, const char* propertyName, RefPtr<Uint8Array>& array, const ErrorContext& context, AlgorithmError* error) +bool getUint8Array(const Dictionary& raw, const char* propertyName, RefPtr<DOMUint8Array>& array, const ErrorContext& context, AlgorithmError* error) { if (!DictionaryHelper::get(raw, propertyName, array) || !array) { setSyntaxError(context.toString(propertyName, "Missing or not a Uint8Array"), error); @@ -311,14 +309,14 @@ bool getUint8Array(const Dictionary& raw, const char* propertyName, RefPtr<Uint8 // Defined by the WebCrypto spec as: // // typedef Uint8Array BigInteger; -bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<Uint8Array>& array, const ErrorContext& context, AlgorithmError* error) +bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<DOMUint8Array>& array, const ErrorContext& context, AlgorithmError* error) { if (!getUint8Array(raw, propertyName, array, context, error)) return false; if (!array->byteLength()) { // Empty BigIntegers represent 0 according to the spec - array = Uint8Array::create(1); + array = DOMUint8Array::create(1); } return true; @@ -407,7 +405,7 @@ bool getOptionalUint32(const Dictionary& raw, const char* propertyName, bool& ha // }; bool parseAesCbcParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { - RefPtr<ArrayBufferView> iv; + RefPtr<DOMArrayBufferView> iv; if (!getCryptoOperationData(raw, "iv", iv, context, error)) return false; @@ -519,7 +517,7 @@ bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithm if (!getUint32(raw, "modulusLength", modulusLength, context, error)) return false; - RefPtr<Uint8Array> publicExponent; + RefPtr<DOMUint8Array> publicExponent; if (!getBigInteger(raw, "publicExponent", publicExponent, context, error)) return false; @@ -539,7 +537,7 @@ bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithm // }; bool parseAesCtrParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { - RefPtr<ArrayBufferView> counter; + RefPtr<DOMArrayBufferView> counter; if (!getCryptoOperationData(raw, "counter", counter, context, error)) return false; @@ -560,12 +558,12 @@ bool parseAesCtrParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& // } bool parseAesGcmParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { - RefPtr<ArrayBufferView> iv; + RefPtr<DOMArrayBufferView> iv; if (!getCryptoOperationData(raw, "iv", iv, context, error)) return false; bool hasAdditionalData; - RefPtr<ArrayBufferView> additionalData; + RefPtr<DOMArrayBufferView> additionalData; if (!getOptionalCryptoOperationData(raw, "additionalData", hasAdditionalData, additionalData, context, error)) return false; @@ -592,7 +590,7 @@ bool parseAesGcmParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& bool parseRsaOaepParams(const Dictionary& raw, OwnPtr<WebCryptoAlgorithmParams>& params, const ErrorContext& context, AlgorithmError* error) { bool hasLabel; - RefPtr<ArrayBufferView> label; + RefPtr<DOMArrayBufferView> label; if (!getOptionalCryptoOperationData(raw, "label", hasLabel, label, context, error)) return false; diff --git a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp index 7df30b0..af83279 100644 --- a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp +++ b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp @@ -193,27 +193,27 @@ SubtleCrypto::SubtleCrypto() { } -ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const ArrayPiece& data) +ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data) { return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperationEncrypt, ArrayPiece(), data); } -ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const ArrayPiece& data) +ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data) { return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperationDecrypt, ArrayPiece(), data); } -ScriptPromise SubtleCrypto::sign(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const ArrayPiece& data) +ScriptPromise SubtleCrypto::sign(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data) { return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperationSign, ArrayPiece(), data); } -ScriptPromise SubtleCrypto::verifySignature(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const ArrayPiece& signature, const ArrayPiece& data) +ScriptPromise SubtleCrypto::verifySignature(ScriptState* scriptState, const Dictionary& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& signature, const DOMArrayPiece& data) { return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperationVerify, signature, data); } -ScriptPromise SubtleCrypto::digest(ScriptState* scriptState, const Dictionary& rawAlgorithm, const ArrayPiece& data) +ScriptPromise SubtleCrypto::digest(ScriptState* scriptState, const Dictionary& rawAlgorithm, const DOMArrayPiece& data) { return startCryptoOperation(scriptState, rawAlgorithm, 0, WebCryptoOperationDigest, ArrayPiece(), data); } @@ -238,7 +238,7 @@ ScriptPromise SubtleCrypto::generateKey(ScriptState* scriptState, const Dictiona return promise; } -ScriptPromise SubtleCrypto::importKey(ScriptState* scriptState, const String& rawFormat, const ArrayPiece& keyData, const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages) +ScriptPromise SubtleCrypto::importKey(ScriptState* scriptState, const String& rawFormat, const DOMArrayPiece& keyData, const Dictionary& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages) { RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); @@ -361,7 +361,7 @@ ScriptPromise SubtleCrypto::wrapKey(ScriptState* scriptState, const String& rawF return promise; } -ScriptPromise SubtleCrypto::unwrapKey(ScriptState* scriptState, const String& rawFormat, const ArrayPiece& wrappedKey, CryptoKey* unwrappingKey, const Dictionary& rawUnwrapAlgorithm, const Dictionary& rawUnwrappedKeyAlgorithm, bool extractable, const Vector<String>& rawKeyUsages) +ScriptPromise SubtleCrypto::unwrapKey(ScriptState* scriptState, const String& rawFormat, const DOMArrayPiece& wrappedKey, CryptoKey* unwrappingKey, const Dictionary& rawUnwrapAlgorithm, const Dictionary& rawUnwrappedKeyAlgorithm, bool extractable, const Vector<String>& rawKeyUsages) { RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState); ScriptPromise promise = result->promise(); diff --git a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.h b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.h index 44e5bbe..9dfeb7f 100644 --- a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.h +++ b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.h @@ -33,8 +33,8 @@ #include "bindings/core/v8/ScriptPromise.h" #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMArrayPiece.h" #include "platform/heap/Handle.h" -#include "wtf/ArrayPiece.h" #include "wtf/Forward.h" namespace blink { @@ -50,20 +50,20 @@ public: return new SubtleCrypto(); } - ScriptPromise encrypt(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&); - ScriptPromise decrypt(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&); - ScriptPromise sign(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&); + ScriptPromise encrypt(ScriptState*, const Dictionary&, CryptoKey*, const DOMArrayPiece&); + ScriptPromise decrypt(ScriptState*, const Dictionary&, CryptoKey*, const DOMArrayPiece&); + ScriptPromise sign(ScriptState*, const Dictionary&, CryptoKey*, const DOMArrayPiece&); // Note that this is not named "verify" because when compiling on Mac that expands to a macro and breaks. - ScriptPromise verifySignature(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece& signature, const ArrayPiece& data); - ScriptPromise digest(ScriptState*, const Dictionary&, const ArrayPiece& data); + ScriptPromise verifySignature(ScriptState*, const Dictionary&, CryptoKey*, const DOMArrayPiece& signature, const DOMArrayPiece& data); + ScriptPromise digest(ScriptState*, const Dictionary&, const DOMArrayPiece& data); ScriptPromise generateKey(ScriptState*, const Dictionary&, bool extractable, const Vector<String>& keyUsages); - ScriptPromise importKey(ScriptState*, const String&, const ArrayPiece&, const Dictionary&, bool extractable, const Vector<String>& keyUsages); + ScriptPromise importKey(ScriptState*, const String&, const DOMArrayPiece&, const Dictionary&, bool extractable, const Vector<String>& keyUsages); ScriptPromise importKey(ScriptState*, const String&, const Dictionary&, const Dictionary&, bool extractable, const Vector<String>& keyUsages); ScriptPromise exportKey(ScriptState*, const String&, CryptoKey*); ScriptPromise wrapKey(ScriptState*, const String&, CryptoKey*, CryptoKey*, const Dictionary&); - ScriptPromise unwrapKey(ScriptState*, const String&, const ArrayPiece&, CryptoKey*, const Dictionary&, const Dictionary&, bool, const Vector<String>&); + ScriptPromise unwrapKey(ScriptState*, const String&, const DOMArrayPiece&, CryptoKey*, const Dictionary&, const Dictionary&, bool, const Vector<String>&); void trace(Visitor*) { } diff --git a/third_party/WebKit/Source/modules/encoding/TextDecoder.cpp b/third_party/WebKit/Source/modules/encoding/TextDecoder.cpp index 6dd5c2b..a28474e 100644 --- a/third_party/WebKit/Source/modules/encoding/TextDecoder.cpp +++ b/third_party/WebKit/Source/modules/encoding/TextDecoder.cpp @@ -29,10 +29,10 @@ */ #include "config.h" - #include "modules/encoding/TextDecoder.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/ExceptionCode.h" #include "wtf/StringExtras.h" #include "wtf/text/TextEncodingRegistry.h" @@ -76,7 +76,7 @@ String TextDecoder::encoding() const return name; } -String TextDecoder::decode(ArrayBufferView* input, const TextDecodeOptions& options, ExceptionState& exceptionState) +String TextDecoder::decode(DOMArrayBufferView* input, const TextDecodeOptions& options, ExceptionState& exceptionState) { const char* start = input ? static_cast<const char*>(input->baseAddress()) : 0; size_t length = input ? input->byteLength() : 0; diff --git a/third_party/WebKit/Source/modules/encoding/TextDecoder.h b/third_party/WebKit/Source/modules/encoding/TextDecoder.h index 755146a..4933fc5 100644 --- a/third_party/WebKit/Source/modules/encoding/TextDecoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextDecoder.h @@ -35,13 +35,13 @@ #include "modules/encoding/TextDecodeOptions.h" #include "modules/encoding/TextDecoderOptions.h" #include "platform/heap/Handle.h" -#include "wtf/ArrayBufferView.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" namespace blink { +class DOMArrayBufferView; class ExceptionState; class TextDecoder final : public GarbageCollectedFinalized<TextDecoder>, public ScriptWrappable { @@ -54,7 +54,7 @@ public: String encoding() const; bool fatal() const { return m_fatal; } bool ignoreBOM() const { return m_ignoreBOM; } - String decode(ArrayBufferView*, const TextDecodeOptions&, ExceptionState&); + String decode(DOMArrayBufferView*, const TextDecodeOptions&, ExceptionState&); String decode(ExceptionState&); void trace(Visitor*) { } diff --git a/third_party/WebKit/Source/modules/encoding/TextEncoder.cpp b/third_party/WebKit/Source/modules/encoding/TextEncoder.cpp index a9e15e8..d2a241f 100644 --- a/third_party/WebKit/Source/modules/encoding/TextEncoder.cpp +++ b/third_party/WebKit/Source/modules/encoding/TextEncoder.cpp @@ -72,7 +72,7 @@ String TextEncoder::encoding() const return name; } -PassRefPtr<Uint8Array> TextEncoder::encode(const String& input) +PassRefPtr<DOMUint8Array> TextEncoder::encode(const String& input) { CString result; if (input.is8Bit()) @@ -83,7 +83,7 @@ PassRefPtr<Uint8Array> TextEncoder::encode(const String& input) const char* buffer = result.data(); const unsigned char* unsignedBuffer = reinterpret_cast<const unsigned char*>(buffer); - return Uint8Array::create(unsignedBuffer, result.length()); + return DOMUint8Array::create(unsignedBuffer, result.length()); } } // namespace blink diff --git a/third_party/WebKit/Source/modules/encoding/TextEncoder.h b/third_party/WebKit/Source/modules/encoding/TextEncoder.h index 722e286..a023c75 100644 --- a/third_party/WebKit/Source/modules/encoding/TextEncoder.h +++ b/third_party/WebKit/Source/modules/encoding/TextEncoder.h @@ -32,9 +32,8 @@ #define TextEncoder_h #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMTypedArray.h" #include "platform/heap/Handle.h" -#include "wtf/ArrayBufferView.h" -#include "wtf/Uint8Array.h" #include "wtf/text/TextCodec.h" #include "wtf/text/TextEncoding.h" #include "wtf/text/WTFString.h" @@ -51,7 +50,7 @@ public: // Implement the IDL String encoding() const; - PassRefPtr<Uint8Array> encode(const String&); + PassRefPtr<DOMUint8Array> encode(const String&); void trace(Visitor*) { } diff --git a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp index 91b33a2..eea6c5f 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp @@ -10,6 +10,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" #include "core/dom/DOMException.h" +#include "core/dom/DOMTypedArray.h" #include "core/dom/ExceptionCode.h" #include "core/html/HTMLMediaElement.h" #include "core/html/MediaKeyError.h" @@ -22,7 +23,6 @@ #include "platform/RuntimeEnabledFeatures.h" #include "wtf/ArrayBuffer.h" #include "wtf/Functional.h" -#include "wtf/Uint8Array.h" namespace blink { @@ -292,7 +292,7 @@ static PassRefPtrWillBeRawPtr<Event> createEncryptedEvent(const String& initData { MediaEncryptedEventInit initializer; initializer.initDataType = initDataType; - initializer.initData = ArrayBuffer::create(initData, initDataLength); + initializer.initData = DOMArrayBuffer::create(initData, initDataLength); initializer.bubbles = false; initializer.cancelable = false; @@ -305,19 +305,19 @@ static PassRefPtrWillBeRawPtr<Event> createWebkitNeedKeyEvent(const unsigned cha MediaKeyEventInit webkitInitializer; webkitInitializer.keySystem = String(); webkitInitializer.sessionId = String(); - webkitInitializer.initData = Uint8Array::create(initData, initDataLength); + webkitInitializer.initData = DOMUint8Array::create(initData, initDataLength); webkitInitializer.bubbles = false; webkitInitializer.cancelable = false; return MediaKeyEvent::create(EventTypeNames::webkitneedkey, webkitInitializer); } -void HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest(HTMLMediaElement& element, const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState& exceptionState) +void HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest(HTMLMediaElement& element, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionState& exceptionState) { HTMLMediaElementEncryptedMedia::from(element).generateKeyRequest(element.webMediaPlayer(), keySystem, initData, exceptionState); } -void HTMLMediaElementEncryptedMedia::generateKeyRequest(WebMediaPlayer* webMediaPlayer, const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState& exceptionState) +void HTMLMediaElementEncryptedMedia::generateKeyRequest(WebMediaPlayer* webMediaPlayer, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionState& exceptionState) { WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest"); @@ -349,15 +349,15 @@ void HTMLMediaElementEncryptedMedia::generateKeyRequest(WebMediaPlayer* webMedia void HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest(HTMLMediaElement& mediaElement, const String& keySystem, ExceptionState& exceptionState) { - webkitGenerateKeyRequest(mediaElement, keySystem, Uint8Array::create(0), exceptionState); + webkitGenerateKeyRequest(mediaElement, keySystem, DOMUint8Array::create(0), exceptionState); } -void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& element, const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState& exceptionState) +void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& element, const String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionState& exceptionState) { HTMLMediaElementEncryptedMedia::from(element).addKey(element.webMediaPlayer(), keySystem, key, initData, sessionId, exceptionState); } -void HTMLMediaElementEncryptedMedia::addKey(WebMediaPlayer* webMediaPlayer, const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState& exceptionState) +void HTMLMediaElementEncryptedMedia::addKey(WebMediaPlayer* webMediaPlayer, const String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionState& exceptionState) { WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::webkitAddKey"); @@ -397,9 +397,9 @@ void HTMLMediaElementEncryptedMedia::addKey(WebMediaPlayer* webMediaPlayer, cons throwExceptionIfMediaKeyExceptionOccurred(keySystem, sessionId, result, exceptionState); } -void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& mediaElement, const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionState& exceptionState) +void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& mediaElement, const String& keySystem, PassRefPtr<DOMUint8Array> key, ExceptionState& exceptionState) { - webkitAddKey(mediaElement, keySystem, key, Uint8Array::create(0), String(), exceptionState); + webkitAddKey(mediaElement, keySystem, key, DOMUint8Array::create(0), String(), exceptionState); } void HTMLMediaElementEncryptedMedia::webkitCancelKeyRequest(HTMLMediaElement& element, const String& keySystem, const String& sessionId, ExceptionState& exceptionState) @@ -491,7 +491,7 @@ void HTMLMediaElementEncryptedMedia::keyMessage(HTMLMediaElement& element, const MediaKeyEventInit initializer; initializer.keySystem = keySystem; initializer.sessionId = sessionId; - initializer.message = Uint8Array::create(message, messageLength); + initializer.message = DOMUint8Array::create(message, messageLength); initializer.defaultURL = KURL(defaultURL); initializer.bubbles = false; initializer.cancelable = false; diff --git a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h index e1d49d3..cbcbcc2 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h @@ -5,12 +5,13 @@ #ifndef HTMLMediaElementEncryptedMedia_h #define HTMLMediaElementEncryptedMedia_h -#include "modules/EventTargetModules.h" +#include "core/EventTypeNames.h" +#include "core/dom/DOMTypedArray.h" +#include "core/events/EventTarget.h" #include "platform/Supplementable.h" #include "platform/graphics/media/MediaPlayer.h" #include "platform/heap/Handle.h" #include "public/platform/WebMediaPlayerClient.h" -#include "wtf/Forward.h" namespace blink { @@ -25,10 +26,10 @@ class HTMLMediaElementEncryptedMedia final : public NoBaseWillBeGarbageCollected DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLMediaElementEncryptedMedia); public: // encrypted media extensions (v0.1b) - static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState&); + static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionState&); static void webkitGenerateKeyRequest(HTMLMediaElement&, const String& keySystem, ExceptionState&); - static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&); - static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionState&); + static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionState&); + static void webkitAddKey(HTMLMediaElement&, const String& keySystem, PassRefPtr<DOMUint8Array> key, ExceptionState&); static void webkitCancelKeyRequest(HTMLMediaElement&, const String& keySystem, const String& sessionId, ExceptionState&); DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); @@ -57,8 +58,8 @@ private: friend class SetMediaKeysHandler; HTMLMediaElementEncryptedMedia(); - void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState&); - void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&); + void generateKeyRequest(WebMediaPlayer*, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionState&); + void addKey(WebMediaPlayer*, const String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> initData, const String& sessionId, ExceptionState&); void cancelKeyRequest(WebMediaPlayer*, const String& keySystem, const String& sessionId, ExceptionState&); // EventTarget diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaEncryptedEvent.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaEncryptedEvent.h index 719199d..be02663 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaEncryptedEvent.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaEncryptedEvent.h @@ -26,6 +26,7 @@ #ifndef MediaEncryptedEvent_h #define MediaEncryptedEvent_h +#include "core/dom/DOMTypedArray.h" #include "modules/EventModules.h" #include "wtf/ArrayBuffer.h" @@ -35,7 +36,7 @@ struct MediaEncryptedEventInit : public EventInit { MediaEncryptedEventInit(); String initDataType; - RefPtr<ArrayBuffer> initData; + RefPtr<DOMArrayBuffer> initData; }; class MediaEncryptedEvent final : public Event { @@ -56,7 +57,7 @@ public: virtual const AtomicString& interfaceName() const override; String initDataType() const { return m_initDataType; } - ArrayBuffer* initData() const { return m_initData.get(); } + DOMArrayBuffer* initData() const { return m_initData.get(); } virtual void trace(Visitor*) override; @@ -65,7 +66,7 @@ private: MediaEncryptedEvent(const AtomicString& type, const MediaEncryptedEventInit& initializer); String m_initDataType; - RefPtr<ArrayBuffer> m_initData; + RefPtr<DOMArrayBuffer> m_initData; }; } // namespace blink diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.cpp index 1a353dd..0b4283f 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "modules/encryptedmedia/MediaKeyMessageEvent.h" +#include "core/dom/DOMArrayBuffer.h" + namespace blink { MediaKeyMessageEventInit::MediaKeyMessageEventInit() diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.h index f57fb11..73a6f69 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEvent.h @@ -29,14 +29,15 @@ #include "core/html/MediaKeyError.h" #include "modules/EventModules.h" -#include "wtf/ArrayBuffer.h" namespace blink { +class DOMArrayBuffer; + struct MediaKeyMessageEventInit : public EventInit { MediaKeyMessageEventInit(); - RefPtr<ArrayBuffer> message; + RefPtr<DOMArrayBuffer> message; String destinationURL; }; @@ -57,7 +58,7 @@ public: virtual const AtomicString& interfaceName() const override; - ArrayBuffer* message() const { return m_message.get(); } + DOMArrayBuffer* message() const { return m_message.get(); } String destinationURL() const { return m_destinationURL; } virtual void trace(Visitor*) override; @@ -66,7 +67,7 @@ private: MediaKeyMessageEvent(); MediaKeyMessageEvent(const AtomicString& type, const MediaKeyMessageEventInit& initializer); - RefPtr<ArrayBuffer> m_message; + RefPtr<DOMArrayBuffer> m_message; String m_destinationURL; }; diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp index 0cb3016..9196073 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp @@ -30,6 +30,8 @@ #include "bindings/core/v8/ScriptPromise.h" #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/ExceptionCode.h" #include "core/events/Event.h" #include "core/events/GenericEventQueue.h" @@ -48,8 +50,6 @@ #include "public/platform/WebString.h" #include "public/platform/WebURL.h" #include "wtf/ASCIICType.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include <cmath> #include <limits> @@ -417,13 +417,13 @@ ScriptPromise MediaKeySession::closed(ScriptState* scriptState) return m_closedPromise->promise(scriptState->world()); } -ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const String& initDataType, ArrayBuffer* initData) +ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const String& initDataType, DOMArrayBuffer* initData) { RefPtr<ArrayBuffer> initDataCopy = ArrayBuffer::create(initData->data(), initData->byteLength()); return generateRequestInternal(scriptState, initDataType, initDataCopy.release()); } -ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const String& initDataType, ArrayBufferView* initData) +ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const String& initDataType, DOMArrayBufferView* initData) { RefPtr<ArrayBuffer> initDataCopy = ArrayBuffer::create(initData->baseAddress(), initData->byteLength()); return generateRequestInternal(scriptState, initDataType, initDataCopy.release()); @@ -549,13 +549,13 @@ ScriptPromise MediaKeySession::load(ScriptState* scriptState, const String& sess return promise; } -ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBuffer* response) +ScriptPromise MediaKeySession::update(ScriptState* scriptState, DOMArrayBuffer* response) { RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->data(), response->byteLength()); return updateInternal(scriptState, responseCopy.release()); } -ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBufferView* response) +ScriptPromise MediaKeySession::update(ScriptState* scriptState, DOMArrayBufferView* response) { RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->baseAddress(), response->byteLength()); return updateInternal(scriptState, responseCopy.release()); @@ -878,7 +878,7 @@ void MediaKeySession::message(const unsigned char* message, size_t messageLength MediaKeyMessageEventInit init; init.bubbles = false; init.cancelable = false; - init.message = ArrayBuffer::create(static_cast<const void*>(message), messageLength); + init.message = DOMArrayBuffer::create(static_cast<const void*>(message), messageLength); init.destinationURL = destinationURL.string(); RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::create(EventTypeNames::message, init); diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h index 56abd8d..2eccbcc 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.h @@ -33,12 +33,11 @@ #include "platform/Timer.h" #include "platform/heap/Handle.h" #include "public/platform/WebContentDecryptionModuleSession.h" -#include "wtf/Forward.h" namespace blink { -class ScriptPromise; -class ScriptState; +class DOMArrayBuffer; +class DOMArrayBufferView; class GenericEventQueue; class MediaKeyError; class MediaKeys; @@ -73,15 +72,15 @@ public: double expiration() const { return m_expiration; } ScriptPromise closed(ScriptState*); - ScriptPromise generateRequest(ScriptState*, const String& initDataType, ArrayBuffer* initData); - ScriptPromise generateRequest(ScriptState*, const String& initDataType, ArrayBufferView* initData); + ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMArrayBuffer* initData); + ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMArrayBufferView* initData); ScriptPromise load(ScriptState*, const String& sessionId); void setError(MediaKeyError*); MediaKeyError* error() { return m_error.get(); } - ScriptPromise update(ScriptState*, ArrayBuffer* response); - ScriptPromise update(ScriptState*, ArrayBufferView* response); + ScriptPromise update(ScriptState*, DOMArrayBuffer* response); + ScriptPromise update(ScriptState*, DOMArrayBufferView* response); ScriptPromise close(ScriptState*); ScriptPromise remove(ScriptState*); diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp index 0561cc9..1a077475 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp @@ -28,6 +28,8 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/DOMException.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" @@ -43,8 +45,6 @@ #include "platform/UUID.h" #include "public/platform/Platform.h" #include "public/platform/WebContentDecryptionModule.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/RefPtr.h" namespace blink { @@ -242,13 +242,13 @@ MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, const String return MediaKeySession::create(scriptState, this, sessionType); } -ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuffer* serverCertificate) +ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArrayBuffer* serverCertificate) { RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertificate->data(), serverCertificate->byteLength()); return setServerCertificateInternal(scriptState, serverCertificateCopy.release()); } -ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBufferView* serverCertificate) +ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArrayBufferView* serverCertificate) { RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertificate->baseAddress(), serverCertificate->byteLength()); return setServerCertificateInternal(scriptState, serverCertificateCopy.release()); diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h index f6dd4d0..b44dd74 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h @@ -35,6 +35,8 @@ namespace blink { +class DOMArrayBuffer; +class DOMArrayBufferView; class ExecutionContext; class MediaKeySession; class ScriptState; @@ -52,8 +54,8 @@ public: MediaKeySession* createSession(ScriptState*, const String& sessionType); - ScriptPromise setServerCertificate(ScriptState*, ArrayBuffer* serverCertificate); - ScriptPromise setServerCertificate(ScriptState*, ArrayBufferView* serverCertificate); + ScriptPromise setServerCertificate(ScriptState*, DOMArrayBuffer* serverCertificate); + ScriptPromise setServerCertificate(ScriptState*, DOMArrayBufferView* serverCertificate); static bool isTypeSupported(const String& keySystem, const String& contentType); diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index cb8489b..ec9727e 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp @@ -33,6 +33,8 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" #include "core/events/Event.h" @@ -44,8 +46,6 @@ #include "platform/Logging.h" #include "platform/TraceEvent.h" #include "public/platform/WebSourceBuffer.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/MathExtras.h" #include <limits> @@ -265,14 +265,14 @@ void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& exceptionState m_appendWindowEnd = end; } -void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& exceptionState) +void SourceBuffer::appendBuffer(PassRefPtr<DOMArrayBuffer> data, ExceptionState& exceptionState) { // Section 3.2 appendBuffer() // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data appendBufferInternal(static_cast<const unsigned char*>(data->data()), data->byteLength(), exceptionState); } -void SourceBuffer::appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState& exceptionState) +void SourceBuffer::appendBuffer(PassRefPtr<DOMArrayBufferView> data, ExceptionState& exceptionState) { // Section 3.2 appendBuffer() // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h index 79804a0..5f7ffd4 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.h @@ -37,12 +37,13 @@ #include "platform/AsyncMethodRunner.h" #include "platform/weborigin/KURL.h" #include "public/platform/WebSourceBufferClient.h" -#include "wtf/Forward.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" namespace blink { +class DOMArrayBuffer; +class DOMArrayBufferView; class ExceptionState; class FileReaderLoader; class GenericEventQueue; @@ -69,8 +70,8 @@ public: PassRefPtrWillBeRawPtr<TimeRanges> buffered(ExceptionState&) const; double timestampOffset() const; void setTimestampOffset(double, ExceptionState&); - void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState&); - void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState&); + void appendBuffer(PassRefPtr<DOMArrayBuffer> data, ExceptionState&); + void appendBuffer(PassRefPtr<DOMArrayBufferView> data, ExceptionState&); void appendStream(PassRefPtrWillBeRawPtr<Stream>, ExceptionState&); void appendStream(PassRefPtrWillBeRawPtr<Stream>, unsigned long long maxSize, ExceptionState&); void abort(ExceptionState&); diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp index 77a38d8..8a5c4f32 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.cpp @@ -26,14 +26,14 @@ #include "modules/mediastream/RTCDataChannel.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" #include "core/events/MessageEvent.h" #include "core/fileapi/Blob.h" #include "modules/mediastream/RTCPeerConnection.h" #include "public/platform/WebRTCPeerConnectionHandler.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" namespace blink { @@ -185,14 +185,14 @@ void RTCDataChannel::send(const String& data, ExceptionState& exceptionState) } } -void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionState& exceptionState) +void RTCDataChannel::send(PassRefPtr<DOMArrayBuffer> prpData, ExceptionState& exceptionState) { if (m_readyState != ReadyStateOpen) { throwNotOpenException(exceptionState); return; } - RefPtr<ArrayBuffer> data = prpData; + RefPtr<DOMArrayBuffer> data = prpData; size_t dataLength = data->byteLength(); if (!dataLength) @@ -204,7 +204,7 @@ void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionState& excep } } -void RTCDataChannel::send(PassRefPtr<ArrayBufferView> data, ExceptionState& exceptionState) +void RTCDataChannel::send(PassRefPtr<DOMArrayBufferView> data, ExceptionState& exceptionState) { if (!m_handler->sendRawData(static_cast<const char*>(data->baseAddress()), data->byteLength())) { // FIXME: This should not throw an exception but instead forcefully close the data channel. @@ -263,7 +263,7 @@ void RTCDataChannel::didReceiveRawData(const char* data, size_t dataLength) return; } if (m_binaryType == BinaryTypeArrayBuffer) { - RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(data, dataLength); + RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, dataLength); scheduleDispatchEvent(MessageEvent::create(buffer.release())); return; } diff --git a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h index 4dccf80..37004db 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h +++ b/third_party/WebKit/Source/modules/mediastream/RTCDataChannel.h @@ -34,6 +34,8 @@ namespace blink { class Blob; +class DOMArrayBuffer; +class DOMArrayBufferView; class ExceptionState; class RTCPeerConnection; class WebRTCDataChannelHandler; @@ -70,8 +72,8 @@ public: void setBinaryType(const String&, ExceptionState&); void send(const String&, ExceptionState&); - void send(PassRefPtr<ArrayBuffer>, ExceptionState&); - void send(PassRefPtr<ArrayBufferView>, ExceptionState&); + void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); + void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); void send(Blob*, ExceptionState&); void close(); diff --git a/third_party/WebKit/Source/modules/serviceworkers/Body.cpp b/third_party/WebKit/Source/modules/serviceworkers/Body.cpp index dd885be..82c0597 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/Body.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/Body.cpp @@ -8,6 +8,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/V8ThrowException.h" +#include "core/dom/DOMArrayBuffer.h" #include "core/fileapi/Blob.h" #include "core/fileapi/FileReaderLoader.h" #include "core/fileapi/FileReaderLoaderClient.h" @@ -166,7 +167,7 @@ void Body::didFinishLoading() switch (m_responseType) { case ResponseAsArrayBuffer: - m_resolver->resolve(m_loader->arrayBufferResult()); + m_resolver->resolve(DOMArrayBuffer::create(m_loader->arrayBufferResult())); break; case ResponseAsBlob: { ASSERT(blobDataHandle()->size() == kuint64max); diff --git a/third_party/WebKit/Source/modules/serviceworkers/RequestInit.cpp b/third_party/WebKit/Source/modules/serviceworkers/RequestInit.cpp index 6a0d9fe..9a952b7 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/RequestInit.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/RequestInit.cpp @@ -6,11 +6,11 @@ #include "RequestInit.h" #include "bindings/core/v8/Dictionary.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Blob.h" #include "bindings/core/v8/V8FormData.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" #include "core/fileapi/Blob.h" #include "modules/serviceworkers/Headers.h" #include "platform/blob/BlobData.h" @@ -39,13 +39,13 @@ RequestInit::RequestInit(ExecutionContext* context, const Dictionary& options, E OwnPtr<BlobData> blobData = BlobData::create(); v8::Isolate* isolate = toIsolate(context); if (body->IsArrayBuffer()) { - ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(body)); + DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>::Cast(body)); ASSERT(arrayBuffer); - blobData->appendArrayBuffer(arrayBuffer); + blobData->appendArrayBuffer(arrayBuffer->buffer()); } else if (body->IsArrayBufferView()) { - ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Handle<v8::Object>::Cast(body)); + DOMArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Handle<v8::Object>::Cast(body)); ASSERT(arrayBufferView); - blobData->appendArrayBufferView(arrayBufferView); + blobData->appendArrayBufferView(arrayBufferView->view()); } else if (V8Blob::hasInstance(body, isolate)) { Blob* blob = V8Blob::toImpl(v8::Handle<v8::Object>::Cast(body)); ASSERT(blob); diff --git a/third_party/WebKit/Source/modules/serviceworkers/Response.cpp b/third_party/WebKit/Source/modules/serviceworkers/Response.cpp index 2f40281..7ea930c 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/Response.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/Response.cpp @@ -7,11 +7,11 @@ #include "bindings/core/v8/Dictionary.h" #include "bindings/core/v8/ExceptionState.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/fileapi/Blob.h" #include "modules/serviceworkers/ResponseInit.h" #include "public/platform/WebServiceWorkerResponse.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/RefPtr.h" namespace blink { @@ -75,19 +75,19 @@ Response* Response::create(ExecutionContext* context, const String& body, const return create(context, blob, ResponseInit(responseInit, exceptionState), exceptionState); } -Response* Response::create(ExecutionContext* context, const ArrayBuffer* body, const Dictionary& responseInit, ExceptionState& exceptionState) +Response* Response::create(ExecutionContext* context, const DOMArrayBuffer* body, const Dictionary& responseInit, ExceptionState& exceptionState) { OwnPtr<BlobData> blobData = BlobData::create(); - blobData->appendArrayBuffer(body); + blobData->appendArrayBuffer(body->buffer()); const long long length = blobData->length(); Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), length)); return create(context, blob, ResponseInit(responseInit, exceptionState), exceptionState); } -Response* Response::create(ExecutionContext* context, const ArrayBufferView* body, const Dictionary& responseInit, ExceptionState& exceptionState) +Response* Response::create(ExecutionContext* context, const DOMArrayBufferView* body, const Dictionary& responseInit, ExceptionState& exceptionState) { OwnPtr<BlobData> blobData = BlobData::create(); - blobData->appendArrayBufferView(body); + blobData->appendArrayBufferView(body->view()); const long long length = blobData->length(); Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), length)); return create(context, blob, ResponseInit(responseInit, exceptionState), exceptionState); diff --git a/third_party/WebKit/Source/modules/serviceworkers/Response.h b/third_party/WebKit/Source/modules/serviceworkers/Response.h index c5d0bd2..65d89ba 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/Response.h +++ b/third_party/WebKit/Source/modules/serviceworkers/Response.h @@ -12,11 +12,12 @@ #include "modules/serviceworkers/Headers.h" #include "platform/blob/BlobData.h" #include "platform/heap/Handle.h" -#include "wtf/Forward.h" namespace blink { class Blob; +class DOMArrayBuffer; +class DOMArrayBufferView; class ExceptionState; class ResponseInit; class WebServiceWorkerResponse; @@ -27,8 +28,8 @@ public: virtual ~Response() { } static Response* create(ExecutionContext*, Blob*, const Dictionary&, ExceptionState&); static Response* create(ExecutionContext*, const String&, const Dictionary&, ExceptionState&); - static Response* create(ExecutionContext*, const ArrayBuffer*, const Dictionary&, ExceptionState&); - static Response* create(ExecutionContext*, const ArrayBufferView*, const Dictionary&, ExceptionState&); + static Response* create(ExecutionContext*, const DOMArrayBuffer*, const Dictionary&, ExceptionState&); + static Response* create(ExecutionContext*, const DOMArrayBufferView*, const Dictionary&, ExceptionState&); static Response* create(ExecutionContext*, Blob*, const ResponseInit&, ExceptionState&); static Response* create(ExecutionContext*, FetchResponseData*); static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); diff --git a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h index e80e06f..0a4d65b 100644 --- a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h +++ b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.h @@ -25,9 +25,9 @@ #ifndef AnalyserNode_h #define AnalyserNode_h +#include "core/dom/DOMTypedArray.h" #include "modules/webaudio/AudioBasicInspectorNode.h" #include "modules/webaudio/RealtimeAnalyser.h" -#include "wtf/Forward.h" namespace blink { @@ -62,10 +62,10 @@ public: void setSmoothingTimeConstant(double k, ExceptionState&); double smoothingTimeConstant() const { return m_analyser.smoothingTimeConstant(); } - void getFloatFrequencyData(Float32Array* array) { m_analyser.getFloatFrequencyData(array); } - void getByteFrequencyData(Uint8Array* array) { m_analyser.getByteFrequencyData(array); } - void getFloatTimeDomainData(Float32Array* array) { m_analyser.getFloatTimeDomainData(array); } - void getByteTimeDomainData(Uint8Array* array) { m_analyser.getByteTimeDomainData(array); } + void getFloatFrequencyData(DOMFloat32Array* array) { m_analyser.getFloatFrequencyData(array->view()); } + void getByteFrequencyData(DOMUint8Array* array) { m_analyser.getByteFrequencyData(array->view()); } + void getFloatTimeDomainData(DOMFloat32Array* array) { m_analyser.getFloatTimeDomainData(array->view()); } + void getByteTimeDomainData(DOMUint8Array* array) { m_analyser.getByteTimeDomainData(array->view()); } private: virtual double tailTime() const override { return 0; } virtual double latencyTime() const override { return 0; } diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp index 38c7df4..9aed043 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp @@ -34,7 +34,7 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" +#include "core/dom/DOMArrayBufferDeallocationObserver.h" #include "core/dom/ExceptionCode.h" #include "modules/webaudio/AudioContext.h" #include "platform/audio/AudioBus.h" @@ -174,7 +174,7 @@ AudioBuffer::AudioBuffer(AudioBus* bus) } } -PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, ExceptionState& exceptionState) +PassRefPtr<DOMFloat32Array> AudioBuffer::getChannelData(unsigned channelIndex, ExceptionState& exceptionState) { if (channelIndex >= m_channels.size()) { exceptionState.throwDOMException(IndexSizeError, "channel index (" + String::number(channelIndex) + ") exceeds number of channels (" + String::number(m_channels.size()) + ")"); @@ -182,7 +182,7 @@ PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, Exce } Float32Array* channelData = m_channels[channelIndex].get(); - return Float32Array::create(channelData->buffer(), channelData->byteOffset(), channelData->length()); + return DOMFloat32Array::create(channelData->buffer(), channelData->byteOffset(), channelData->length()); } Float32Array* AudioBuffer::getChannelData(unsigned channelIndex) @@ -212,7 +212,7 @@ v8::Handle<v8::Object> AudioBuffer::associateWithWrapper(const WrapperTypeInfo* // GC, and until the object is exposed to JavaScript, V8 GC doesn't // affect it. for (unsigned i = 0, n = numberOfChannels(); i < n; ++i) { - getChannelData(i)->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); + getChannelData(i)->buffer()->setDeallocationObserver(DOMArrayBufferDeallocationObserver::instance()); } } return wrapper; diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.h b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.h index d0906c6..d9d741e 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioBuffer.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioBuffer.h @@ -30,6 +30,7 @@ #define AudioBuffer_h #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMTypedArray.h" #include "wtf/Float32Array.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" @@ -58,7 +59,7 @@ public: // Channel data access unsigned numberOfChannels() const { return m_channels.size(); } - PassRefPtr<Float32Array> getChannelData(unsigned channelIndex, ExceptionState&); + PassRefPtr<DOMFloat32Array> getChannelData(unsigned channelIndex, ExceptionState&); Float32Array* getChannelData(unsigned channelIndex); void zero(); diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp index b5127c0..39f6180 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp @@ -34,8 +34,6 @@ #include "core/dom/ExceptionCode.h" #include "core/html/HTMLMediaElement.h" #include "core/inspector/ScriptCallStack.h" -#include "platform/audio/FFTFrame.h" -#include "platform/audio/HRTFPanner.h" #include "modules/mediastream/MediaStream.h" #include "modules/webaudio/AnalyserNode.h" #include "modules/webaudio/AudioBuffer.h" @@ -63,16 +61,16 @@ #include "modules/webaudio/PeriodicWave.h" #include "modules/webaudio/ScriptProcessorNode.h" #include "modules/webaudio/WaveShaperNode.h" +#include "platform/audio/FFTFrame.h" +#include "platform/audio/HRTFPanner.h" +#include "wtf/Atomics.h" +#include "wtf/PassOwnPtr.h" +#include "wtf/text/WTFString.h" #if DEBUG_AUDIONODE_REFERENCES #include <stdio.h> #endif -#include "wtf/ArrayBuffer.h" -#include "wtf/Atomics.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/text/WTFString.h" - namespace blink { // Don't allow more than this number of simultaneous AudioContexts talking to hardware. @@ -229,7 +227,7 @@ AudioBuffer* AudioContext::createBuffer(unsigned numberOfChannels, size_t number return AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate, exceptionState); } -void AudioContext::decodeAudioData(ArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionState& exceptionState) +void AudioContext::decodeAudioData(DOMArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionState& exceptionState) { if (!audioData) { exceptionState.throwDOMException( @@ -237,7 +235,7 @@ void AudioContext::decodeAudioData(ArrayBuffer* audioData, AudioBufferCallback* "invalid ArrayBuffer for audioData."); return; } - m_audioDecoder.decodeAsync(audioData, sampleRate(), successCallback, errorCallback); + m_audioDecoder.decodeAsync(audioData->buffer(), sampleRate(), successCallback, errorCallback); } AudioBufferSourceNode* AudioContext::createBufferSource() @@ -485,7 +483,7 @@ OscillatorNode* AudioContext::createOscillator() return node; } -PeriodicWave* AudioContext::createPeriodicWave(Float32Array* real, Float32Array* imag, ExceptionState& exceptionState) +PeriodicWave* AudioContext::createPeriodicWave(DOMFloat32Array* real, DOMFloat32Array* imag, ExceptionState& exceptionState) { ASSERT(isMainThread()); @@ -528,7 +526,7 @@ PeriodicWave* AudioContext::createPeriodicWave(Float32Array* real, Float32Array* return 0; } - return PeriodicWave::create(sampleRate(), real, imag); + return PeriodicWave::create(sampleRate(), real->view(), imag->view()); } void AudioContext::notifyNodeFinishedProcessing(AudioNode* node) diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.h b/third_party/WebKit/Source/modules/webaudio/AudioContext.h index fde6ef7..1e54668 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioContext.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.h @@ -26,6 +26,7 @@ #define AudioContext_h #include "core/dom/ActiveDOMObject.h" +#include "core/dom/DOMTypedArray.h" #include "core/events/EventListener.h" #include "modules/EventTargetModules.h" #include "modules/webaudio/AsyncAudioDecoder.h" @@ -99,7 +100,7 @@ public: AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); // Asynchronous audio file data decoding. - void decodeAudioData(ArrayBuffer*, AudioBufferCallback*, AudioBufferCallback*, ExceptionState&); + void decodeAudioData(DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallback*, ExceptionState&); AudioListener* listener() { return m_listener.get(); } @@ -126,7 +127,7 @@ public: ChannelMergerNode* createChannelMerger(ExceptionState&); ChannelMergerNode* createChannelMerger(size_t numberOfInputs, ExceptionState&); OscillatorNode* createOscillator(); - PeriodicWave* createPeriodicWave(Float32Array* real, Float32Array* imag, ExceptionState&); + PeriodicWave* createPeriodicWave(DOMFloat32Array* real, DOMFloat32Array* imag, ExceptionState&); // When a source node has no more processing to do (has finished playing), then it tells the context to dereference it. void notifyNodeFinishedProcessing(AudioNode*); diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.idl b/third_party/WebKit/Source/modules/webaudio/AudioContext.idl index b0398cc..79b25d9 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioContext.idl +++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.idl @@ -32,7 +32,6 @@ NoInterfaceObject, RaisesException=Constructor, ] interface AudioContext : EventTarget { - // All rendered audio ultimately connects to destination, which represents the audio hardware. readonly attribute AudioDestinationNode destination; diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.h b/third_party/WebKit/Source/modules/webaudio/AudioParam.h index 7aaaaba..d1c052f 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioParam.h +++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.h @@ -30,13 +30,13 @@ #define AudioParam_h #include "bindings/core/v8/ScriptWrappable.h" +#include "core/dom/DOMTypedArray.h" #include "modules/webaudio/AudioContext.h" #include "modules/webaudio/AudioParamTimeline.h" #include "modules/webaudio/AudioSummingJunction.h" -#include <sys/types.h> -#include "wtf/Float32Array.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" +#include <sys/types.h> namespace blink { @@ -95,9 +95,9 @@ public: { m_timeline.setTargetAtTime(target, time, timeConstant, exceptionState); } - void setValueCurveAtTime(Float32Array* curve, double time, double duration, ExceptionState& exceptionState) + void setValueCurveAtTime(DOMFloat32Array* curve, double time, double duration, ExceptionState& exceptionState) { - m_timeline.setValueCurveAtTime(curve, time, duration, exceptionState); + m_timeline.setValueCurveAtTime(curve->view(), time, duration, exceptionState); } void cancelScheduledValues(double startTime, ExceptionState& exceptionState) { diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp index 4c8b921..09f1382 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp @@ -92,9 +92,7 @@ bool BiquadFilterNode::setType(unsigned type) return true; } -void BiquadFilterNode::getFrequencyResponse(const Float32Array* frequencyHz, - Float32Array* magResponse, - Float32Array* phaseResponse) +void BiquadFilterNode::getFrequencyResponse(const DOMFloat32Array* frequencyHz, DOMFloat32Array* magResponse, DOMFloat32Array* phaseResponse) { if (!frequencyHz || !magResponse || !phaseResponse) return; diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h index 16dd21c..2c5f076 100644 --- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h +++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h @@ -25,6 +25,7 @@ #ifndef BiquadFilterNode_h #define BiquadFilterNode_h +#include "core/dom/DOMTypedArray.h" #include "modules/webaudio/AudioBasicProcessorNode.h" #include "modules/webaudio/BiquadProcessor.h" @@ -62,9 +63,7 @@ public: // Get the magnitude and phase response of the filter at the given // set of frequencies (in Hz). The phase response is in radians. - void getFrequencyResponse(const Float32Array* frequencyHz, - Float32Array* magResponse, - Float32Array* phaseResponse); + void getFrequencyResponse(const DOMFloat32Array* frequencyHz, DOMFloat32Array* magResponse, DOMFloat32Array* phaseResponse); private: BiquadFilterNode(AudioContext*, float sampleRate); diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp index 9a336fd..7179111 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperDSPKernel.cpp @@ -77,7 +77,7 @@ void WaveShaperDSPKernel::processCurve(const float* source, float* destination, { ASSERT(source && destination && waveShaperProcessor()); - Float32Array* curve = waveShaperProcessor()->curve(); + DOMFloat32Array* curve = waveShaperProcessor()->curve(); if (!curve) { // Act as "straight wire" pass-through if no curve is set. memcpy(destination, source, sizeof(float) * framesToProcess); diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp index b8d895a..4007886 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp @@ -44,13 +44,13 @@ WaveShaperNode::WaveShaperNode(AudioContext* context) initialize(); } -void WaveShaperNode::setCurve(Float32Array* curve) +void WaveShaperNode::setCurve(DOMFloat32Array* curve) { ASSERT(isMainThread()); waveShaperProcessor()->setCurve(curve); } -Float32Array* WaveShaperNode::curve() +DOMFloat32Array* WaveShaperNode::curve() { return waveShaperProcessor()->curve(); } diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h index 0fae6392..c3b0f22 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h @@ -25,10 +25,10 @@ #ifndef WaveShaperNode_h #define WaveShaperNode_h +#include "core/dom/DOMTypedArray.h" #include "modules/webaudio/AudioBasicProcessorNode.h" #include "modules/webaudio/BiquadProcessor.h" #include "modules/webaudio/WaveShaperProcessor.h" -#include "wtf/Forward.h" namespace blink { @@ -43,8 +43,8 @@ public: } // setCurve() is called on the main thread. - void setCurve(Float32Array*); - Float32Array* curve(); + void setCurve(DOMFloat32Array*); + DOMFloat32Array* curve(); void setOversample(const String& , ExceptionState&); String oversample() const; diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp index 830afc6..0eeeac0 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.cpp @@ -49,7 +49,7 @@ PassOwnPtr<AudioDSPKernel> WaveShaperProcessor::createKernel() return adoptPtr(new WaveShaperDSPKernel(this)); } -void WaveShaperProcessor::setCurve(Float32Array* curve) +void WaveShaperProcessor::setCurve(DOMFloat32Array* curve) { // This synchronizes with process(). MutexLocker processLocker(m_processLock); diff --git a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h index 51566b2..6301c90 100644 --- a/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h +++ b/third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.h @@ -25,10 +25,10 @@ #ifndef WaveShaperProcessor_h #define WaveShaperProcessor_h +#include "core/dom/DOMTypedArray.h" +#include "modules/webaudio/AudioNode.h" #include "platform/audio/AudioDSPKernel.h" #include "platform/audio/AudioDSPKernelProcessor.h" -#include "modules/webaudio/AudioNode.h" -#include "wtf/Float32Array.h" #include "wtf/RefPtr.h" #include "wtf/ThreadingPrimitives.h" @@ -52,15 +52,15 @@ public: virtual void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override; - void setCurve(Float32Array*); - Float32Array* curve() { return m_curve.get(); } + void setCurve(DOMFloat32Array*); + DOMFloat32Array* curve() { return m_curve.get(); } void setOversample(OverSampleType); OverSampleType oversample() const { return m_oversample; } private: // m_curve represents the non-linear shaping curve. - RefPtr<Float32Array> m_curve; + RefPtr<DOMFloat32Array> m_curve; OverSampleType m_oversample; }; diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp index becbd1d..fc6da6d 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp @@ -60,7 +60,7 @@ void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data // unless the current process has an explicit permission to handle sysex message. if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) return; - RefPtr<Uint8Array> array = Uint8Array::create(data, length); + RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); } diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.h b/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.h index 235fe1e..6d2b283 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.h @@ -31,8 +31,8 @@ #ifndef MIDIMessageEvent_h #define MIDIMessageEvent_h +#include "core/dom/DOMTypedArray.h" #include "modules/EventModules.h" -#include "wtf/Uint8Array.h" namespace blink { @@ -41,7 +41,7 @@ struct MIDIMessageEventInit : public EventInit { : receivedTime(0.0) { } double receivedTime; - RefPtr<Uint8Array> data; + RefPtr<DOMUint8Array> data; }; class MIDIMessageEvent final : public Event { @@ -52,7 +52,7 @@ public: return adoptRefWillBeNoop(new MIDIMessageEvent()); } - static PassRefPtrWillBeRawPtr<MIDIMessageEvent> create(double receivedTime, PassRefPtr<Uint8Array> data) + static PassRefPtrWillBeRawPtr<MIDIMessageEvent> create(double receivedTime, PassRefPtr<DOMUint8Array> data) { return adoptRefWillBeNoop(new MIDIMessageEvent(receivedTime, data)); } @@ -63,7 +63,7 @@ public: } double receivedTime() { return m_receivedTime; } - PassRefPtr<Uint8Array> data() { return m_data; } + PassRefPtr<DOMUint8Array> data() { return m_data; } virtual const AtomicString& interfaceName() const override { return EventNames::MIDIMessageEvent; } @@ -73,7 +73,7 @@ private: MIDIMessageEvent() : m_receivedTime(0) { } - MIDIMessageEvent(double receivedTime, PassRefPtr<Uint8Array> data) + MIDIMessageEvent(double receivedTime, PassRefPtr<DOMUint8Array> data) : Event(EventTypeNames::midimessage, true, false) , m_receivedTime(receivedTime) , m_data(data) { } @@ -84,7 +84,7 @@ private: , m_data(initializer.data) { } double m_receivedTime; - RefPtr<Uint8Array> m_data; + RefPtr<DOMUint8Array> m_data; }; } // namespace blink diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp index 93bfa88..17c30ba 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp @@ -189,6 +189,14 @@ MIDIOutput::~MIDIOutput() { } +void MIDIOutput::send(DOMUint8Array* array, double timestamp, ExceptionState& exceptionState) +{ + if (!array) + return; + + send(array->view(), timestamp, exceptionState); +} + void MIDIOutput::send(Uint8Array* array, double timestamp, ExceptionState& exceptionState) { if (timestamp == 0.0) @@ -220,7 +228,7 @@ void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception send(array.get(), timestamp, exceptionState); } -void MIDIOutput::send(Uint8Array* data, ExceptionState& exceptionState) +void MIDIOutput::send(DOMUint8Array* data, ExceptionState& exceptionState) { send(data, 0.0, exceptionState); } diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.h b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.h index 2b8d0c1..3fe103c 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.h +++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.h @@ -31,8 +31,8 @@ #ifndef MIDIOutput_h #define MIDIOutput_h +#include "core/dom/DOMTypedArray.h" #include "modules/webmidi/MIDIPort.h" -#include "wtf/Uint8Array.h" namespace blink { @@ -45,11 +45,12 @@ public: static MIDIOutput* create(MIDIAccess*, unsigned portIndex, const String& id, const String& manufacturer, const String& name, const String& version); virtual ~MIDIOutput(); + void send(DOMUint8Array*, double timestamp, ExceptionState&); void send(Uint8Array*, double timestamp, ExceptionState&); void send(Vector<unsigned>, double timestamp, ExceptionState&); // send() without optional |timestamp|. - void send(Uint8Array*, ExceptionState&); + void send(DOMUint8Array*, ExceptionState&); void send(Vector<unsigned>, ExceptionState&); virtual void trace(Visitor*) override; diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp index 928e885..4ac9187 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp @@ -29,11 +29,12 @@ */ #include "config.h" - #include "modules/websockets/DOMWebSocket.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ScriptController.h" +#include "core/dom/DOMArrayBuffer.h" +#include "core/dom/DOMArrayBufferView.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" @@ -52,8 +53,6 @@ #include "platform/weborigin/KnownPorts.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" #include "wtf/Assertions.h" #include "wtf/HashSet.h" #include "wtf/PassOwnPtr.h" @@ -392,10 +391,10 @@ void DOMWebSocket::send(const String& message, ExceptionState& exceptionState) m_channel->send(message); } -void DOMWebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState) +void DOMWebSocket::send(DOMArrayBuffer* binaryData, ExceptionState& exceptionState) { WTF_LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData); - ASSERT(binaryData); + ASSERT(binaryData && binaryData->buffer()); if (m_state == CONNECTING) { setInvalidStateErrorForSendMethod(exceptionState); return; @@ -407,10 +406,10 @@ void DOMWebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState) Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebSocketSendTypeArrayBuffer, WebSocketSendTypeMax); ASSERT(m_channel); m_bufferedAmount += binaryData->byteLength(); - m_channel->send(*binaryData, 0, binaryData->byteLength()); + m_channel->send(*binaryData->buffer(), 0, binaryData->byteLength()); } -void DOMWebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& exceptionState) +void DOMWebSocket::send(DOMArrayBufferView* arrayBufferView, ExceptionState& exceptionState) { WTF_LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arrayBufferView); ASSERT(arrayBufferView); @@ -425,7 +424,7 @@ void DOMWebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& except Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebSocketSendTypeArrayBufferView, WebSocketSendTypeMax); ASSERT(m_channel); m_bufferedAmount += arrayBufferView->byteLength(); - RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->buffer()); + RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->view()->buffer()); m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength()); } @@ -623,7 +622,7 @@ void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char> > binaryData) } case BinaryTypeArrayBuffer: - RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(binaryData->data(), binaryData->size()); + RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(binaryData->data(), binaryData->size()); if (!arrayBuffer) { // Failed to allocate an ArrayBuffer. We need to crash the renderer // since there's no way defined in the spec to tell this to the diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h index c8b8f3b..48ab966 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.h @@ -46,6 +46,8 @@ namespace blink { class Blob; +class DOMArrayBuffer; +class DOMArrayBufferView; class ExceptionState; class DOMWebSocket : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<DOMWebSocket>, public EventTargetWithInlineData, public ActiveDOMObject, public WebSocketChannelClient { @@ -72,8 +74,8 @@ public: void connect(const String& url, const Vector<String>& protocols, ExceptionState&); void send(const String& message, ExceptionState&); - void send(ArrayBuffer*, ExceptionState&); - void send(ArrayBufferView*, ExceptionState&); + void send(DOMArrayBuffer*, ExceptionState&); + void send(DOMArrayBufferView*, ExceptionState&); void send(Blob*, ExceptionState&); // To distinguish close method call with the code parameter from one diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp index 04b6d7c..dc6e001 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocketTest.cpp @@ -3,19 +3,17 @@ // found in the LICENSE file. #include "config.h" - #include "modules/websockets/DOMWebSocket.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/V8Binding.h" +#include "core/dom/DOMTypedArray.h" #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/fileapi/Blob.h" #include "core/frame/ConsoleTypes.h" #include "core/testing/DummyPageHolder.h" -#include "wtf/ArrayBuffer.h" #include "wtf/OwnPtr.h" -#include "wtf/Uint8Array.h" #include "wtf/Vector.h" #include "wtf/testing/WTFTestHelpers.h" #include "wtf/text/WTFString.h" @@ -546,7 +544,7 @@ TEST_F(DOMWebSocketTest, sendStringSuccess) TEST_F(DOMWebSocketTest, sendArrayBufferWhenConnecting) { - RefPtr<ArrayBufferView> view = Uint8Array::create(8); + RefPtr<DOMArrayBufferView> view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -565,7 +563,7 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenConnecting) TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosing) { - RefPtr<ArrayBufferView> view = Uint8Array::create(8); + RefPtr<DOMArrayBufferView> view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -587,7 +585,7 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosing) TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosed) { Checkpoint checkpoint; - RefPtr<ArrayBufferView> view = Uint8Array::create(8); + RefPtr<DOMArrayBufferView> view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); @@ -609,11 +607,11 @@ TEST_F(DOMWebSocketTest, sendArrayBufferWhenClosed) TEST_F(DOMWebSocketTest, sendArrayBufferSuccess) { - RefPtr<ArrayBufferView> view = Uint8Array::create(8); + RefPtr<DOMArrayBufferView> view = DOMUint8Array::create(8); { InSequence s; EXPECT_CALL(channel(), connect(KURL(KURL(), "ws://example.com/"), String())).WillOnce(Return(true)); - EXPECT_CALL(channel(), send(Ref(*view->buffer()), 0, 8)); + EXPECT_CALL(channel(), send(Ref(*view->view()->buffer()), 0, 8)); } m_websocket->connect("ws://example.com/", Vector<String>(), m_exceptionState); diff --git a/third_party/WebKit/Source/web/WebArrayBufferConverter.cpp b/third_party/WebKit/Source/web/WebArrayBufferConverter.cpp index 58d7a52..ce374d3 100644 --- a/third_party/WebKit/Source/web/WebArrayBufferConverter.cpp +++ b/third_party/WebKit/Source/web/WebArrayBufferConverter.cpp @@ -31,9 +31,7 @@ #include "config.h" #include "public/web/WebArrayBufferConverter.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/PassOwnPtr.h" +#include "bindings/core/v8/V8ArrayBuffer.h" namespace blink { @@ -41,16 +39,15 @@ v8::Handle<v8::Value> WebArrayBufferConverter::toV8Value(WebArrayBuffer* buffer, { if (!buffer) return v8::Handle<v8::Value>(); - return toV8(*buffer, creationContext, isolate); + return toV8(DOMArrayBuffer::create(*buffer), creationContext, isolate); } WebArrayBuffer* WebArrayBufferConverter::createFromV8Value(v8::Handle<v8::Value> value, v8::Isolate* isolate) { if (!V8ArrayBuffer::hasInstance(value, isolate)) return 0; - ArrayBuffer* buffer = V8ArrayBuffer::toImpl(value->ToObject()); - return new WebArrayBuffer(buffer); + DOMArrayBuffer* buffer = V8ArrayBuffer::toImpl(value->ToObject()); + return new WebArrayBuffer(buffer->buffer()); } } // namespace blink - diff --git a/third_party/WebKit/Source/web/WebArrayBufferView.cpp b/third_party/WebKit/Source/web/WebArrayBufferView.cpp index f204a0e..c792e4a 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 "public/web/WebArrayBufferView.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "wtf/ArrayBufferView.h" namespace blink { @@ -63,8 +63,8 @@ WebArrayBufferView* WebArrayBufferView::createFromV8Value(v8::Handle<v8::Value> { if (!value->IsArrayBufferView()) return 0; - ArrayBufferView* view = V8ArrayBufferView::toImpl(value->ToObject()); - return new WebArrayBufferView(view); + DOMArrayBufferView* view = V8ArrayBufferView::toImpl(value->ToObject()); + return new WebArrayBufferView(view->view()); } WebArrayBufferView::WebArrayBufferView(const PassRefPtr<ArrayBufferView>& value) diff --git a/third_party/WebKit/Source/web/WebBindings.cpp b/third_party/WebKit/Source/web/WebBindings.cpp index 2c9158f..78c3ba1 100644 --- a/third_party/WebKit/Source/web/WebBindings.cpp +++ b/third_party/WebKit/Source/web/WebBindings.cpp @@ -33,13 +33,13 @@ #include "bindings/core/v8/NPV8Object.h" #include "bindings/core/v8/ScriptController.h" +#include "bindings/core/v8/V8ArrayBuffer.h" +#include "bindings/core/v8/V8ArrayBufferView.h" #include "bindings/core/v8/V8DOMWrapper.h" #include "bindings/core/v8/V8Element.h" #include "bindings/core/v8/V8NPObject.h" #include "bindings/core/v8/V8NPUtils.h" #include "bindings/core/v8/V8Range.h" -#include "bindings/core/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" #include "bindings/core/v8/npruntime_impl.h" #include "bindings/core/v8/npruntime_priv.h" #include "core/dom/Range.h" @@ -49,7 +49,6 @@ #include "public/web/WebArrayBufferView.h" #include "public/web/WebElement.h" #include "public/web/WebRange.h" -#include "wtf/ArrayBufferView.h" namespace blink { @@ -286,11 +285,11 @@ static bool getArrayBufferImpl(NPObject* object, WebArrayBuffer* arrayBuffer, v8 v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); if (v8Object.IsEmpty()) return false; - ArrayBuffer* native = V8ArrayBuffer::hasInstance(v8Object, isolate) ? V8ArrayBuffer::toImpl(v8Object) : 0; - if (!native) + DOMArrayBuffer* impl = V8ArrayBuffer::hasInstance(v8Object, isolate) ? V8ArrayBuffer::toImpl(v8Object) : 0; + if (!impl) return false; - *arrayBuffer = WebArrayBuffer(native); + *arrayBuffer = WebArrayBuffer(impl->buffer()); return true; } @@ -307,11 +306,11 @@ static bool getArrayBufferViewImpl(NPObject* object, WebArrayBufferView* arrayBu v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); if (v8Object.IsEmpty()) return false; - ArrayBufferView* native = V8ArrayBufferView::hasInstance(v8Object, isolate) ? V8ArrayBufferView::toImpl(v8Object) : 0; - if (!native) + DOMArrayBufferView* impl = V8ArrayBufferView::hasInstance(v8Object, isolate) ? V8ArrayBufferView::toImpl(v8Object) : 0; + if (!impl) return false; - *arrayBufferView = WebArrayBufferView(native); + *arrayBufferView = WebArrayBufferView(impl->view()); return true; } diff --git a/third_party/WebKit/Source/wtf/ArrayBuffer.h b/third_party/WebKit/Source/wtf/ArrayBuffer.h index e2e1745..b91070d 100644 --- a/third_party/WebKit/Source/wtf/ArrayBuffer.h +++ b/third_party/WebKit/Source/wtf/ArrayBuffer.h @@ -66,10 +66,12 @@ public: ~ArrayBuffer() { } +protected: + inline explicit ArrayBuffer(ArrayBufferContents&); + private: static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy); - inline ArrayBuffer(ArrayBufferContents&); inline PassRefPtr<ArrayBuffer> sliceImpl(unsigned begin, unsigned end) const; inline unsigned clampIndex(int index) const; static inline int clampValue(int x, int left, int right); diff --git a/third_party/WebKit/Source/wtf/ArrayBufferContents.h b/third_party/WebKit/Source/wtf/ArrayBufferContents.h index edd5ef7..314d1f9 100644 --- a/third_party/WebKit/Source/wtf/ArrayBufferContents.h +++ b/third_party/WebKit/Source/wtf/ArrayBufferContents.h @@ -45,7 +45,7 @@ public: ArrayBufferContents(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy); // Use with care. data must be allocated with allocateMemory. - // ArrayBufferContents will take ownership of the data and free it (using freeMemorY) + // ArrayBufferContents will take ownership of the data and free it (using freeMemory) // upon destruction. // This constructor will not call observer->StartObserving(), so it is a responsibility // of the caller to make sure JS knows about external memory. diff --git a/third_party/WebKit/Source/wtf/TypedArrayBase.h b/third_party/WebKit/Source/wtf/TypedArrayBase.h index 6319f11..7679abc 100644 --- a/third_party/WebKit/Source/wtf/TypedArrayBase.h +++ b/third_party/WebKit/Source/wtf/TypedArrayBase.h @@ -34,7 +34,9 @@ namespace WTF { template <typename T> class TypedArrayBase : public ArrayBufferView { - public: +public: + typedef T ValueType; + T* data() const { return static_cast<T*>(baseAddress()); } bool set(TypedArrayBase<T>* array, unsigned offset) |