Sha256: c02263a74a2d9f5c07221c9fa32c063e9eebe9f32c76284fd7abed37b0cfb6cd

Contents?: true

Size: 715 Bytes

Versions: 35

Compression:

Stored size: 715 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, VALUE ref = 0);
  virtual ~v8_ref();
  v8::Persistent<void> handle;
  VALUE references;
};


//memory management
void v8_ref_mark(v8_ref* ref);
void v8_ref_free(v8_ref* ref);

VALUE V8_Ref_Create(VALUE ruby_class, v8::Handle<void> handle, VALUE ref = 0);

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

35 entries across 35 versions & 1 rubygems

Version Path
therubyracer-0.4.9-x86-darwin-9 ext/v8/v8_ref.h
therubyracer-0.4.9 ext/v8/v8_ref.h
therubyracer-0.4.8-x86-darwin-9 ext/v8/v8_ref.h
therubyracer-0.4.8-x86-darwin-10 ext/v8/v8_ref.h
therubyracer-0.4.8 ext/v8/v8_ref.h
therubyracer-0.4.7-x86-darwin-9 ext/v8/v8_ref.h
therubyracer-0.4.7-x86-darwin-10 ext/v8/v8_ref.h
therubyracer-0.4.7 ext/v8/v8_ref.h
therubyracer-0.4.6 ext/v8/v8_ref.h
therubyracer-0.4.5 ext/v8/v8_ref.h
therubyracer-0.4.4 ext/v8/v8_ref.h
therubyracer-0.4.3 ext/v8/v8_ref.h
therubyracer-0.4.2 ext/v8/v8_ref.h
therubyracer-0.4.1 ext/v8/v8_ref.h
therubyracer-0.4.0 ext/v8/v8_ref.h