Skip to content

Commit 7940c54

Browse files
committed
Blindly added ArrayBuffer files
1 parent 3008f2d commit 7940c54

File tree

7 files changed

+967
-0
lines changed

7 files changed

+967
-0
lines changed

JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@
537537
A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FB60A3103F7DC20017A286 /* PropertyDescriptor.cpp */; };
538538
A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
539539
A8A4748E151A8306004123FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A8A4748D151A8306004123FF /* libWTF.a */; };
540+
B6D1882C166FA73400D1037C /* JSArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18814166FA73400D1037C /* JSArrayBuffer.cpp */; };
541+
B6D1882D166FA73400D1037C /* JSArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18814166FA73400D1037C /* JSArrayBuffer.cpp */; };
542+
B6D1882E166FA73400D1037C /* JSArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18815166FA73400D1037C /* JSArrayBuffer.h */; };
543+
B6D1882F166FA73400D1037C /* JSArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18815166FA73400D1037C /* JSArrayBuffer.h */; };
544+
B6D18830166FA73400D1037C /* JSArrayBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18816166FA73400D1037C /* JSArrayBufferCustom.cpp */; };
545+
B6D18831166FA73400D1037C /* JSArrayBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18816166FA73400D1037C /* JSArrayBufferCustom.cpp */; };
546+
B6D18832166FA73400D1037C /* JSArrayBufferView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18817166FA73400D1037C /* JSArrayBufferView.cpp */; };
547+
B6D18833166FA73400D1037C /* JSArrayBufferView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D18817166FA73400D1037C /* JSArrayBufferView.cpp */; };
548+
B6D18834166FA73400D1037C /* JSArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18818166FA73400D1037C /* JSArrayBufferView.h */; };
549+
B6D18835166FA73400D1037C /* JSArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18818166FA73400D1037C /* JSArrayBufferView.h */; };
550+
B6D18836166FA73400D1037C /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18819166FA73400D1037C /* JSArrayBufferViewHelper.h */; };
551+
B6D18837166FA73400D1037C /* JSArrayBufferViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D18819166FA73400D1037C /* JSArrayBufferViewHelper.h */; };
540552
B6E69991166BD63D005EF4B1 /* AbstractMacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */; };
541553
B6E69992166BD63D005EF4B1 /* APICast.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B78A0A4305AB00517CFC /* APICast.h */; settings = {ATTRIBUTES = (Private, ); }; };
542554
B6E69993166BD63D005EF4B1 /* APIShims.h in Headers */ = {isa = PBXBuildFile; fileRef = 865F408710E7D56300947361 /* APIShims.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1804,6 +1816,12 @@
18041816
A8A4748D151A8306004123FF /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
18051817
A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
18061818
A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
1819+
B6D18814166FA73400D1037C /* JSArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBuffer.cpp; sourceTree = "<group>"; };
1820+
B6D18815166FA73400D1037C /* JSArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBuffer.h; sourceTree = "<group>"; };
1821+
B6D18816166FA73400D1037C /* JSArrayBufferCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferCustom.cpp; sourceTree = "<group>"; };
1822+
B6D18817166FA73400D1037C /* JSArrayBufferView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferView.cpp; sourceTree = "<group>"; };
1823+
B6D18818166FA73400D1037C /* JSArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferView.h; sourceTree = "<group>"; };
1824+
B6D18819166FA73400D1037C /* JSArrayBufferViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSArrayBufferViewHelper.h; sourceTree = "<group>"; };
18071825
B6E69BC4166BD63D005EF4B1 /* libJavaScriptCore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libJavaScriptCore.a; sourceTree = BUILT_PRODUCTS_DIR; };
18081826
B6E69BDB166BD6C1005EF4B1 /* libJSCLLIntOffsetsExtractor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libJSCLLIntOffsetsExtractor.a; sourceTree = BUILT_PRODUCTS_DIR; };
18091827
B6E69BFD166BDCE7005EF4B1 /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libWTF.a; path = ../Build/libWTF.a; sourceTree = "<group>"; };
@@ -2419,6 +2437,7 @@
24192437
7EF6E0BB0EB7A1EC0079AFAF /* runtime */ = {
24202438
isa = PBXGroup;
24212439
children = (
2440+
B6D18813166FA73300D1037C /* TypedArrays */,
24222441
0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */,
24232442
0F21C27A14BE727300ADC64B /* ExecutionHarness.h */,
24242443
0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */,
@@ -2849,6 +2868,19 @@
28492868
path = bytecode;
28502869
sourceTree = "<group>";
28512870
};
2871+
B6D18813166FA73300D1037C /* TypedArrays */ = {
2872+
isa = PBXGroup;
2873+
children = (
2874+
B6D18814166FA73400D1037C /* JSArrayBuffer.cpp */,
2875+
B6D18815166FA73400D1037C /* JSArrayBuffer.h */,
2876+
B6D18816166FA73400D1037C /* JSArrayBufferCustom.cpp */,
2877+
B6D18817166FA73400D1037C /* JSArrayBufferView.cpp */,
2878+
B6D18818166FA73400D1037C /* JSArrayBufferView.h */,
2879+
B6D18819166FA73400D1037C /* JSArrayBufferViewHelper.h */,
2880+
);
2881+
path = TypedArrays;
2882+
sourceTree = "<group>";
2883+
};
28522884
/* End PBXGroup section */
28532885

28542886
/* Begin PBXHeadersBuildPhase section */
@@ -3206,6 +3238,9 @@
32063238
0F1E3A471534CBB9000F9456 /* DFGDoubleFormatState.h in Headers */,
32073239
14150133154BB13F005D8C98 /* WeakSetInlines.h in Headers */,
32083240
14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */,
3241+
B6D1882E166FA73400D1037C /* JSArrayBuffer.h in Headers */,
3242+
B6D18834166FA73400D1037C /* JSArrayBufferView.h in Headers */,
3243+
B6D18836166FA73400D1037C /* JSArrayBufferViewHelper.h in Headers */,
32093244
);
32103245
runOnlyForDeploymentPostprocessing = 0;
32113246
};
@@ -3551,6 +3586,9 @@
35513586
B6E69AE0166BD63D005EF4B1 /* DFGDoubleFormatState.h in Headers */,
35523587
B6E69AE1166BD63D005EF4B1 /* WeakSetInlines.h in Headers */,
35533588
B6E69AE2166BD63D005EF4B1 /* BlockAllocator.h in Headers */,
3589+
B6D1882F166FA73400D1037C /* JSArrayBuffer.h in Headers */,
3590+
B6D18835166FA73400D1037C /* JSArrayBufferView.h in Headers */,
3591+
B6D18837166FA73400D1037C /* JSArrayBufferViewHelper.h in Headers */,
35543592
);
35553593
runOnlyForDeploymentPostprocessing = 0;
35563594
};
@@ -4296,6 +4334,9 @@
42964334
8642C512151C083D0046D4EF /* RegExpMatchesArray.cpp in Sources */,
42974335
863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */,
42984336
14816E1B154CC56C00B8054C /* BlockAllocator.cpp in Sources */,
4337+
B6D1882C166FA73400D1037C /* JSArrayBuffer.cpp in Sources */,
4338+
B6D18830166FA73400D1037C /* JSArrayBufferCustom.cpp in Sources */,
4339+
B6D18832166FA73400D1037C /* JSArrayBufferView.cpp in Sources */,
42994340
);
43004341
runOnlyForDeploymentPostprocessing = 0;
43014342
};
@@ -4520,6 +4561,9 @@
45204561
B6E69BB2166BD63D005EF4B1 /* RegExpMatchesArray.cpp in Sources */,
45214562
B6E69BB3166BD63D005EF4B1 /* YarrCanonicalizeUCS2.cpp in Sources */,
45224563
B6E69BB4166BD63D005EF4B1 /* BlockAllocator.cpp in Sources */,
4564+
B6D1882D166FA73400D1037C /* JSArrayBuffer.cpp in Sources */,
4565+
B6D18831166FA73400D1037C /* JSArrayBufferCustom.cpp in Sources */,
4566+
B6D18833166FA73400D1037C /* JSArrayBufferView.cpp in Sources */,
45234567
);
45244568
runOnlyForDeploymentPostprocessing = 0;
45254569
};
@@ -5372,6 +5416,7 @@
53725416
B6E69C04166BDD18005EF4B1 /* Production */,
53735417
);
53745418
defaultConfigurationIsVisible = 0;
5419+
defaultConfigurationName = Production;
53755420
};
53765421
/* End XCConfigurationList section */
53775422
};
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
/*
2+
This file is part of the WebKit open source project.
3+
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Library General Public
7+
License as published by the Free Software Foundation; either
8+
version 2 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Library General Public License for more details.
14+
15+
You should have received a copy of the GNU Library General Public License
16+
along with this library; see the file COPYING.LIB. If not, write to
17+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18+
Boston, MA 02110-1301, USA.
19+
*/
20+
21+
#include "config.h"
22+
#include "JSArrayBuffer.h"
23+
24+
#include "ExceptionCode.h"
25+
#include "JSArrayBuffer.h"
26+
#include "JSDOMBinding.h"
27+
#include <runtime/Error.h>
28+
#include <wtf/ArrayBuffer.h>
29+
#include <wtf/GetPtr.h>
30+
31+
using namespace JSC;
32+
33+
namespace WebCore {
34+
35+
ASSERT_CLASS_FITS_IN_CELL(JSArrayBuffer);
36+
/* Hash table */
37+
38+
static const HashTableValue JSArrayBufferTableValues[] =
39+
{
40+
{ "byteLength", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferByteLength), (intptr_t)0, NoIntrinsic },
41+
{ "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferConstructor), (intptr_t)0, NoIntrinsic },
42+
{ 0, 0, 0, 0, NoIntrinsic }
43+
};
44+
45+
static const HashTable JSArrayBufferTable = { 5, 3, JSArrayBufferTableValues, 0 };
46+
/* Hash table for constructor */
47+
48+
static const HashTableValue JSArrayBufferConstructorTableValues[] =
49+
{
50+
{ 0, 0, 0, 0, NoIntrinsic }
51+
};
52+
53+
static const HashTable JSArrayBufferConstructorTable = { 1, 0, JSArrayBufferConstructorTableValues, 0 };
54+
const ClassInfo JSArrayBufferConstructor::s_info = { "ArrayBufferConstructor", &Base::s_info, &JSArrayBufferConstructorTable, 0, CREATE_METHOD_TABLE(JSArrayBufferConstructor) };
55+
56+
JSArrayBufferConstructor::JSArrayBufferConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
57+
: DOMConstructorObject(structure, globalObject)
58+
{
59+
}
60+
61+
void JSArrayBufferConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
62+
{
63+
Base::finishCreation(exec->globalData());
64+
ASSERT(inherits(&s_info));
65+
putDirect(exec->globalData(), exec->propertyNames().prototype, JSArrayBufferPrototype::self(exec, globalObject), DontDelete | ReadOnly);
66+
putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
67+
}
68+
69+
bool JSArrayBufferConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
70+
{
71+
return getStaticValueSlot<JSArrayBufferConstructor, JSDOMWrapper>(exec, &JSArrayBufferConstructorTable, jsCast<JSArrayBufferConstructor*>(cell), propertyName, slot);
72+
}
73+
74+
bool JSArrayBufferConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
75+
{
76+
return getStaticValueDescriptor<JSArrayBufferConstructor, JSDOMWrapper>(exec, &JSArrayBufferConstructorTable, jsCast<JSArrayBufferConstructor*>(object), propertyName, descriptor);
77+
}
78+
79+
ConstructType JSArrayBufferConstructor::getConstructData(JSCell*, ConstructData& constructData)
80+
{
81+
constructData.native.function = constructJSArrayBuffer;
82+
return ConstructTypeHost;
83+
}
84+
85+
/* Hash table for prototype */
86+
87+
static const HashTableValue JSArrayBufferPrototypeTableValues[] =
88+
{
89+
{ "slice", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsArrayBufferPrototypeFunctionSlice), (intptr_t)2, NoIntrinsic },
90+
{ 0, 0, 0, 0, NoIntrinsic }
91+
};
92+
93+
static const HashTable JSArrayBufferPrototypeTable = { 2, 1, JSArrayBufferPrototypeTableValues, 0 };
94+
static const HashTable* getJSArrayBufferPrototypeTable(ExecState* exec)
95+
{
96+
return getHashTableForGlobalData(exec->globalData(), &JSArrayBufferPrototypeTable);
97+
}
98+
99+
const ClassInfo JSArrayBufferPrototype::s_info = { "ArrayBufferPrototype", &Base::s_info, 0, getJSArrayBufferPrototypeTable, CREATE_METHOD_TABLE(JSArrayBufferPrototype) };
100+
101+
JSObject* JSArrayBufferPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
102+
{
103+
return getDOMPrototype<JSArrayBuffer>(exec, globalObject);
104+
}
105+
106+
bool JSArrayBufferPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
107+
{
108+
JSArrayBufferPrototype* thisObject = jsCast<JSArrayBufferPrototype*>(cell);
109+
return getStaticFunctionSlot<JSObject>(exec, getJSArrayBufferPrototypeTable(exec), thisObject, propertyName, slot);
110+
}
111+
112+
bool JSArrayBufferPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
113+
{
114+
JSArrayBufferPrototype* thisObject = jsCast<JSArrayBufferPrototype*>(object);
115+
return getStaticFunctionDescriptor<JSObject>(exec, getJSArrayBufferPrototypeTable(exec), thisObject, propertyName, descriptor);
116+
}
117+
118+
static const HashTable* getJSArrayBufferTable(ExecState* exec)
119+
{
120+
return getHashTableForGlobalData(exec->globalData(), &JSArrayBufferTable);
121+
}
122+
123+
const ClassInfo JSArrayBuffer::s_info = { "ArrayBuffer", &Base::s_info, 0, getJSArrayBufferTable , CREATE_METHOD_TABLE(JSArrayBuffer) };
124+
125+
JSArrayBuffer::JSArrayBuffer(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<ArrayBuffer> impl)
126+
: JSDOMWrapper(structure, globalObject)
127+
, m_impl(impl.leakRef())
128+
{
129+
}
130+
131+
void JSArrayBuffer::finishCreation(JSGlobalData& globalData)
132+
{
133+
Base::finishCreation(globalData);
134+
ASSERT(inherits(&s_info));
135+
}
136+
137+
JSObject* JSArrayBuffer::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
138+
{
139+
return JSArrayBufferPrototype::create(exec->globalData(), globalObject, JSArrayBufferPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
140+
}
141+
142+
void JSArrayBuffer::destroy(JSC::JSCell* cell)
143+
{
144+
JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(cell);
145+
thisObject->JSArrayBuffer::~JSArrayBuffer();
146+
}
147+
148+
JSArrayBuffer::~JSArrayBuffer()
149+
{
150+
releaseImplIfNotNull();
151+
}
152+
153+
bool JSArrayBuffer::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
154+
{
155+
JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(cell);
156+
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
157+
return getStaticValueSlot<JSArrayBuffer, Base>(exec, getJSArrayBufferTable(exec), thisObject, propertyName, slot);
158+
}
159+
160+
bool JSArrayBuffer::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
161+
{
162+
JSArrayBuffer* thisObject = jsCast<JSArrayBuffer*>(object);
163+
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
164+
return getStaticValueDescriptor<JSArrayBuffer, Base>(exec, getJSArrayBufferTable(exec), thisObject, propertyName, descriptor);
165+
}
166+
167+
JSValue jsArrayBufferByteLength(ExecState* exec, JSValue slotBase, const Identifier&)
168+
{
169+
JSArrayBuffer* castedThis = jsCast<JSArrayBuffer*>(asObject(slotBase));
170+
UNUSED_PARAM(exec);
171+
ArrayBuffer* impl = static_cast<ArrayBuffer*>(castedThis->impl());
172+
JSValue result = jsNumber(impl->byteLength());
173+
return result;
174+
}
175+
176+
177+
JSValue jsArrayBufferConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
178+
{
179+
JSArrayBuffer* domObject = jsCast<JSArrayBuffer*>(asObject(slotBase));
180+
return JSArrayBuffer::getConstructor(exec, domObject->globalObject());
181+
}
182+
183+
JSValue JSArrayBuffer::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
184+
{
185+
return getDOMConstructor<JSArrayBufferConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
186+
}
187+
188+
EncodedJSValue JSC_HOST_CALL jsArrayBufferPrototypeFunctionSlice(ExecState* exec)
189+
{
190+
JSValue thisValue = exec->hostThisValue();
191+
if (!thisValue.inherits(&JSArrayBuffer::s_info))
192+
return throwVMTypeError(exec);
193+
JSArrayBuffer* castedThis = jsCast<JSArrayBuffer*>(asObject(thisValue));
194+
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSArrayBuffer::s_info);
195+
ArrayBuffer* impl = static_cast<ArrayBuffer*>(castedThis->impl());
196+
if (exec->argumentCount() < 1)
197+
return throwVMError(exec, createNotEnoughArgumentsError(exec));
198+
int begin(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));
199+
if (exec->hadException())
200+
return JSValue::encode(jsUndefined());
201+
202+
size_t argsCount = exec->argumentCount();
203+
if (argsCount <= 1) {
204+
205+
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->slice(begin)));
206+
return JSValue::encode(result);
207+
}
208+
209+
int end(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toInt32(exec));
210+
if (exec->hadException())
211+
return JSValue::encode(jsUndefined());
212+
213+
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->slice(begin, end)));
214+
return JSValue::encode(result);
215+
}
216+
217+
static inline bool isObservable(JSArrayBuffer* jsArrayBuffer)
218+
{
219+
if (jsArrayBuffer->hasCustomProperties())
220+
return true;
221+
return false;
222+
}
223+
224+
bool JSArrayBufferOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
225+
{
226+
JSArrayBuffer* jsArrayBuffer = jsCast<JSArrayBuffer*>(handle.get().asCell());
227+
if (!isObservable(jsArrayBuffer))
228+
return false;
229+
ArrayBuffer* root = jsArrayBuffer->impl();
230+
return visitor.containsOpaqueRoot(root);
231+
}
232+
233+
void JSArrayBufferOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
234+
{
235+
JSArrayBuffer* jsArrayBuffer = jsCast<JSArrayBuffer*>(handle.get().asCell());
236+
DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
237+
uncacheWrapper(world, jsArrayBuffer->impl(), jsArrayBuffer);
238+
jsArrayBuffer->releaseImpl();
239+
}
240+
241+
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBuffer* impl)
242+
{
243+
return wrap<JSArrayBuffer>(exec, globalObject, impl);
244+
}
245+
246+
ArrayBuffer* toArrayBuffer(JSC::JSValue value)
247+
{
248+
return value.inherits(&JSArrayBuffer::s_info) ? jsCast<JSArrayBuffer*>(asObject(value))->impl() : 0;
249+
}
250+
251+
}

0 commit comments

Comments
 (0)