@@ -423,27 +423,29 @@ static void OpenDirSync(const FunctionCallbackInfo<Value>& args) {
423423 args.GetReturnValue().Set(handle->object().As<Value>());
424424}
425425
426- void Initialize(Local<Object> target,
427- Local<Value> unused,
428- Local<Context> context,
429- void* priv) {
430- Environment* env = Environment::GetCurrent(context);
431- Isolate* isolate = env->isolate();
426+ void CreatePerIsolateProperties(IsolateData* isolate_data,
427+ Local<ObjectTemplate> target) {
428+ Isolate* isolate = isolate_data->isolate();
432429
433- SetMethod(context , target, "opendir", OpenDir);
434- SetMethod(context , target, "opendirSync", OpenDirSync);
430+ SetMethod(isolate , target, "opendir", OpenDir);
431+ SetMethod(isolate , target, "opendirSync", OpenDirSync);
435432
436433 // Create FunctionTemplate for DirHandle
437434 Local<FunctionTemplate> dir = NewFunctionTemplate(isolate, DirHandle::New);
438- dir->Inherit(AsyncWrap::GetConstructorTemplate(env ));
435+ dir->Inherit(AsyncWrap::GetConstructorTemplate(isolate_data ));
439436 SetProtoMethod(isolate, dir, "read", DirHandle::Read);
440437 SetProtoMethod(isolate, dir, "close", DirHandle::Close);
441438 Local<ObjectTemplate> dirt = dir->InstanceTemplate();
442439 dirt->SetInternalFieldCount(DirHandle::kInternalFieldCount);
443- SetConstructorFunction(context , target, "DirHandle", dir);
444- env ->set_dir_instance_template(dirt);
440+ SetConstructorFunction(isolate , target, "DirHandle", dir);
441+ isolate_data ->set_dir_instance_template(dirt);
445442}
446443
444+ void CreatePerContextProperties(Local<Object> target,
445+ Local<Value> unused,
446+ Local<Context> context,
447+ void* priv) {}
448+
447449void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
448450 registry->Register(OpenDir);
449451 registry->Register(OpenDirSync);
@@ -456,6 +458,8 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
456458
457459} // end namespace node
458460
459- NODE_BINDING_CONTEXT_AWARE_INTERNAL(fs_dir, node::fs_dir::Initialize)
461+ NODE_BINDING_CONTEXT_AWARE_INTERNAL(fs_dir,
462+ node::fs_dir::CreatePerContextProperties)
463+ NODE_BINDING_PER_ISOLATE_INIT(fs_dir, node::fs_dir::CreatePerIsolateProperties)
460464NODE_BINDING_EXTERNAL_REFERENCE(fs_dir,
461465 node::fs_dir::RegisterExternalReferences)
0 commit comments