gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/MovieClipLoader.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/MovieClipLoader.cpp
Date: Tue, 12 Feb 2008 14:43:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/02/12 14:43:26

Modified files:
        .              : ChangeLog 
        server/asobj   : MovieClipLoader.cpp 

Log message:
        send the onLoadInit event at the correct time (after actions in first 
frame
        of loaded resource were executed).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5622&r2=1.5623
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.46&r2=1.47

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5622
retrieving revision 1.5623
diff -u -b -r1.5622 -r1.5623
--- ChangeLog   12 Feb 2008 12:28:07 -0000      1.5622
+++ ChangeLog   12 Feb 2008 14:43:26 -0000      1.5623
@@ -1,5 +1,11 @@
 2008-02-12 Sandro Santilli <address@hidden>
 
+       * server/asobj/MovieClipLoader.cpp: send the onLoadInit event
+         at the correct time (after actions in first frame of loaded resource
+         were executed).
+
+2008-02-12 Sandro Santilli <address@hidden>
+
        * server/parser/button_character_def.{cpp,h}: properly parse button
          records with filters and blend mode. Fixes bug #22094.
 

Index: server/asobj/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- server/asobj/MovieClipLoader.cpp    21 Jan 2008 20:55:56 -0000      1.46
+++ server/asobj/MovieClipLoader.cpp    12 Feb 2008 14:43:26 -0000      1.47
@@ -40,14 +40,73 @@
 #include "AsBroadcaster.h" // for initializing self as a broadcaster
 #include "namedStrings.h"
 #include "array.h" // for _listeners construction
+#include "ExecutableCode.h"
 
 #include <typeinfo> 
 #include <string>
 #include <set>
 #include <boost/algorithm/string/case_conv.hpp> // for PROPNAME 
 
+//#define GNASH_DEBUG 1
+
 namespace gnash {
 
+  /// This class is used to queue a function call action
+  //
+  /// Exact use is to queue onLoadInit, which should be invoked
+  /// after actions of in first frame of a loaded movie are executed.
+  /// Since those actions are queued the only way to execute something
+  /// after them is to queue the function call as well.
+  ///
+  /// The class might be made more general and accessible outside
+  /// of the MovieClipLoader class. For now it only works for
+  /// calling a function with a two argument.
+  ///
+  class DelayedFunctionCall: public ExecutableCode {
+
+  public:
+
+    DelayedFunctionCall(as_object* target, string_table::key name, const 
as_value& arg1, const as_value& arg2)
+      :
+      _target(target),
+      _name(name),
+      _arg1(arg1),
+      _arg2(arg2)
+    {}
+
+
+    ExecutableCode* clone() const
+    {
+      return new DelayedFunctionCall(*this);
+    }
+
+    virtual void execute()
+    {
+      _target->callMethod(_name, _arg1, _arg2);
+    }
+
+  #ifdef GNASH_USE_GC
+    /// Mark reachable resources (for the GC)
+    //
+    /// Reachable resources are:
+    ///  - the action target (_target)
+    ///
+    virtual void markReachableResources() const
+    {
+      _target->setReachable();
+      _arg1.setReachable();
+      _arg2.setReachable();
+    }
+  #endif // GNASH_USE_GC
+
+  private:
+
+    as_object* _target;
+    string_table::key _name;
+    as_value _arg1, _arg2;
+
+  };
+
 // Forward declarations
 static as_value moviecliploader_loadclip(const fn_call& fn);
 static as_value moviecliploader_unloadclip(const fn_call& fn);
@@ -171,14 +230,13 @@
        /// This event must be dispatched when actions
        /// in first frame of loaded clip have been executed.
        ///
-       /// Since movie_def_impl::create_movie_instance takes
-       /// care of this, this should be the correct place
-       /// to invoke such an event.
-       ///
-       /// TODO: check if we need to place it before calling
-       ///       this function though...
+       /// Since sprite_instance::loadMovie above will invoke 
stagePlacementCallback
+       /// and thus queue all actions in first frame, we'll queue the
+       /// onLoadInit call next, so it happens after the former.
        ///
-       callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadInit"), 
targetVal);
+       //callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadInit"), 
targetVal);
+       std::auto_ptr<ExecutableCode> code ( new DelayedFunctionCall(this, 
NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadInit"), targetVal) );
+       _vm.getRoot().pushAction(code, movie_root::apDOACTION);
 
        return true;
 }




reply via email to

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