1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/v8_ref.h

27 lines
No EOL
630 B
C++

#ifndef _RUBY_V8_REF_
#define _RUBY_V8_REF_
#include <v8.h>
#include "ruby.h"
struct v8_ref {
//takes a handle object and adds a new persistent handle for
//the referenced object
v8_ref(v8::Handle<void> object, VALUE ref = 0);
virtual ~v8_ref();
void add(VALUE ref);
v8::Persistent<void> handle;
VALUE references;
};
void rr_ref_addref(VALUE handle, VALUE newref);
VALUE V8_Ref_Create(VALUE ruby_class, v8::Handle<void> handle, VALUE ref = 0);
template <class T> v8::Local<T> V8_Ref_Get(VALUE object) {
v8_ref* ref = 0;
Data_Get_Struct(object, struct v8_ref, ref);
return (T *)*ref->handle;
}
#endif