33
44#include " JSTypedArray.h"
55
6+ #include < wtf/RefPtr.h>
7+
68#include " JSObjectRef.h"
79#include " APICast.h"
810#include " InitializeThreading.h"
@@ -76,23 +78,22 @@ const CreateTypedArrayFuncPtr CreateTypedArrayFunc[] = {
7678
7779
7880
79- JSTypedArrayType JSTypedArrayGetType (JSContextRef ctx, JSValueRef value ) {
81+ JSTypedArrayType JSObjectGetTypedArrayType (JSContextRef ctx, JSObjectRef object ) {
8082 ExecState* exec = toJS (ctx);
8183 APIEntryShim entryShim (exec);
8284
83- JSValue jsValue = toJS (exec, value );
85+ JSObject* jsObject = toJS (object );
8486 JSTypedArrayType type = kJSTypedArrayTypeNone ;
85- if ( jsValue.inherits (JSArrayBufferView::info ()) ) {
86- JSObject* object = jsValue.getObject ();
87- type = TypedArrayTypes[object->classInfo ()->typedArrayStorageType ];
87+ if ( jsObject->inherits (JSArrayBufferView::info ()) ) {
88+ type = TypedArrayTypes[jsObject->classInfo ()->typedArrayStorageType ];
8889 }
89- else if ( jsValue. inherits (JSArrayBuffer::info ()) ) {
90+ else if ( jsObject-> inherits (JSArrayBuffer::info ()) ) {
9091 type = kJSTypedArrayTypeArrayBuffer ;
9192 }
9293 return type;
9394}
9495
95- JSObjectRef JSTypedArrayMake (JSContextRef ctx, JSTypedArrayType arrayType, size_t numElements) {
96+ JSObjectRef JSObjectMakeTypedArray (JSContextRef ctx, JSTypedArrayType arrayType, size_t numElements) {
9697 ExecState* exec = toJS (ctx);
9798 APIEntryShim entryShim (exec);
9899
@@ -104,18 +105,18 @@ JSObjectRef JSTypedArrayMake(JSContextRef ctx, JSTypedArrayType arrayType, size_
104105 return toRef (result);
105106}
106107
107- void * JSTypedArrayGetDataPtr (JSContextRef ctx, JSValueRef value , size_t * byteLength) {
108+ void * JSObjectGetTypedArrayDataPtr (JSContextRef ctx, JSObjectRef object , size_t * byteLength) {
108109 ExecState* exec = toJS (ctx);
109110 APIEntryShim entryShim (exec);
110111
111- JSValue jsValue = toJS (exec, value );
112- if ( JSArrayBufferView * view = jsDynamicCast<JSArrayBufferView*>(jsValue ) ) {
112+ JSObject* jsObject = toJS (object );
113+ if ( JSArrayBufferView * view = jsDynamicCast<JSArrayBufferView*>(jsObject ) ) {
113114 if ( byteLength ) {
114115 *byteLength = view->impl ()->byteLength ();
115116 }
116117 return view->impl ()->baseAddress ();
117118 }
118- else if ( ArrayBuffer * buffer = toArrayBuffer (jsValue ) ) {
119+ else if ( ArrayBuffer* buffer = toArrayBuffer (jsObject ) ) {
119120 if ( byteLength ) {
120121 *byteLength = buffer->byteLength ();
121122 }
@@ -127,6 +128,3 @@ void * JSTypedArrayGetDataPtr(JSContextRef ctx, JSValueRef value, size_t * byteL
127128 }
128129 return NULL ;
129130}
130-
131-
132-
0 commit comments