Skip to content

Commit 5136a90

Browse files
committed
fix v8::Local<T>::GetIsolate deprecation
1 parent 6feda5c commit 5136a90

3 files changed

Lines changed: 3 additions & 14 deletions

File tree

generate/templates/manual/src/context.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace nodegit {
2828
: isolate(isolate)
2929
, threadPool(10, node::GetCurrentEventLoop(isolate), this)
3030
{
31-
Nan::HandleScope scopoe;
31+
Nan::HandleScope scope;
3232
v8::Local<v8::Object> storage = Nan::New<v8::Object>();
3333
persistentStorage.Reset(storage);
3434
contexts[isolate] = this;
@@ -45,9 +45,7 @@ namespace nodegit {
4545
}
4646

4747
Context *Context::GetCurrentContext() {
48-
Nan::HandleScope scope;
49-
v8::Local<v8::Context> context = Nan::GetCurrentContext();
50-
v8::Isolate *isolate = context->GetIsolate();
48+
v8::Isolate *isolate = v8::Isolate::GetCurrent();
5149
return contexts[isolate];
5250
}
5351

generate/templates/manual/src/thread_pool.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,6 @@ namespace nodegit {
657657

658658
// NOTE this should theoretically never be triggered during a cleanup operation
659659
void ThreadPoolImpl::RunLoopCallbacks() {
660-
Nan::HandleScope scope;
661-
v8::Local<v8::Context> context = Nan::GetCurrentContext();
662-
node::CallbackScope callbackScope(context->GetIsolate(), Nan::New<v8::Object>(), {0, 0});
663660

664661
std::unique_lock<std::mutex> lock(*jsThreadCallbackMutex);
665662
// get the next callback to run
@@ -719,10 +716,6 @@ namespace nodegit {
719716
orchestratorJobCondition.notify_all();
720717
}
721718

722-
Nan::HandleScope scope;
723-
v8::Local<v8::Context> context = Nan::GetCurrentContext();
724-
node::CallbackScope callbackScope(context->GetIsolate(), Nan::New<v8::Object>(), {0, 0});
725-
726719
while (cancelledJobs.size()) {
727720
std::shared_ptr<Orchestrator::Job> cancelledJob = cancelledJobs.front();
728721
std::shared_ptr<Orchestrator::AsyncWorkJob> asyncWorkJob = std::static_pointer_cast<Orchestrator::AsyncWorkJob>(cancelledJob);

generate/templates/templates/nodegit.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ NAN_MODULE_INIT(init) {
101101
, Nan::GetFunction(Nan::New<v8::FunctionTemplate>(GetNumberOfTrackedObjects)).ToLocalChecked()
102102
);
103103

104-
Nan::HandleScope scope;
105-
Local<Context> context = Nan::GetCurrentContext();
106-
Isolate *isolate = context->GetIsolate();
104+
Isolate *isolate = v8::Isolate::GetCurrent();
107105
nodegit::Context *nodegitContext = new nodegit::Context(isolate);
108106

109107
Wrapper::InitializeComponent(target, nodegitContext);

0 commit comments

Comments
 (0)