mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
Add more handle documentation.
This commit is contained in:
parent
cc8ca3148d
commit
342ad808b3
2 changed files with 12 additions and 3 deletions
|
@ -6,7 +6,9 @@ using namespace v8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Persistent storage cell for `handle`
|
* Creates a new Persistent storage cell for `handle`
|
||||||
* so that we can reference it from Ruby.
|
* so that we can reference it from Ruby. Ruby metadat
|
||||||
|
* is contained on the handle object, and then the actual
|
||||||
|
* v8 references are contain in an instance of `Payload`
|
||||||
*/
|
*/
|
||||||
v8_handle::v8_handle(Handle<void> object) {
|
v8_handle::v8_handle(Handle<void> object) {
|
||||||
this->weakref_callback = Qnil;
|
this->weakref_callback = Qnil;
|
||||||
|
@ -17,6 +19,14 @@ v8_handle::v8_handle(Handle<void> object) {
|
||||||
|
|
||||||
v8_handle::~v8_handle() {}
|
v8_handle::~v8_handle() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new handle payload.
|
||||||
|
*
|
||||||
|
* Each payload contains a Ruby object wrapper so that it
|
||||||
|
* can be enqueued for V8 GC (the GC queue is a ruby Array)
|
||||||
|
* the wrapper is pre-allocated at payload creation time
|
||||||
|
* so that no Ruby objects are allocated during Ruby GC.
|
||||||
|
*/
|
||||||
v8_handle::Payload::Payload(Handle<void> object) {
|
v8_handle::Payload::Payload(Handle<void> object) {
|
||||||
rb_gc_register_address(&wrapper);
|
rb_gc_register_address(&wrapper);
|
||||||
handle = Persistent<void>::New(object);
|
handle = Persistent<void>::New(object);
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
/**
|
/**
|
||||||
* Holds a reference to a V8 heap object. This serves as the base
|
* Holds a reference to a V8 heap object. This serves as the base
|
||||||
* class for all of the low-level proxies that reference into V8.
|
* class for all of the low-level proxies that reference into V8.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
struct v8_handle {
|
struct v8_handle {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue