Sha256: 691a4e94328a49266da6976b5e6a6d86a7b0e4539573593a3a2637f8188f0585

Contents?: true

Size: 709 Bytes

Versions: 16

Compression:

Stored size: 709 Bytes

Contents

#ifndef _RUBY_V8_REF_
#define _RUBY_V8_REF_

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

//the v8_ref wraps a v8 handle so that ruby can hold a reference to it.

struct v8_ref  {
  //takes a handle object and adds a new persistent handle for 
  //the referenced object
  v8_ref(v8::Handle<void> object);
  virtual ~v8_ref();
  void set(const char *name, VALUE ref);
  v8::Persistent<void> handle;
  VALUE references;
};

void rr_v8_ref_setref(VALUE handle, const char *name, VALUE ref);
VALUE rr_v8_ref_create(VALUE rbclass, v8::Handle<void> handle);

template <class T> v8::Local<T> V8_Ref_Get(VALUE object) {
  v8_ref* ref = 0;
  Data_Get_Struct(object, struct v8_ref, ref); 
  return (T *)*ref->handle;  
}

#endif

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
therubyracer-0.8.2 ext/v8/v8_ref.h
therubyracer-0.8.2.pre2 ext/v8/v8_ref.h
therubyracer-0.8.2.pre ext/v8/v8_ref.h
therubyracer-0.8.1 ext/v8/v8_ref.h
therubyracer-0.8.1.pre2 ext/v8/v8_ref.h
therubyracer-heroku-0.8.1.pre3 ext/v8/v8_ref.h
therubyracer-heroku-0.8.1.pre2 ext/v8/v8_ref.h
therubyracer-0.8.1.pre1 ext/v8/v8_ref.h
therubyracer-0.8.0 ext/v8/v8_ref.h
therubyracer-0.8.0.pre3 ext/v8/v8_ref.h
therubyracer-0.8.0.pre2 ext/v8/v8_ref.h
therubyracer-0.8.0.pre ext/v8/v8_ref.h
therubyracer-0.7.5 ext/v8/v8_ref.h
therubyracer-0.7.4 ext/v8/v8_ref.h
therubyracer-0.7.3 ext/v8/v8_ref.h
therubyracer-0.7.2 ext/v8/v8_ref.h