2011-04-07 11:49:47 -05:00
|
|
|
#ifndef _RR_V8_HANDLE_
|
|
|
|
#define _RR_V8_HANDLE_
|
|
|
|
|
2011-04-08 09:54:57 -05:00
|
|
|
#include <v8.h>
|
|
|
|
#include "ruby.h"
|
|
|
|
|
|
|
|
struct v8_handle {
|
|
|
|
v8_handle(v8::Handle<void> object);
|
|
|
|
virtual ~v8_handle();
|
2011-04-12 10:50:09 -05:00
|
|
|
|
2011-04-08 09:54:57 -05:00
|
|
|
v8::Persistent<void> handle;
|
2011-04-12 10:50:09 -05:00
|
|
|
bool dead;
|
2011-05-02 21:54:03 -05:00
|
|
|
VALUE weakref_callback;
|
|
|
|
VALUE weakref_callback_parameters;
|
2011-04-08 09:54:57 -05:00
|
|
|
};
|
|
|
|
|
2011-04-07 11:49:47 -05:00
|
|
|
void rr_init_handle();
|
2011-04-08 09:54:57 -05:00
|
|
|
|
2011-04-12 10:50:09 -05:00
|
|
|
v8_handle* rr_v8_handle_raw(VALUE value);
|
|
|
|
|
2011-04-08 09:54:57 -05:00
|
|
|
template <class T> v8::Persistent<T>& rr_v8_handle(VALUE value) {
|
2011-04-12 10:50:09 -05:00
|
|
|
return (v8::Persistent<T>&)(rr_v8_handle_raw(value)->handle);
|
2011-04-08 09:54:57 -05:00
|
|
|
}
|
|
|
|
VALUE rr_v8_handle_new(VALUE rbclass, v8::Handle<void> handle);
|
2011-04-11 10:02:42 -05:00
|
|
|
VALUE rr_v8_handle_class();
|
2011-04-07 11:49:47 -05:00
|
|
|
|
|
|
|
#endif
|