Skip to content

Commit 361f446

Browse files
committed
0.10 compat (remove isolates from 0.11 code)
1 parent 4cfadb2 commit 361f446

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

9_async_work/async.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ void AsyncWork(uv_work_t *req) {
2929
// this function will be run inside the main event loop
3030
// so it is safe to use V8 again
3131
void AsyncAfter(uv_work_t *req) {
32-
Isolate* isolate = Isolate::GetCurrent();
33-
HandleScope scope(isolate);
32+
HandleScope scope;
3433

3534
// fetch our data structure
3635
AsyncData *asyncData = (AsyncData *)req->data;
3736
// create an arguments array for the callback
3837
Handle<Value> argv[] = {
3938
Null(),
40-
Number::New(isolate, asyncData->estimate)
39+
Number::New(asyncData->estimate)
4140
};
4241

4342
// surround in a try/catch for safety
@@ -49,16 +48,15 @@ void AsyncAfter(uv_work_t *req) {
4948

5049
// dispose the Persistent handle so the callback
5150
// function can be garbage-collected
52-
asyncData->callback.Dispose(isolate);
51+
asyncData->callback.Dispose();
5352
// clean up any memory we allocated
5453
delete asyncData;
5554
delete req;
5655
}
5756

5857
// Asynchronous access to the `Estimate()` function
5958
Handle<Value> CalculateAsync(const Arguments& args) {
60-
Isolate* isolate = Isolate::GetCurrent();
61-
HandleScope scope(isolate);
59+
HandleScope scope;
6260

6361
// create an async work token
6462
uv_work_t *req = new uv_work_t;
@@ -71,7 +69,7 @@ Handle<Value> CalculateAsync(const Arguments& args) {
7169
// expect a function as the second argument
7270
// we create a Persistent reference to it so
7371
// it won't be garbage-collected
74-
asyncData->callback = Persistent<Function>::New(isolate,
72+
asyncData->callback = Persistent<Function>::New(
7573
Local<Function>::Cast(args[1]));
7674

7775
// pass the work token to libuv to be run when a

9_async_work/sync.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ using namespace v8;
66

77
// Simple synchronous access to the `Estimate()` function
88
Handle<Value> CalculateSync(const Arguments& args) {
9-
Isolate* isolate = Isolate::GetCurrent();
10-
HandleScope scope(isolate);
9+
HandleScope scope;
1110

1211
// expect a number as the first argument
1312
int points = args[0]->Uint32Value();

0 commit comments

Comments
 (0)