| 47 | } |
| 48 | |
| 49 | void 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 | |
| 63 | ArrayBuffer::Ptr ArrayBuffer::slice(uint32_t begin, uint32_t end) { |
| 64 | CC_ASSERT_GT(end, begin); |