@@ -21,6 +21,8 @@ static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
21
21
V8_CHECK_CONSTRUCTOR ();
22
22
V8_CHECK_ARGS_LEN (1 );
23
23
24
+ V8Helpers::SetObjectClass (info.GetIsolate (), info.This (), V8Class::ObjectClass::MEMORY_BUFFER);
25
+
24
26
// Ask alt:V to add pattern searching to C++ SDK if you want this available
25
27
// if(info[0]->IsString())
26
28
// {
@@ -38,16 +40,16 @@ static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
38
40
V8_ARG_TO_UINT (1 , size);
39
41
if (size == 0 )
40
42
{
41
- info.This ()->SetAlignedPointerInInternalField (0 , nullptr );
42
- info.This ()->SetInternalField (1 , V8Helpers::JSValue (0 ));
43
+ info.This ()->SetAlignedPointerInInternalField (1 , nullptr );
44
+ info.This ()->SetInternalField (2 , V8Helpers::JSValue (0 ));
43
45
return ;
44
46
}
45
47
V8_CHECK (size <= 1024 , " You can't allocate > 1KB" );
46
48
47
49
uint8_t * allocatedMemory = new uint8_t [size];
48
50
memset (allocatedMemory, 0 , size);
49
- info.This ()->SetAlignedPointerInInternalField (0 , allocatedMemory);
50
- info.This ()->SetInternalField (1 , V8Helpers::JSValue (size));
51
+ info.This ()->SetAlignedPointerInInternalField (1 , allocatedMemory);
52
+ info.This ()->SetInternalField (2 , V8Helpers::JSValue (size));
51
53
}
52
54
53
55
/* v8::Global<v8::Object> persistent(isolate, info.This());
@@ -170,7 +172,7 @@ static void GetDataOfType(const v8::FunctionCallbackInfo<v8::Value>& info)
170
172
extern V8Class v8MemoryBuffer (" MemoryBuffer" , Constructor, [](v8::Local<v8::FunctionTemplate> tpl) {
171
173
v8::Isolate* isolate = v8::Isolate::GetCurrent ();
172
174
173
- tpl->InstanceTemplate ()->SetInternalFieldCount (2 );
175
+ tpl->InstanceTemplate ()->SetInternalFieldCount (3 );
174
176
175
177
V8Helpers::SetAccessor (isolate, tpl, " size" , SizeGetter);
176
178
V8Helpers::SetAccessor (isolate, tpl, " address" , AddressGetter);
0 commit comments