File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
hello-world-function-export Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ struct async_req {
77 uv_work_t req;
88 int input;
99 int output;
10+ v8::Isolate* isolate;
1011 v8::Persistent<v8::Function> callback;
1112};
1213
@@ -17,9 +18,9 @@ void DoAsync(uv_work_t* r) {
1718}
1819
1920void AfterAsync (uv_work_t * r) {
20- v8::Isolate* isolate = v8::Isolate::GetCurrent ();
21- v8::HandleScope scope (isolate);
2221 async_req* req = reinterpret_cast <async_req*>(r->data );
22+ v8::Isolate* isolate = req->isolate ;
23+ v8::HandleScope scope (isolate);
2324
2425 v8::Handle<v8::Value> argv[2 ] = {
2526 v8::Null (isolate),
@@ -42,14 +43,15 @@ void AfterAsync(uv_work_t* r) {
4243}
4344
4445void Method (const v8::FunctionCallbackInfo<v8::Value>& args) {
45- v8::Isolate* isolate = v8::Isolate::GetCurrent ();
46+ v8::Isolate* isolate = args. GetIsolate ();
4647 v8::HandleScope scope (isolate);
4748
4849 async_req* req = new async_req;
4950 req->req .data = req;
5051
5152 req->input = args[0 ]->IntegerValue ();
5253 req->output = 0 ;
54+ req->isolate = isolate;
5355
5456 v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast (args[1 ]);
5557 req->callback .Reset (isolate, callback);
Original file line number Diff line number Diff line change @@ -16,10 +16,8 @@ static int at_exit_cb1_called = 0;
1616static int at_exit_cb2_called = 0 ;
1717
1818static void at_exit_cb1 (void * arg) {
19- // FIXME(bnoordhuis) Isolate::GetCurrent() is on its way out.
20- Isolate* isolate = Isolate::GetCurrent ();
19+ Isolate* isolate = static_cast <Isolate*>(arg);
2120 HandleScope handle_scope (isolate);
22- assert (arg == 0 );
2321 Local<Object> obj = Object::New (isolate);
2422 assert (!obj.IsEmpty ()); // Assert VM is still alive.
2523 assert (obj->IsObject ());
@@ -37,7 +35,7 @@ static void sanity_check(void) {
3735}
3836
3937void init (Handle<Object> target) {
40- AtExit (at_exit_cb1);
38+ AtExit (at_exit_cb1, target-> CreationContext ()-> GetIsolate () );
4139 AtExit (at_exit_cb2, cookie);
4240 AtExit (at_exit_cb2, cookie);
4341 atexit (sanity_check);
Original file line number Diff line number Diff line change 22#include < v8.h>
33
44void Method (const v8::FunctionCallbackInfo<v8::Value>& args) {
5- v8::Isolate* isolate = v8::Isolate::GetCurrent ();
5+ v8::Isolate* isolate = args. GetIsolate ();
66 v8::HandleScope scope (isolate);
77 args.GetReturnValue ().Set (v8::String::NewFromUtf8 (isolate, " world" ));
88}
Original file line number Diff line number Diff line change 22#include < v8.h>
33
44void Method (const v8::FunctionCallbackInfo<v8::Value>& args) {
5- v8::Isolate* isolate = v8::Isolate::GetCurrent ();
5+ v8::Isolate* isolate = args. GetIsolate ();
66 v8::HandleScope scope (isolate);
77 args.GetReturnValue ().Set (v8::String::NewFromUtf8 (isolate, " world" ));
88}
You can’t perform that action at this time.
0 commit comments