mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
2fca33f9d0
The functionality will be added (that is, if I don't get bored) one thing at a time with the spec. If you want to test, point the libv8 gem (in Gemfile) to its trunk branch & my changes at stormbreakerbg/libv8 @ trunk. What works currently is getting V8 to initialize, say its version and create a new Isolate.
31 lines
796 B
C++
31 lines
796 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);
|
|
|
|
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
|