1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/isolate.h
Georgy Angelov d1e9088cf0 Port a ton of the original ext classes
You can now create a JS object from Ruby-land without segfaulting
2015-03-20 20:47:57 +00:00

34 lines
911 B
C++

#ifndef RR_ISOLATE
#define RR_ISOLATE
namespace rr {
class Isolate : public Pointer<v8::Isolate> {
public:
static void Init();
static VALUE New(VALUE self);
static VALUE Enter(VALUE self);
static VALUE Exit(VALUE self);
static VALUE GetCurrent(VALUE self);
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?
// isolate->Dispose();
}
};
}
#endif