From 14a19421d213500b0562cc17ffcd3b671461879d Mon Sep 17 00:00:00 2001 From: Infinite Whiteboard Date: Wed, 10 Jul 2013 15:31:23 +0200 Subject: [PATCH] Patch for Node 0.11.3 --- src/Canvas.cc | 22 +++++++++++----------- src/CanvasGradient.cc | 2 +- src/CanvasPattern.cc | 2 +- src/CanvasRenderingContext2d.cc | 2 +- src/FontFace.cc | 2 +- src/Image.cc | 6 +++--- src/ImageData.cc | 2 +- src/JPEGStream.h | 12 ++++++------ src/PixelArray.cc | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Canvas.cc b/src/Canvas.cc index 4cb0fa4..ddb2d0c 100644 --- a/src/Canvas.cc +++ b/src/Canvas.cc @@ -29,7 +29,7 @@ Canvas::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(Canvas::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(Canvas::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("Canvas")); @@ -202,9 +202,9 @@ Canvas::EIO_AfterToBuffer(eio_req *req) { Local argv[1] = { Canvas::Error(closure->status) }; closure->pfn->Call(Context::GetCurrent()->Global(), 1, argv); } else { - Buffer *buf = Buffer::New(closure->len); + Local buf = Buffer::New(closure->len); memcpy(Buffer::Data(buf), closure->data, closure->len); - Local argv[2] = { Local::New(Null()), Local::New(buf->handle_) }; + Local argv[2] = { Local::New(Null()), Local::New(buf) }; closure->pfn->Call(Context::GetCurrent()->Global(), 2, argv); } @@ -233,9 +233,9 @@ Canvas::ToBuffer(const Arguments &args) { if (canvas->isPDF()) { cairo_surface_finish(canvas->surface()); closure_t *closure = (closure_t *) canvas->closure(); - Buffer *buf = Buffer::New(closure->len); + Local buf = Buffer::New(closure->len); memcpy(Buffer::Data(buf), closure->data, closure->len); - return buf->handle_; + return buf; } // Async @@ -252,7 +252,7 @@ Canvas::ToBuffer(const Arguments &args) { // TODO: only one callback fn in closure canvas->Ref(); - closure->pfn = Persistent::New(Handle::Cast(args[0])); + closure->pfn = Persistent::New(Isolate::GetCurrent(), Handle::Cast(args[0])); #if NODE_VERSION_AT_LEAST(0, 6, 0) uv_work_t* req = new uv_work_t; @@ -285,10 +285,10 @@ Canvas::ToBuffer(const Arguments &args) { closure_destroy(&closure); return ThrowException(Canvas::Error(status)); } else { - Buffer *buf = Buffer::New(closure.len); + Local buf = Buffer::New(closure.len); memcpy(Buffer::Data(buf), closure.data, closure.len); closure_destroy(&closure); - return buf->handle_; + return buf; } } } @@ -301,11 +301,11 @@ static cairo_status_t streamPNG(void *c, const uint8_t *data, unsigned len) { HandleScope scope; closure_t *closure = (closure_t *) c; - Local buf = Buffer::New(len); - memcpy(Buffer::Data(buf->handle_), data, len); + Local buf = Buffer::New(len); + memcpy(Buffer::Data(buf), data, len); Local argv[3] = { Local::New(Null()) - , Local::New(buf->handle_) + , Local::New(buf) , Integer::New(len) }; closure->fn->Call(Context::GetCurrent()->Global(), 3, argv); return CAIRO_STATUS_SUCCESS; diff --git a/src/CanvasGradient.cc b/src/CanvasGradient.cc index 0686cfc..7f6914f 100644 --- a/src/CanvasGradient.cc +++ b/src/CanvasGradient.cc @@ -20,7 +20,7 @@ Gradient::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(Gradient::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(Gradient::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("CanvasGradient")); diff --git a/src/CanvasPattern.cc b/src/CanvasPattern.cc index 8802735..1c19e24 100644 --- a/src/CanvasPattern.cc +++ b/src/CanvasPattern.cc @@ -20,7 +20,7 @@ Pattern::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(Pattern::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(Pattern::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("CanvasPattern")); diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 4e9630f..adb948d 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -81,7 +81,7 @@ Context2d::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(Context2d::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(Context2d::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("CanvasRenderingContext2d")); diff --git a/src/FontFace.cc b/src/FontFace.cc index c359069..0d2cef0 100644 --- a/src/FontFace.cc +++ b/src/FontFace.cc @@ -28,7 +28,7 @@ FontFace::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(FontFace::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(FontFace::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("FontFace")); diff --git a/src/Image.cc b/src/Image.cc index 90cd2c2..6e19ed1 100644 --- a/src/Image.cc +++ b/src/Image.cc @@ -39,7 +39,7 @@ Image::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(Image::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(Image::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("Image")); @@ -274,7 +274,7 @@ void Image::SetOnload(Local, Local val, const AccessorInfo &info) { if (val->IsFunction()) { Image *img = ObjectWrap::Unwrap(info.This()); - img->onload = Persistent::New(Handle::Cast(val)); + img->onload = Persistent::New(Isolate::GetCurrent(), Handle::Cast(val)); } } @@ -296,7 +296,7 @@ void Image::SetOnerror(Local, Local val, const AccessorInfo &info) { if (val->IsFunction()) { Image *img = ObjectWrap::Unwrap(info.This()); - img->onerror = Persistent::New(Handle::Cast(val)); + img->onerror = Persistent::New(Isolate::GetCurrent(), Handle::Cast(val)); } } diff --git a/src/ImageData.cc b/src/ImageData.cc index 0a814f9..13480b8 100644 --- a/src/ImageData.cc +++ b/src/ImageData.cc @@ -18,7 +18,7 @@ ImageData::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(ImageData::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(ImageData::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("ImageData")); diff --git a/src/JPEGStream.h b/src/JPEGStream.h index 48ed5f0..2f4658c 100644 --- a/src/JPEGStream.h +++ b/src/JPEGStream.h @@ -30,11 +30,11 @@ init_closure_destination(j_compress_ptr cinfo){ boolean empty_closure_output_buffer(j_compress_ptr cinfo){ closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; - Local buf = Buffer::New(dest->bufsize); - memcpy(Buffer::Data(buf->handle_), dest->buffer, dest->bufsize); + Local buf = Buffer::New(dest->bufsize); + memcpy(Buffer::Data(buf), dest->buffer, dest->bufsize); Local argv[3] = { Local::New(Null()) - , Local::New(buf->handle_) + , Local::New(buf) , Integer::New(dest->bufsize) }; dest->closure->fn->Call(Context::GetCurrent()->Global(), 3, argv); @@ -48,12 +48,12 @@ term_closure_destination(j_compress_ptr cinfo){ closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; /* emit remaining data */ size_t remaining = dest->bufsize - cinfo->dest->free_in_buffer; - Local buf = Buffer::New(remaining); - memcpy(Buffer::Data(buf->handle_), dest->buffer, remaining); + Local buf = Buffer::New(remaining); + memcpy(Buffer::Data(buf), dest->buffer, remaining); Local data_argv[3] = { Local::New(Null()) - , Local::New(buf->handle_) + , Local::New(buf) , Integer::New(remaining) }; diff --git a/src/PixelArray.cc b/src/PixelArray.cc index 007e8f9..c5ff585 100644 --- a/src/PixelArray.cc +++ b/src/PixelArray.cc @@ -20,7 +20,7 @@ PixelArray::Initialize(Handle target) { HandleScope scope; // Constructor - constructor = Persistent::New(FunctionTemplate::New(PixelArray::New)); + constructor = Persistent::New(Isolate::GetCurrent(), FunctionTemplate::New(PixelArray::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(String::NewSymbol("CanvasPixelArray"));