Mercurial > MadButterfly
diff nodejs/mbfly_njs.cc @ 559:ef078d7c57b4 Android_Skia
Use internal field to store njs_runtime_t object.
Instead of using named property to keep reference of njs_runtime_t
object, the internal field of v8 object is used.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 07 Jun 2010 11:42:45 +0800 |
parents | d61133da2845 |
children | a3c13c2a4792 |
line wrap: on
line diff
--- a/nodejs/mbfly_njs.cc Sun Jun 06 21:51:58 2010 +0800 +++ b/nodejs/mbfly_njs.cc Mon Jun 07 11:42:45 2010 +0800 @@ -5,6 +5,8 @@ #include "X_supp_njs.h" } +#include "mbfly_njs.h" + using namespace v8; /*! \defgroup njs_template_cb Callback functions for v8 engine and nodejs. @@ -47,7 +49,7 @@ rt = X_njs_MB_new(display_name, width, height); self = args.This(); - self->Set(String::New("_njs_rt"), External::Wrap(rt)); + WRAP(self, rt); X_njs_MB_init_handle_connection(rt); @@ -60,6 +62,18 @@ /* @} */ +redraw_man_t * +xnjsmb_rt_rdman(Handle<Object> mbrt) { + HandleScope scope; + njs_runtime_t *rt; + redraw_man_t *rdman; + + rt = (njs_runtime_t *)UNWRAP(mbrt); + rdman = X_njs_MB_rdman(rt); + + return rdman; +} + Handle<Value> hello_func(const Arguments &args) { HandleScope scope; @@ -77,4 +91,5 @@ func = FunctionTemplate::New(xnjsmb_new); target->Set(String::New("mb_rt"), func->GetFunction()); + func->PrototypeTemplate()->SetInternalFieldCount(1); }