Skip to content

Commit 4e8371c

Browse files
committed
Remove unused code and add TODO comments for future improvements
1 parent bfd1e90 commit 4e8371c

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

v8go.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,15 @@ extern "C" {
130130

131131
static IsolatePtr globalIsolate = nullptr;
132132

133+
// Clean up the global isolate
133134
void YaoDispose() {
134135
if (globalIsolate != nullptr ) {
135136
globalIsolate->Dispose();
136137
globalIsolate = nullptr;
137138
}
138139
}
139140

141+
// @todo: create from snapshot
140142
IsolatePtr YaoNewIsolate() {
141143
Isolate::CreateParams params;
142144
params.array_buffer_allocator = default_allocator;
@@ -156,7 +158,7 @@ IsolatePtr YaoNewIsolate() {
156158
return iso;
157159
}
158160

159-
161+
// @todo: Remove after snapshot works
160162
IsolatePtr YaoNewIsolateFromGlobal() {
161163
if (globalIsolate == nullptr) {
162164
return nullptr;
@@ -166,6 +168,7 @@ IsolatePtr YaoNewIsolateFromGlobal() {
166168
return ptr;
167169
}
168170

171+
// @todo: use internal context, after snapshot works
169172
ContextPtr YaoIsolateContext( IsolatePtr iso ) {
170173
if (iso == nullptr) {
171174
return nullptr;
@@ -180,6 +183,7 @@ extern IsolatePtr YaoCopyIsolate( IsolatePtr iso ) {
180183
}
181184

182185

186+
// @todo: remove after snapshot works
183187
// Should call in the main thread only
184188
void YaoIsolateAsGlobal( IsolatePtr iso ) {
185189
if (globalIsolate != nullptr) {

yao_test.go

+18-19
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,21 @@ func TestYaoIsolateContext(t *testing.T) {
5454
}
5555
}
5656

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+
// }

0 commit comments

Comments
 (0)