CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/12 15:21:43
Modified files: . : ChangeLog server : as_function.cpp as_function.h sprite_instance.cpp Log message: * server/as_function.{cpp,h}: make 'prototype' a proper property, change getPrototype() to return by intrusive_ptr. * server/sprite_instance.cpp: update call to getPrototype(). CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4293&r2=1.4294 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.cpp?cvsroot=gnash&r1=1.38&r2=1.39 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.h?cvsroot=gnash&r1=1.17&r2=1.18 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.335&r2=1.336 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4293 retrieving revision 1.4294 diff -u -b -r1.4293 -r1.4294 --- ChangeLog 12 Sep 2007 14:51:10 -0000 1.4293 +++ ChangeLog 12 Sep 2007 15:21:42 -0000 1.4294 @@ -1,3 +1,9 @@ +2007-09-12 Sandro Santilli <[EMAIL PROTECTED]> + + * server/as_function.{cpp,h}: make 'prototype' a proper property, + change getPrototype() to return by intrusive_ptr. + * server/sprite_instance.cpp: update call to getPrototype(). + 2007-09-12 Bastiaan Jacques <[EMAIL PROTECTED]> * backend/render_handler_ogl.cpp: Make sure we don't try to use Index: server/as_function.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_function.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -b -r1.38 -r1.39 --- server/as_function.cpp 31 Aug 2007 21:53:31 -0000 1.38 +++ server/as_function.cpp 12 Sep 2007 15:21:43 -0000 1.39 @@ -102,38 +102,37 @@ as_function::as_function(as_object* iface) : // all functions inherit from global Function class - as_object(getFunctionPrototype()), - _properties(iface) + as_object(getFunctionPrototype()) { /// TODO: create properties lazily, on getPrototype() call - if ( ! _properties ) + if ( ! iface ) { - _properties = new as_object(getObjectInterface()); + iface = new as_object(getObjectInterface()); } - _properties->init_member("constructor", this); - init_member("prototype", as_value(_properties.get())); + iface->init_member("constructor", this); + init_member("prototype", as_value(iface)); } void as_function::setPrototype(as_object* proto) { - _properties = proto; - init_member("prototype", as_value(_properties.get())); + //_properties = proto; + init_member("prototype", as_value(proto)); } void as_function::extends(as_function& superclass) { - _properties = new as_object(superclass.getPrototype()); - _properties->init_member("__proto__", superclass.getPrototype()); + as_object* newproto = new as_object(superclass.getPrototype().get()); + newproto->init_member("__proto__", superclass.getPrototype().get()); if ( VM::get().getSWFVersion() > 5 ) { - _properties->init_member("__constructor__", &superclass); + newproto->init_member("__constructor__", &superclass); } - init_member("prototype", as_value(_properties.get())); + init_member("prototype", as_value(newproto)); } -as_object* +boost::intrusive_ptr<as_object> as_function::getPrototype() { // TODO: create if not available ? @@ -142,15 +141,7 @@ // prototype, not the old !! as_value proto; get_member("prototype", &proto); - if ( proto.to_object() != _properties.get() ) - { - log_debug(_("Exported interface of function %p " - "has been overwritten (from %p to %p)"), - (void*)this, (void*)_properties.get(), - (void*)proto.to_object().get()); - _properties = proto.to_object(); - } - return _properties.get(); + return proto.to_object(); } /* static public */ Index: server/as_function.h =================================================================== RCS file: /sources/gnash/gnash/server/as_function.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -b -r1.17 -r1.18 --- server/as_function.h 1 Jul 2007 10:54:20 -0000 1.17 +++ server/as_function.h 12 Sep 2007 15:21:43 -0000 1.18 @@ -103,11 +103,8 @@ unsigned nargs, unsigned first_arg_index); /// Get this function's "prototype" member (exported interface). - // - /// This is never NULL, and created on purpose if not provided - /// at construction time. /// - as_object* getPrototype(); + boost::intrusive_ptr<as_object> getPrototype(); /// Make this function a subclass of the given as_function void extends(as_function& superclass); @@ -152,7 +149,7 @@ /// void markAsFunctionReachable() const { - _properties->setReachable(); + //_properties->setReachable(); markAsObjectReachable(); } @@ -178,7 +175,7 @@ /// to be inherited by instances of this /// "Function" (class) /// - boost::intrusive_ptr<as_object> _properties; + //boost::intrusive_ptr<as_object> _properties; private: Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.335 retrieving revision 1.336 diff -u -b -r1.335 -r1.336 --- server/sprite_instance.cpp 12 Sep 2007 06:44:51 -0000 1.335 +++ server/sprite_instance.cpp 12 Sep 2007 15:21:43 -0000 1.336 @@ -3356,7 +3356,7 @@ if ( ctor && ! ctor->isBuiltin() ) { // Set the new prototype *after* the constructor was called - as_object* proto = ctor->getPrototype(); + boost::intrusive_ptr<as_object> proto = ctor->getPrototype(); set_prototype(proto); //log_msg(_("Calling the user-defined constructor against this sprite_instance")); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit