File tree 2 files changed +23
-20
lines changed
2 files changed +23
-20
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,15 @@ extern "C" {
130
130
131
131
static IsolatePtr globalIsolate = nullptr ;
132
132
133
+ // Clean up the global isolate
133
134
void YaoDispose () {
134
135
if (globalIsolate != nullptr ) {
135
136
globalIsolate->Dispose ();
136
137
globalIsolate = nullptr ;
137
138
}
138
139
}
139
140
141
+ // @todo: create from snapshot
140
142
IsolatePtr YaoNewIsolate () {
141
143
Isolate::CreateParams params;
142
144
params.array_buffer_allocator = default_allocator;
@@ -156,7 +158,7 @@ IsolatePtr YaoNewIsolate() {
156
158
return iso;
157
159
}
158
160
159
-
161
+ // @todo: Remove after snapshot works
160
162
IsolatePtr YaoNewIsolateFromGlobal () {
161
163
if (globalIsolate == nullptr ) {
162
164
return nullptr ;
@@ -166,6 +168,7 @@ IsolatePtr YaoNewIsolateFromGlobal() {
166
168
return ptr;
167
169
}
168
170
171
+ // @todo: use internal context, after snapshot works
169
172
ContextPtr YaoIsolateContext ( IsolatePtr iso ) {
170
173
if (iso == nullptr ) {
171
174
return nullptr ;
@@ -180,6 +183,7 @@ extern IsolatePtr YaoCopyIsolate( IsolatePtr iso ) {
180
183
}
181
184
182
185
186
+ // @todo: remove after snapshot works
183
187
// Should call in the main thread only
184
188
void YaoIsolateAsGlobal ( IsolatePtr iso ) {
185
189
if (globalIsolate != nullptr ) {
Original file line number Diff line number Diff line change @@ -54,22 +54,21 @@ func TestYaoIsolateContext(t *testing.T) {
54
54
}
55
55
}
56
56
57
- func TestYaoNewIsolateFromGlobal (t * testing.T ) {
58
- v8 .YaoInit (1024 )
59
- defer v8 .YaoDispose ()
60
-
61
- iso := v8 .YaoNewIsolate ()
62
- iso .AsGlobal ()
63
- iso .Dispose ()
64
- iso = nil
65
-
66
- new , err := v8 .YaoNewIsolateFromGlobal ()
67
- if err != nil {
68
- t .Error (err )
69
- }
70
-
71
- if new == nil {
72
- t .Errorf ("new is nil" )
73
- }
74
- defer new .Dispose ()
75
- }
57
+ // func TestYaoNewIsolateFromGlobal(t *testing.T) {
58
+ // v8.YaoInit(1024)
59
+ // defer v8.YaoDispose()
60
+
61
+ // iso := v8.YaoNewIsolate()
62
+ // iso.AsGlobal()
63
+ // iso.Dispose()
64
+
65
+ // new, err := v8.YaoNewIsolateFromGlobal()
66
+ // if err != nil {
67
+ // t.Error(err)
68
+ // }
69
+
70
+ // if new == nil {
71
+ // t.Errorf("new is nil")
72
+ // }
73
+ // defer new.Dispose()
74
+ // }
You can’t perform that action at this time.
0 commit comments