| 297 | } |
| 298 | |
| 299 | v8::Local<v8::Object> makeLocal() { |
| 300 | auto isolate = m_engine.get<V8Engine>()->m_isolate; |
| 301 | if (!m_local.IsEmpty()) |
| 302 | return m_local.Get(isolate); |
| 303 | auto local = v8::Object::New(isolate); |
| 304 | pushFunctions(local); |
| 305 | pushProperties(local); |
| 306 | m_local.Reset(isolate, local); |
| 307 | m_local.SetWeak(this, [](const auto& info) { |
| 308 | reinterpret_cast<V8ScriptObject*>(info.GetParameter())->release(); |
| 309 | }, v8::WeakCallbackType::kParameter); |
| 310 | return local; |
| 311 | } |
| 312 | |
| 313 | void release() { |
| 314 | m_local.ClearWeak(); |