Sha256: a22273e1a2c519d31b33b9e03cb67ab680ec42e415464ef98d95692b8a7c06df

Contents?: true

Size: 1.13 KB

Versions: 65

Compression:

Stored size: 1.13 KB

Contents

#ifndef _RR_V8_HANDLE_
#define _RR_V8_HANDLE_

#include <v8.h>
#include "ruby.h"

/**
* 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.
*/
struct v8_handle  {

  /**
  * Contains the *actual* V8 references. This object is kept
  * separate so that it can be "detached" from the handle when
  * it is garbage collected, and enqueued separately and
  * collected in the context of a V8 thread.
  */

  struct Payload {
    Payload(v8::Handle<void> object);
    virtual ~Payload();
    void release();
    static void destroy(v8_handle::Payload* payload);
    v8::Persistent<void> handle;
    VALUE wrapper;
  };

  v8_handle(v8::Handle<void> object);
  virtual ~v8_handle();

  Payload* payload;
  bool dead;
  VALUE weakref_callback;
  VALUE weakref_callback_parameters;
};

void rr_init_handle();

v8_handle* rr_v8_handle_raw(VALUE value);

template <class T> v8::Persistent<T>& rr_v8_handle(VALUE value) {
  return (v8::Persistent<T>&)(rr_v8_handle_raw(value)->payload->handle);
}
VALUE rr_v8_handle_new(VALUE rbclass, v8::Handle<void> handle);
VALUE rr_v8_handle_class();

#endif

Version data entries

65 entries across 65 versions & 5 rubygems

Version Path
therubyracer-0.9.6 ext/v8/v8_handle.h
therubyracer-0.9.5 ext/v8/v8_handle.h
therubyracer-0.9.4 ext/v8/v8_handle.h
therubyracer-0.9.3 ext/v8/v8_handle.h
therubyracer-0.9.3beta1 ext/v8/v8_handle.h