MCPcopy Create free account
hub / github.com/cocos/cocos-engine / setJSArrayBuffer

Method setJSArrayBuffer

native/cocos/core/ArrayBuffer.cpp:49–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void ArrayBuffer::setJSArrayBuffer(se::Object *arrayBuffer) {
50 if (_jsArrayBuffer) {
51 _jsArrayBuffer->unroot();
52 _jsArrayBuffer->decRef();
53 }
54
55 _jsArrayBuffer = arrayBuffer;
56 _jsArrayBuffer->incRef();
57 _jsArrayBuffer->root();
58 size_t length{0};
59 _jsArrayBuffer->getArrayBufferData(static_cast<uint8_t **>(&_data), &length);
60 _byteLength = static_cast<uint32_t>(length);
61}
62
63ArrayBuffer::Ptr ArrayBuffer::slice(uint32_t begin, uint32_t end) {
64 CC_ASSERT_GT(end, begin);

Callers 2

setJSTypedArrayMethod · 0.80
sevalue_to_nativeFunction · 0.80

Calls 5

unrootMethod · 0.45
decRefMethod · 0.45
incRefMethod · 0.45
rootMethod · 0.45
getArrayBufferDataMethod · 0.45

Tested by 1

sevalue_to_nativeFunction · 0.64