-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharraybuffer.h
More file actions
39 lines (31 loc) · 1.14 KB
/
arraybuffer.h
File metadata and controls
39 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef V8GO_ARRAYBUFFER_H
#define V8GO_ARRAYBUFFER_H
#include "v8go.h"
#ifdef __cplusplus
#include "context.h"
extern "C" {
#else
typedef struct m_ctx m_ctx;
typedef m_ctx* ContextPtr;
typedef struct m_value m_value;
typedef m_value* ValuePtr;
#endif
extern ValuePtr NewArrayBufferFromBytes(ContextPtr ctx_ptr,
const void* data,
size_t byte_length);
extern ValuePtr NewArrayBufferAlloc(ContextPtr ctx_ptr,
size_t byte_length);
// Zero-copy: wraps external (Go-owned) memory as an ArrayBuffer.
// The deleter_ref is passed back to Go when V8 releases the backing store.
extern ValuePtr NewArrayBufferExternal(ContextPtr ctx_ptr,
void* data,
size_t byte_length,
int deleter_ref);
extern void* ArrayBufferGetData(ValuePtr ptr);
extern size_t ArrayBufferGetByteLength(ValuePtr ptr);
extern BackingStorePtr ArrayBufferGetBackingStore(ValuePtr ptr);
extern int V8SandboxIsEnabled();
#ifdef __cplusplus
} // extern "C"
#endif
#endif