gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/NetStream.h server...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetStream.h server...
Date: Sat, 16 Jun 2007 09:07:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/06/16 09:07:35

Modified files:
        .              : ChangeLog 
        server/asobj   : NetStream.h gen-asclass.sh LoadVars.cpp 
        libbase        : GC.h 
        server         : timers.cpp timers.h movie_root.cpp movie_root.h 

Log message:
        This commit fixes NetStream-SquareTestRunner and LoadVars.as segfaults
        
                * server/asobj/NetStream.h: implement markReachableResources.
                * server/asobj/gen-asclass.sh: updated template to include
                  a sample of a markReachableResources implementation.
                * server/asobj/LoadVars.cpp: implement markReachableResources
                  to properly mark event handlers and environment resources.
                * libbase/GC.h: don't be verbose about objects being marked,
                  classes not overriding markReachableResources and collectables
                  registered unless GNASH_GC_DEBUG > 1
                * server/timers.{cpp,h}: provide a markReachableResources to 
mark
                  function, target objet and args.
                * server/movie_root.{cpp,h} (markReachableResources): mark 
Timers
                  resources as being reachable; document what's marked in the 
function
                  declaration documentation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3556&r2=1.3557
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/gen-asclass.sh?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/GC.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.57&r2=1.58

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3556
retrieving revision 1.3557
diff -u -b -r1.3556 -r1.3557
--- ChangeLog   16 Jun 2007 07:37:51 -0000      1.3556
+++ ChangeLog   16 Jun 2007 09:07:33 -0000      1.3557
@@ -1,5 +1,21 @@
 2007-06-16 Sandro Santilli <address@hidden>
 
+       * server/asobj/NetStream.h: implement markReachableResources.
+       * server/asobj/gen-asclass.sh: updated template to include
+         a sample of a markReachableResources implementation.
+       * server/asobj/LoadVars.cpp: implement markReachableResources
+         to properly mark event handlers and environment resources.
+       * libbase/GC.h: don't be verbose about objects being marked,
+         classes not overriding markReachableResources and collectables
+         registered unless GNASH_GC_DEBUG > 1
+       * server/timers.{cpp,h}: provide a markReachableResources to mark
+         function, target objet and args.
+       * server/movie_root.{cpp,h} (markReachableResources): mark Timers
+         resources as being reachable; document what's marked in the function
+         declaration documentation.
+
+2007-06-16 Sandro Santilli <address@hidden>
+
        * testsuite/server/: DisplayListTest.cpp, GetterSetterTest.cpp,
          PropertyListTest.cpp: initialize gnash lib.
 

Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- server/asobj/NetStream.h    1 Jun 2007 11:53:19 -0000       1.45
+++ server/asobj/NetStream.h    16 Jun 2007 09:07:34 -0000      1.46
@@ -19,7 +19,7 @@
 //
 //
 
-/*  $Id: NetStream.h,v 1.45 2007/06/01 11:53:19 strk Exp $ */
+/*  $Id: NetStream.h,v 1.46 2007/06/16 09:07:34 strk Exp $ */
 
 #ifndef __NETSTREAM_H__
 #define __NETSTREAM_H__
@@ -166,6 +166,17 @@
        // The position in the inputfile, only used when not playing a FLV
        long inputPos;
 
+#ifdef GNASH_USE_GC
+       /// Mark all reachable resources of a NetStream, for the GC
+       //
+       /// Reachable resources are:
+       ///     - associated NetConnection object (_netCon)
+       ///     - onStatus event handler (m_statusHandler)
+       ///
+       virtual void markReachableResources() const;
+
+#endif // GNASH_USE_GC
+
 public:
 
        NetStream();

Index: server/asobj/gen-asclass.sh
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/gen-asclass.sh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/asobj/gen-asclass.sh 26 Apr 2007 07:00:29 -0000      1.13
+++ server/asobj/gen-asclass.sh 16 Jun 2007 09:07:34 -0000      1.14
@@ -200,6 +200,20 @@
 
        // override from as_object ?
        //double get_numeric_value() const { return 0; }
+
+protected:
+
+       // override from as_object if storing GC resources beside
+       // the proper propertyes
+       //void markReachableResources() const
+       //{
+       //      // Call setReachable on any stored GcResource member
+       //      // and equivalent functions for containers of GcResources
+       //      // (tipically named markReachableResources)
+       //
+       //      // invoke general as_object marker
+       //      markAsObjectReachable();
+       //}
 };
 
 EOF

Index: server/asobj/LoadVars.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/asobj/LoadVars.cpp   26 Apr 2007 07:00:29 -0000      1.24
+++ server/asobj/LoadVars.cpp   16 Jun 2007 09:07:34 -0000      1.25
@@ -120,6 +120,31 @@
                return _loaded;
        }
 
