5#ifndef INCLUDE_V8_ARRAY_BUFFER_H_
6#define INCLUDE_V8_ARRAY_BUFFER_H_
22#if defined(V8_COMPRESS_POINTERS) &&
23 !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
27#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
29#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
37
38
39
40
41
42
43
44
45
46
47
48
54
55
56
57
61
62
66
67
68
69
70
71
75
76
77
81
82
83
84
88
89
90
91
92 void operator delete(
void* ptr) { ::operator
delete(ptr); }
95
96
97
98
99 using DeleterCallback =
void (*)(
void* data, size_t length,
103
104
105
106
107
108
109
110
111 static void EmptyDeleter(
void* data, size_t length,
void* deleter_data);
115
116
117
121#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
123using BackingStoreDeleterCallback =
void (*)(
void* data, size_t length,
129
130
134
135
136
137
138
139
140
141
142
143
144
145
146
147
153
154
155
159
160
161
165
166
167
168 virtual void Free(
void* data, size_t length) = 0;
171
172
173
174
175
176
180
181
182
183
187
188
189
190
191
192
195#if defined(V8_COMPRESS_POINTERS) &&
196 !defined(V8_COMPRESS_POINTERS_IN_SHARED_CAGE)
198
199
200
201
202
203
204
205
206
212
213
214
215
216
217
218
219
220
225
226
230
231
235
236
237
238
239
240
242 Isolate* isolate, size_t byte_length,
247
248
249
250
251
253 Isolate* isolate, size_t byte_length,
258
259
260
261
262
263
264
265
266
267
268
273
274
275
276
277
278
279
280
281
282
283
284
285
286
288 Isolate* isolate, size_t byte_length,
295
296
297
298
299
300
301
303 void* data, size_t byte_length,
v8::
BackingStore::DeleterCallback deleter,
307
308
309
310
311
312
313
314
315
316
317
319 size_t byte_length, size_t max_byte_length);
322
323
327
328
332
333
334
335
336
338 "Use the version which takes a key parameter (passing a null handle is "
343
344
345
346
347
348
349
353
354
358
359
360
361
362
363
364
365
369
370
371
375
376
377
381#ifdef V8_ENABLE_CHECKS
394#elif V8_HOST_ARCH_32_BIT
404 static void CheckCast(
Value* obj);
408#ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
410#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
414
415
416
420
421
424
425
428
429
433
434
435
436
437
438
439
440
444
445
446
447
448
449
450
454
455
456
460#ifdef V8_ENABLE_CHECKS
472 static void CheckCast(
Value* obj);
476
477
481 size_t byte_offset, size_t length);
483 size_t byte_offset, size_t length);
485#ifdef V8_ENABLE_CHECKS
488 return static_cast<
DataView*>(value);
493 static void CheckCast(
Value* obj);
497
498
502
503
507
508
512
513
514
515
516
518 Isolate* isolate, size_t byte_length,
523
524
525
526
527
528
530 Isolate* isolate, size_t byte_length,
535
536
537
538
539
540
541
542
543
544
545
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
566 Isolate* isolate, size_t byte_length,
573
574
575
576
577
578
579
581 void* data, size_t byte_length,
v8::
BackingStore::DeleterCallback deleter,
585
586
587
588
589
593
594
595
599#ifdef V8_ENABLE_CHECKS
610 static void CheckCast(
Value* obj);
static Allocator * NewDefaultAllocator()
virtual void * AllocateUninitialized(size_t length)=0
virtual size_t MaxAllocationSize() const
virtual ~Allocator()=default
virtual void Free(void *data, size_t length)=0
virtual void * Allocate(size_t length)=0
virtual PageAllocator * GetPageAllocator()
static constexpr int kEmbedderFieldCount
static Local< ArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
static V8_INLINE ArrayBuffer * Cast(Value *value)
size_t MaxByteLength() const
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
bool IsDetachable() const
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized, BackingStoreOnFailureMode on_failure=BackingStoreOnFailureMode::kOutOfMemory)
static constexpr size_t kMaxByteLength
static constexpr int kInternalFieldCount
std::shared_ptr< BackingStore > GetBackingStore()
size_t ByteLength() const
void SetDetachKey(v8::Local< v8::Value > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Detach(v8::Local< v8::Value > key)
bool IsResizableByUserJavaScript() const
static std::unique_ptr< BackingStore > NewResizableBackingStore(size_t byte_length, size_t max_byte_length)
static MaybeLocal< ArrayBuffer > MaybeNew(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
v8::MemorySpan< uint8_t > GetContents(v8::MemorySpan< uint8_t > storage)
Local< ArrayBuffer > Buffer()
static const int kEmbedderFieldCount
size_t CopyContents(void *dest, size_t byte_length)
static constexpr int kInternalFieldCount
static V8_INLINE ArrayBufferView * Cast(Value *value)
size_t MaxByteLength() const
void operator delete(void *ptr)
static void EmptyDeleter(void *data, size_t length, void *deleter_data)
size_t ByteLength() const
bool IsResizableByUserJavaScript() const
static Local< DataView > New(Local< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static V8_INLINE DataView * Cast(Value *value)
static Local< DataView > New(Local< SharedArrayBuffer > shared_array_buffer, size_t byte_offset, size_t length)
static Local< SharedArrayBuffer > New(Isolate *isolate, std::shared_ptr< BackingStore > backing_store)
size_t MaxByteLength() const
static std::unique_ptr< BackingStore > NewBackingStore(void *data, size_t byte_length, v8::BackingStore::DeleterCallback deleter, void *deleter_data)
static MaybeLocal< SharedArrayBuffer > MaybeNew(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
static std::unique_ptr< BackingStore > NewBackingStore(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized, BackingStoreOnFailureMode on_failure=BackingStoreOnFailureMode::kOutOfMemory)
static V8_INLINE SharedArrayBuffer * Cast(Value *value)
static constexpr int kInternalFieldCount
static Local< SharedArrayBuffer > New(Isolate *isolate, size_t byte_length, BackingStoreInitializationMode initialization_mode=BackingStoreInitializationMode::kZeroInitialized)
std::shared_ptr< BackingStore > GetBackingStore()
size_t ByteLength() const
BackingStoreOnFailureMode
BackingStoreInitializationMode
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
#define V8_DEPRECATED(message)
#define V8_WARN_UNUSED_RESULT