# HG changeset patch # User Thinker K.F. Li # Date 1281001413 -28800 # Node ID fc29a343ce7cb1f8d47901ae18a1d61129ebe32d # Parent f0b4fbcd1c51d941ac0036dfaad66943a93e341f Track JS object with property store of objects diff -r f0b4fbcd1c51 -r fc29a343ce7c include/mb_prop.h --- a/include/mb_prop.h Thu Aug 05 17:42:36 2010 +0800 +++ b/include/mb_prop.h Thu Aug 05 17:43:33 2010 +0800 @@ -32,6 +32,7 @@ PROP_DUMMY, PROP_MEVT_OB_CNT, PROP_MEVT_OBSERVER, + PROP_JSOBJ, PROP_LAST }; diff -r f0b4fbcd1c51 -r fc29a343ce7c nodejs/mbfly_njs.cc --- a/nodejs/mbfly_njs.cc Thu Aug 05 17:42:36 2010 +0800 +++ b/nodejs/mbfly_njs.cc Thu Aug 05 17:43:33 2010 +0800 @@ -28,8 +28,11 @@ static void xnjsmb_coord_mod(Handle mbrt, Handle ret) { Handle ret_obj = ret->ToObject(); + coord_t *coord; SET(ret_obj, "mbrt", mbrt); + coord = (coord_t *)UNWRAP(ret_obj); + mb_prop_set(&coord->obj.props, PROP_JSOBJ, *ret_obj); } #define xnjsmb_auto_coord_new export_xnjsmb_auto_coord_new diff -r f0b4fbcd1c51 -r fc29a343ce7c nodejs/observer.cc --- a/nodejs/observer.cc Thu Aug 05 17:42:36 2010 +0800 +++ b/nodejs/observer.cc Thu Aug 05 17:43:33 2010 +0800 @@ -62,4 +62,7 @@ void xnjsmb_observer_init(void) { + xnjsmb_auto_observer_init(); + xnjsmb_auto_subject_init(); + xnjsmb_auto_event_init(); } diff -r f0b4fbcd1c51 -r fc29a343ce7c nodejs/shapes.cc --- a/nodejs/shapes.cc Thu Aug 05 17:42:36 2010 +0800 +++ b/nodejs/shapes.cc Thu Aug 05 17:43:33 2010 +0800 @@ -145,6 +145,7 @@ WRAP(self, sh); SET(self, "mbrt", rt); + mb_prop_set(&sh->obj.props, PROP_JSOBJ, *self); return Null(); } @@ -235,6 +236,7 @@ WRAP(self, stext); SET(self, "mbrt", rt); + mb_prop_set(&stext->obj.props, PROP_JSOBJ, *self); return Null(); } @@ -370,6 +372,7 @@ WRAP(self, img); SET(self, "mbrt", rt); + mb_prop_set(&img->obj.props, PROP_JSOBJ, *self); return Null(); }