+protected:
+
+#ifdef GNASH_USE_GC
+       /// Mark all reachable resources, for the GC
+       //
+       /// Reachable resources are:
+       ///     - onLoad event handler (_onLoad)
+       ///     - onData event handler (_onLoad)
+       ///     - associated environment (_env)
+       ///
+       virtual void markReachableResources() const
+       {
+
+               if ( _onLoad ) _onLoad->setReachable();
+
+               if ( _onData ) _onData->setReachable();
+
+               if ( _env ) _env->markReachableResources();
+
+               // Invoke generic as_object marker
+               markAsObjectReachable();
+       }
+
+#endif // GNASH_USE_GC
+
 private:
 
        /// Forbid copy

Index: libbase/GC.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/GC.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/GC.h        16 Jun 2007 08:15:52 -0000      1.3
+++ libbase/GC.h        16 Jun 2007 09:07:34 -0000      1.4
@@ -100,7 +100,7 @@
                        return;
                }
 
-#ifdef GNASH_GC_DEBUG 
+#if GNASH_GC_DEBUG  > 1
                log_debug(_("Instance %p of class %s set to reachable, scanning 
reachable resources from it"),
                                (void*)this, typeid(*this).name());
 #endif
@@ -134,7 +134,7 @@
        virtual void markReachableResources() const
        {
                assert(_reachable);
-#ifdef GNASH_GC_DEBUG 
+#if GNASH_GC_DEBUG > 1
                log_debug(_("Class %s didn't override the 
markReachableResources() method"), typeid(*this).name());
 #endif
        }
@@ -215,7 +215,7 @@
                assert(std::find(_resList.begin(), _resList.end(), item) == 
_resList.end());
 
                _resList.push_back(item);
-#ifdef GNASH_GC_DEBUG 
+#if GNASH_GC_DEBUG > 1
                log_debug(_("GC %p: collectable %p added, num collectables: " 
SIZET_FMT), (void*)this, (void*)item, _resList.size());
 #endif
        }

Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/timers.cpp   4 Jun 2007 08:10:27 -0000       1.33
+++ server/timers.cpp   16 Jun 2007 09:07:34 -0000      1.34
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: timers.cpp,v 1.33 2007/06/04 08:10:27 strk Exp $ */
+/* $Id: timers.cpp,v 1.34 2007/06/16 09:07:34 strk Exp $ */
 
 #include "timers.h"
 #include "as_function.h" // for class as_function
@@ -133,6 +133,21 @@
 
 }
 
+#ifdef GNASH_USE_GC
+void
+Timer::markReachableResources() const
+{
+       for (ArgsContainer::const_iterator i=_args.begin(), e=_args.end();
+                       i!=e; ++i)
+       {
+               i->setReachable();
+       }
+
+       if ( _function ) _function->setReachable();
+       if ( _object ) _object->setReachable();
+}
+#endif // GNASH_USE_GC
+
 // TODO: move to Global.cpp
 as_value
 timer_setinterval(const fn_call& fn)

Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/timers.h     28 May 2007 15:41:07 -0000      1.21
+++ server/timers.h     16 Jun 2007 09:07:35 -0000      1.22
@@ -134,6 +134,17 @@
       /// Arguments list type
       typedef std::vector<as_value> ArgsContainer;
       
+#ifdef GNASH_USE_GC
+       /// Mark all reachable resources (for GC)
+       //
+       /// Resources reachable from Timer are:
+       ///
+       ///     - Arguments list (_args)
+       ///     - Associated function (_function)
+       ///     - Target object (_object)
+       ///
+       void markReachableResources() const;
+#endif // GNASH_USE_GC
 
 private:
 

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- server/movie_root.cpp       15 Jun 2007 15:00:30 -0000      1.66
+++ server/movie_root.cpp       16 Jun 2007 09:07:35 -0000      1.67
@@ -1027,6 +1027,12 @@
        // Mark mouse entities 
        m_mouse_button_state.markReachableResources();
        
+       // Mark timer targets
+       for (TimerList::const_iterator i=_intervalTimers.begin(), 
e=_intervalTimers.end();
+                       i != e; ++i)
+       {
+               i->markReachableResources();
+       }
 }
 #endif // GNASH_USE_GC
 

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- server/movie_root.h 15 Jun 2007 15:00:30 -0000      1.57
+++ server/movie_root.h 16 Jun 2007 09:07:35 -0000      1.58
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: movie_root.h,v 1.57 2007/06/15 15:00:30 strk Exp $ */
+/* $Id: movie_root.h,v 1.58 2007/06/16 09:07:35 strk Exp $ */
 
 /// \page events_handling Handling of user events
 ///
@@ -441,6 +441,13 @@
 
 #ifdef GNASH_USE_GC
        /// Mark all reachable resources (for GC)
+       //
+       /// Resources reachable from movie_root are:
+       ///
+       ///     - All _level# movies (_movie)
+       ///     - Mouse entities (m_mouse_button_state)
+       ///     - Timer targets (_intervalTimers)
+       ///
        void markReachableResources() const;
 #endif // GNASH_USE_GC
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]