Browse Source

Patch for Node 0.11.3

v1.x
Infinite Whiteboard 12 years ago
parent
commit
14a19421d2
  1. 22
      src/Canvas.cc
  2. 2
      src/CanvasGradient.cc
  3. 2
      src/CanvasPattern.cc
  4. 2
      src/CanvasRenderingContext2d.cc
  5. 2
      src/FontFace.cc
  6. 6
      src/Image.cc
  7. 2
      src/ImageData.cc
  8. 12
      src/JPEGStream.h
  9. 2
      src/PixelArray.cc

22
src/Canvas.cc

@ -29,7 +29,7 @@ Canvas::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Canvas::New));
constructor = Persistent<FunctionTemplate>::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<Value> argv[1] = { Canvas::Error(closure->status) };
closure->pfn->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
Buffer *buf = Buffer::New(closure->len);
Local<Object> buf = Buffer::New(closure->len);
memcpy(Buffer::Data(buf), closure->data, closure->len);
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(buf->handle_) };
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::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<Object> 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<Function>::New(Handle<Function>::Cast(args[0]));
closure->pfn = Persistent<Function>::New(Isolate::GetCurrent(), Handle<Function>::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<Object> 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<Buffer> buf = Buffer::New(len);
memcpy(Buffer::Data(buf->handle_), data, len);
Local<Object> buf = Buffer::New(len);
memcpy(Buffer::Data(buf), data, len);
Local<Value> argv[3] = {
Local<Value>::New(Null())
, Local<Value>::New(buf->handle_)
, Local<Value>::New(buf)
, Integer::New(len) };
closure->fn->Call(Context::GetCurrent()->Global(), 3, argv);
return CAIRO_STATUS_SUCCESS;

2
src/CanvasGradient.cc

@ -20,7 +20,7 @@ Gradient::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Gradient::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(Gradient::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("CanvasGradient"));

2
src/CanvasPattern.cc

@ -20,7 +20,7 @@ Pattern::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Pattern::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(Pattern::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("CanvasPattern"));

2
src/CanvasRenderingContext2d.cc

@ -81,7 +81,7 @@ Context2d::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Context2d::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(Context2d::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("CanvasRenderingContext2d"));

2
src/FontFace.cc

@ -28,7 +28,7 @@ FontFace::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(FontFace::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(FontFace::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("FontFace"));

6
src/Image.cc

@ -39,7 +39,7 @@ Image::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Image::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(Image::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("Image"));
@ -274,7 +274,7 @@ void
Image::SetOnload(Local<String>, Local<Value> val, const AccessorInfo &info) {
if (val->IsFunction()) {
Image *img = ObjectWrap::Unwrap<Image>(info.This());
img->onload = Persistent<Function>::New(Handle<Function>::Cast(val));
img->onload = Persistent<Function>::New(Isolate::GetCurrent(), Handle<Function>::Cast(val));
}
}
@ -296,7 +296,7 @@ void
Image::SetOnerror(Local<String>, Local<Value> val, const AccessorInfo &info) {
if (val->IsFunction()) {
Image *img = ObjectWrap::Unwrap<Image>(info.This());
img->onerror = Persistent<Function>::New(Handle<Function>::Cast(val));
img->onerror = Persistent<Function>::New(Isolate::GetCurrent(), Handle<Function>::Cast(val));
}
}

2
src/ImageData.cc

@ -18,7 +18,7 @@ ImageData::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(ImageData::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(ImageData::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("ImageData"));

12
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<Buffer> buf = Buffer::New(dest->bufsize);
memcpy(Buffer::Data(buf->handle_), dest->buffer, dest->bufsize);
Local<Object> buf = Buffer::New(dest->bufsize);
memcpy(Buffer::Data(buf), dest->buffer, dest->bufsize);
Local<Value> argv[3] = {
Local<Value>::New(Null())
, Local<Value>::New(buf->handle_)
, Local<Value>::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<Buffer> buf = Buffer::New(remaining);
memcpy(Buffer::Data(buf->handle_), dest->buffer, remaining);
Local<Object> buf = Buffer::New(remaining);
memcpy(Buffer::Data(buf), dest->buffer, remaining);
Local<Value> data_argv[3] = {
Local<Value>::New(Null())
, Local<Value>::New(buf->handle_)
, Local<Value>::New(buf)
, Integer::New(remaining)
};

2
src/PixelArray.cc

@ -20,7 +20,7 @@ PixelArray::Initialize(Handle<Object> target) {
HandleScope scope;
// Constructor
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(PixelArray::New));
constructor = Persistent<FunctionTemplate>::New(Isolate::GetCurrent(), FunctionTemplate::New(PixelArray::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("CanvasPixelArray"));

Loading…
Cancel
Save