gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/timers.cpp server/timers...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/timers.cpp server/timers...
Date: Thu, 05 Apr 2007 07:31:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/05 07:31:28

Modified files:
        .              : ChangeLog 
        server         : timers.cpp timers.h 
        server/asobj   : LoadVars.cpp xmlsocket.cpp 

Log message:
                * server/timers.{cpp,h}: drop the as_environment member
                  for Timers as we can't ensure it will be kept alive.
                  We'll use a newly created environment for calling
                  the timer function.
                * server/asobj/: LoadVars.cpp, xmlsocket.cpp: update use of
                  timers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2785&r2=1.2786
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.cpp?cvsroot=gnash&r1=1.22&r2=1.23

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2785
retrieving revision 1.2786
diff -u -b -r1.2785 -r1.2786
--- ChangeLog   5 Apr 2007 07:17:34 -0000       1.2785
+++ ChangeLog   5 Apr 2007 07:31:27 -0000       1.2786
@@ -1,5 +1,11 @@
 2007-04-05 Sandro Santilli <address@hidden>
 
+       * server/timers.{cpp,h}: drop the as_environment member
+         for Timers as we can't ensure it will be kept alive.
+         We'll use a newly created environment for calling
+         the timer function.
+       * server/asobj/: LoadVars.cpp, xmlsocket.cpp: update use of
+         timers.
        * server/as_environment.cpp (find_object_dotsyntax): 
          more verbose debugging for cases in which a dot-syntax
          path contains non-object members.

Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/timers.cpp   30 Mar 2007 10:18:29 -0000      1.27
+++ server/timers.cpp   5 Apr 2007 07:31:28 -0000       1.28
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: timers.cpp,v 1.27 2007/03/30 10:18:29 strk Exp $ */
+/* $Id: timers.cpp,v 1.28 2007/04/05 07:31:28 strk Exp $ */
 
 #include "timers.h"
 #include "as_function.h" // for class as_function
@@ -37,8 +37,7 @@
   Timer::Timer() :
       _interval(0),
       _start(0),
-      _object(0),
-      _env(0)
+      _object(0)
   {
   }
   
@@ -49,24 +48,22 @@
   
 
   void
-  Timer::setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, as_environment *env)
+  Timer::setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr)
   {
     _function = &method;
     _interval = ms * 1000; // transform to microseconds 
     //log_msg("_interval microseconds: %lu", _interval);
-    _env = env;
     _object = this_ptr;
     start();
   }
 
   void
-  Timer::setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, as_environment *env,
+  Timer::setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, 
                  std::vector<as_value>& args)
   {
     _function = &method;
     _interval = ms * 1000; // transform to microseconds 
     //log_msg("_interval microseconds: %lu", _interval);
-    _env = env;
     _object = this_ptr;
     _args = args;
     start();
@@ -119,17 +116,19 @@
 
     as_value timer_method(_function.get());
 
+    as_environment env;
+
     // Push args to the as_environment stack if needed
     for ( ArgsContainer::reverse_iterator it=_args.rbegin(), 
itEnd=_args.rend();
                    it != itEnd; ++it )
     {
            //log_msg("Env-pushing %s", it->to_debug_string().c_str());
-           _env->push(*it);
+           env.push(*it);
     }
 
-    size_t firstArgBottomIndex = _env->stack_size()-1; 
+    size_t firstArgBottomIndex = env.stack_size()-1; 
 
-    as_value val = call_method(timer_method, _env, _object.get(),
+    as_value val = call_method(timer_method, &env, _object.get(),
                    _args.size(), firstArgBottomIndex);
 
 }
@@ -223,7 +222,7 @@
        }
 
        Timer timer;
-       timer.setInterval(*as_func, ms, fn.this_ptr, &fn.env(), args);
+       timer.setInterval(*as_func, ms, fn.this_ptr, args);
     
        movie_root& root = VM::get().getRoot();
        int id = root.add_interval_timer(timer);

Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/timers.h     30 Mar 2007 10:18:29 -0000      1.17
+++ server/timers.h     5 Apr 2007 07:31:28 -0000       1.18
@@ -89,11 +89,7 @@
       ///      It is allowed to be NULL as long as fn_call is allowed
       ///      a NULL as 'this_ptr' (we might want to change this).
       ///
-      /// @param env
-      ///      The environment in which the associated function will be run.
-      ///      Not sure we should provide this rather then extracting from 
this_ptr...
-      ///
-      void setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, as_environment *env);
+      void setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr);
 
       /// Setup the Timer, enabling it.
       //
@@ -110,14 +106,10 @@
       ///      It is allowed to be NULL as long as fn_call is allowed
       ///      a NULL as 'this_ptr' (we might want to change this).
       ///
-      /// @param env
-      ///      The environment in which the associated function will be run.
-      ///      Not sure we should provide this rather then extracting from 
this_ptr...
-      ///
       /// @param args
       ///      The list of arguments to pass to the function being invoked.
       ///
-      void setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, as_environment *env,
+      void setInterval(as_function& method, unsigned ms, 
boost::intrusive_ptr<as_object> this_ptr, 
                      std::vector<as_value>& args);
 
       /// Clear the timer, ready for reuse
@@ -162,9 +154,6 @@
       /// Context for the function call. Will be used as 'this' pointer.
       boost::intrusive_ptr<as_object> _object;
 
-      /// how to keep this alive ?
-      as_environment *_env;
-
       /// List of arguments
       ArgsContainer _args;
 };

Index: server/asobj/LoadVars.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/LoadVars.cpp   22 Mar 2007 22:37:45 -0000      1.18
+++ server/asobj/LoadVars.cpp   5 Apr 2007 07:31:28 -0000       1.19
@@ -364,7 +364,7 @@
                using boost::intrusive_ptr;
                intrusive_ptr<builtin_function> loadsChecker = new 
builtin_function(
                        &LoadVars::checkLoads_wrapper, NULL);
-               Timer timer; timer.setInterval(*loadsChecker, 50, this, _env);
+               Timer timer; timer.setInterval(*loadsChecker, 50, this);
                _loadCheckerTimer = 
VM::get().getRoot().add_interval_timer(timer);
        }
 

Index: server/asobj/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/asobj/xmlsocket.cpp  4 Apr 2007 20:30:45 -0000       1.22
+++ server/asobj/xmlsocket.cpp  5 Apr 2007 07:31:28 -0000       1.23
@@ -463,7 +463,7 @@
         Timer timer;
         boost::intrusive_ptr<builtin_function> ondata_handler = new 
builtin_function(&xmlsocket_inputChecker, NULL);
         unsigned interval = 50; // just make sure it's expired at every frame 
iteration (20 FPS used here)
-        timer.setInterval(*ondata_handler, interval, 
boost::dynamic_pointer_cast<as_object>(ptr), &fn.env());
+        timer.setInterval(*ondata_handler, interval, 
boost::dynamic_pointer_cast<as_object>(ptr));
         VM::get().getRoot().add_interval_timer(timer);
 
         log_warning("Timer set");




reply via email to

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