aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraybuffer_p.h6
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp3
-rw-r--r--src/qml/jsruntime/qv4typedarray_p.h15
4 files changed, 20 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index e288023b80..76d5b6a7b8 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -82,7 +82,7 @@ ReturnedValue ArrayBufferCtor::method_isView(CallContext *ctx)
}
-Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, int length)
+Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, size_t length)
: Heap::Object(e->emptyClass, e->arrayBufferPrototype.asObject())
{
data = QTypedArrayData<char>::allocate(length + 1);
diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h
index b2d24f76bc..3c7faa1ea1 100644
--- a/src/qml/jsruntime/qv4arraybuffer_p.h
+++ b/src/qml/jsruntime/qv4arraybuffer_p.h
@@ -46,8 +46,8 @@ struct ArrayBufferCtor : FunctionObject {
ArrayBufferCtor(QV4::ExecutionContext *scope);
};
-struct ArrayBuffer : Object {
- ArrayBuffer(ExecutionEngine *e, int length);
+struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object {
+ ArrayBuffer(ExecutionEngine *e, size_t length);
~ArrayBuffer();
QTypedArrayData<char> *data;
@@ -67,7 +67,7 @@ struct ArrayBufferCtor: FunctionObject
};
-struct ArrayBuffer : Object
+struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object
{
V4_OBJECT2(ArrayBuffer, Object)
V4_NEEDS_DESTROY
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index ba3ebdd60c..4ddf77188c 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -334,7 +334,8 @@ ReturnedValue TypedArrayCtor::call(Managed *that, CallData *callData)
Heap::TypedArray::TypedArray(ExecutionEngine *e, Type t)
: Heap::Object(e->emptyClass, e->typedArrayPrototype[t].asObject()),
- type(operations + t)
+ type(operations + t),
+ arrayType(t)
{
}
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h
index 78949226b8..670a55157c 100644
--- a/src/qml/jsruntime/qv4typedarray_p.h
+++ b/src/qml/jsruntime/qv4typedarray_p.h
@@ -35,6 +35,7 @@
#include "qv4object_p.h"
#include "qv4functionobject_p.h"
+#include "qv4arraybuffer_p.h"
QT_BEGIN_NAMESPACE
@@ -74,6 +75,7 @@ struct TypedArray : Object {
ArrayBuffer *buffer;
uint byteLength;
uint byteOffset;
+ Type arrayType;
};
struct TypedArrayCtor : FunctionObject {
@@ -90,14 +92,25 @@ struct TypedArrayPrototype : Object {
}
-struct TypedArray : Object
+struct Q_QML_PRIVATE_EXPORT TypedArray : Object
{
V4_OBJECT2(TypedArray, Object)
+ uint byteLength() const {
+ return d()->byteLength;
+ }
+
uint length() const {
return d()->byteLength/d()->type->bytesPerElement;
}
+ QTypedArrayData<char> *arrayData() {
+ return d()->buffer->data;
+ }
+
+ Heap::TypedArray::Type arrayType() const {
+ return d()->arrayType;
+ }
static void markObjects(Heap::Base *that, ExecutionEngine *e);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);