2015-03-18 21:50:59 +00:00
|
|
|
#ifndef RR_ISOLATE
|
|
|
|
#define RR_ISOLATE
|
|
|
|
|
|
|
|
namespace rr {
|
|
|
|
|
|
|
|
class Isolate : public Pointer<v8::Isolate> {
|
|
|
|
public:
|
|
|
|
static void Init();
|
2015-03-21 09:51:17 +00:00
|
|
|
|
2015-03-18 21:50:59 +00:00
|
|
|
static VALUE New(VALUE self);
|
|
|
|
|
2015-03-21 09:51:17 +00:00
|
|
|
// TODO: Add a Dispose method
|
|
|
|
|
2015-03-18 21:50:59 +00:00
|
|
|
inline Isolate(v8::Isolate* isolate) : Pointer<v8::Isolate>(isolate) {}
|
|
|
|
inline Isolate(VALUE value) : Pointer<v8::Isolate>(value) {}
|
|
|
|
|
|
|
|
inline operator VALUE() {
|
|
|
|
return Data_Wrap_Struct(Class, 0, &release, pointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void release(v8::Isolate* isolate) {
|
|
|
|
// The isolates must be released with Dispose.
|
|
|
|
// Using the delete operator is not allowed.
|
|
|
|
|
|
|
|
// TODO: Do we want to dispose of the isolate when the object itself
|
|
|
|
// is garbage-collected?
|
|
|
|
// Can the isolate be used without it having a reference in ruby world?
|
2015-03-20 20:47:57 +00:00
|
|
|
// isolate->Dispose();
|
2015-03-18 21:50:59 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|