wasm: use emscripten::typed_memory_view()
Use typed_memory_view() instead to create UInt8Arrays pointing to an area of the heap, instead of HEAPU8. Fixes issue on emsdk >= 4.0.7 where HEAPU8 etc are no longer exported by default. Change-Id: I2c632b2c54dc1e9947b11ab3d2613d790b994440 Reviewed-by: Lorn Potter <lorn.potter@qt.io>
This commit is contained in:
parent
ab48b4f266
commit
913829ae4e
@ -330,11 +330,6 @@ emscripten::val FileReader::val() const
|
||||
return m_fileReader;
|
||||
}
|
||||
|
||||
Uint8Array Uint8Array::heap()
|
||||
{
|
||||
return Uint8Array(heap_());
|
||||
}
|
||||
|
||||
// Constructs a Uint8Array which references the given emscripten::val, which must contain a JS Unit8Array
|
||||
Uint8Array::Uint8Array(const emscripten::val &uint8Array)
|
||||
: m_uint8Array(uint8Array)
|
||||
@ -358,7 +353,7 @@ Uint8Array::Uint8Array(const ArrayBuffer &buffer, uint32_t offset, uint32_t leng
|
||||
|
||||
// Constructs a Uint8Array which references an area on the heap.
|
||||
Uint8Array::Uint8Array(const char *buffer, uint32_t size)
|
||||
:m_uint8Array(Uint8Array::constructor_().new_(Uint8Array::heap().buffer().m_arrayBuffer, uintptr_t(buffer), size))
|
||||
:m_uint8Array(emscripten::typed_memory_view(size, buffer))
|
||||
{
|
||||
|
||||
}
|
||||
@ -435,11 +430,6 @@ emscripten::val Uint8Array::val() const
|
||||
return m_uint8Array;
|
||||
}
|
||||
|
||||
emscripten::val Uint8Array::heap_()
|
||||
{
|
||||
return emscripten::val::module_property("HEAPU8");
|
||||
}
|
||||
|
||||
emscripten::val Uint8Array::constructor_()
|
||||
{
|
||||
return emscripten::val::global("Uint8Array");
|
||||
|
@ -171,7 +171,6 @@ namespace qstdweb {
|
||||
|
||||
class Q_CORE_EXPORT Uint8Array {
|
||||
public:
|
||||
static Uint8Array heap();
|
||||
explicit Uint8Array(const emscripten::val &uint8Array);
|
||||
explicit Uint8Array(const ArrayBuffer &buffer);
|
||||
explicit Uint8Array(uint32_t size);
|
||||
@ -192,7 +191,6 @@ namespace qstdweb {
|
||||
emscripten::val val() const;
|
||||
|
||||
private:
|
||||
static emscripten::val heap_();
|
||||
static emscripten::val constructor_();
|
||||
emscripten::val m_uint8Array = emscripten::val::undefined();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user