mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
Ok C++, are you satisfied now?
This commit is contained in:
parent
2fac2cdb5f
commit
b9be3ec122
5 changed files with 19 additions and 18 deletions
|
@ -46,4 +46,7 @@ namespace rr {
|
|||
// // Sets an address beyond which the VM's stack may not grow.
|
||||
// void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
|
||||
|
||||
template <> void Pointer<v8::ResourceConstraints>::unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ResourceConstraints, pointer);
|
||||
}
|
||||
}
|
|
@ -118,4 +118,8 @@ VALUE Context::Exit(VALUE self) {
|
|||
Void(Context(self)->Exit());
|
||||
}
|
||||
|
||||
template <> void Pointer<v8::ExtensionConfiguration>::unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ExtensionConfiguration, pointer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace rr {
|
|||
defineMethod("heap_size_limit", &heap_size_limit).
|
||||
store(&Class);
|
||||
}
|
||||
|
||||
VALUE HeapStatistics::initialize(VALUE self) {
|
||||
return HeapStatistics(new v8::HeapStatistics());
|
||||
}
|
||||
|
@ -34,4 +33,7 @@ namespace rr {
|
|||
VALUE HeapStatistics::heap_size_limit(VALUE self) {
|
||||
return SIZET2NUM(HeapStatistics(self)->heap_size_limit());
|
||||
}
|
||||
template <> void Pointer<v8::HeapStatistics>::unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::HeapStatistics, pointer);
|
||||
}
|
||||
}
|
18
ext/v8/rr.h
18
ext/v8/rr.h
|
@ -93,16 +93,15 @@ public:
|
|||
this->pointer = NULL;
|
||||
}
|
||||
};
|
||||
inline Pointer() {};
|
||||
inline operator T*() {return pointer;}
|
||||
inline T* operator ->() {return pointer;}
|
||||
inline operator VALUE() {
|
||||
return Data_Wrap_Struct(Class, 0, &release, pointer);
|
||||
}
|
||||
void unwrap(VALUE value);
|
||||
static void release(T* pointer) {
|
||||
delete pointer;
|
||||
}
|
||||
virtual void unwrap(VALUE v) = 0;
|
||||
static VALUE Class;
|
||||
protected:
|
||||
T* pointer;
|
||||
|
@ -220,9 +219,6 @@ public:
|
|||
static VALUE initialize(VALUE self, VALUE names);
|
||||
inline ExtensionConfiguration(v8::ExtensionConfiguration* config) : Pointer<v8::ExtensionConfiguration>(config) {}
|
||||
inline ExtensionConfiguration(VALUE value) : Pointer<v8::ExtensionConfiguration>(value) {}
|
||||
virtual void unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ExtensionConfiguration, pointer);
|
||||
}
|
||||
};
|
||||
|
||||
class Context : public Ref<v8::Context> {
|
||||
|
@ -274,9 +270,6 @@ class ScriptOrigin : public Pointer<v8::ScriptOrigin> {
|
|||
public:
|
||||
inline ScriptOrigin(v8::ScriptOrigin* o) : Pointer<v8::ScriptOrigin>(o) {};
|
||||
inline ScriptOrigin(VALUE value) : Pointer<v8::ScriptOrigin>(value) {}
|
||||
virtual void unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ScriptOrigin, pointer);
|
||||
}
|
||||
|
||||
static VALUE initialize(int argc, VALUE argv[], VALUE self);
|
||||
};
|
||||
|
@ -285,9 +278,6 @@ class ScriptData : public Pointer<v8::ScriptData> {
|
|||
public:
|
||||
inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
|
||||
inline ScriptData(VALUE value) : Pointer<v8::ScriptData>(value) {}
|
||||
virtual void unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ScriptData, pointer);
|
||||
}
|
||||
|
||||
static VALUE PreCompile(VALUE self, VALUE input, VALUE length);
|
||||
static VALUE New(VALUE self, VALUE data, VALUE length);
|
||||
|
@ -754,9 +744,6 @@ public:
|
|||
|
||||
inline HeapStatistics(v8::HeapStatistics* stats) : Pointer<v8::HeapStatistics>(stats) {}
|
||||
inline HeapStatistics(VALUE value) : Pointer<v8::HeapStatistics>(value) {}
|
||||
virtual void unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::HeapStatistics, pointer);
|
||||
}
|
||||
};
|
||||
|
||||
class ResourceConstraints : Pointer<v8::ResourceConstraints> {
|
||||
|
@ -774,9 +761,6 @@ public:
|
|||
|
||||
inline ResourceConstraints(v8::ResourceConstraints* o) : Pointer<v8::ResourceConstraints>(o) {};
|
||||
inline ResourceConstraints(VALUE value) : Pointer<v8::ResourceConstraints>(value) {}
|
||||
virtual void unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ResourceConstraints, pointer);
|
||||
}
|
||||
};
|
||||
|
||||
class Constants {
|
||||
|
|
|
@ -69,4 +69,12 @@ VALUE Script::Run(VALUE self) {
|
|||
return Value(Script(self)->Run());
|
||||
}
|
||||
|
||||
template <> void Pointer<v8::ScriptData>::unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ScriptData, pointer);
|
||||
}
|
||||
|
||||
template <> void Pointer<v8::ScriptOrigin>::unwrap(VALUE value) {
|
||||
Data_Get_Struct(value, class v8::ScriptOrigin, pointer);
|
||||
}
|
||||
|
||||
} //namespace rr
|
Loading…
Reference in a new issue