gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/movie_root.cpp server/mo...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/movie_root.cpp server/mo...
Date: Wed, 14 Nov 2007 13:23:48 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/11/14 13:23:47

Modified files:
        .              : ChangeLog 
        server         : movie_root.cpp movie_root.h sprite_instance.cpp 
                         sprite_instance.h 
        server/parser  : movie_def_impl.cpp 
        server/swf     : DoActionTag.h 
        testsuite/misc-swfc.all: action_execution_order_test10.sc 
                                 movieclip_destruction_test1.sc 

Log message:
        With this commit DoInitAction tags stops being stored in a separate 
container
        but go with all other control tags in a frame's playlist. Upon execution
        (both TAG_DLIST and TAG_ACTION) they are feed to 
sprite_instance::execute_init_actions
        which will take care of what to do. Theoretically it should queue the 
init actions
        into the appopriately priorited action queue. Unfortunately doing so 
breaks youtube,
        altought it give us lots of XPASS, so a macro is added to keep youtube 
working while
        allowing testers to add more tests in our testsuite for finding the 
problem and
        fixing it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4857&r2=1.4858
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.382&r2=1.383
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.148&r2=1.149
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DoActionTag.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/action_execution_order_test10.sc?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/movieclip_destruction_test1.sc?cvsroot=gnash&r1=1.27&r2=1.28

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4857
retrieving revision 1.4858
diff -u -b -r1.4857 -r1.4858
--- ChangeLog   14 Nov 2007 12:08:11 -0000      1.4857
+++ ChangeLog   14 Nov 2007 13:23:46 -0000      1.4858
@@ -1,3 +1,21 @@
+2007-11-14 Sandro Santilli <address@hidden>
+
+       * server/movie_root.{cpp,h}: add a processingActions method,
+         might be used to know wheter to push actions or execute
+         them immediately.
+       * server/sprite_instance.{cpp,h}: add an execute_init_action
+         method to be called by DoInitAction tag executor; add a
+         YOUTUBE_HAVE_PRECEDENCE macro undefining which we get lots
+         of new XPASS but break youtube... (pushing init actions
+         to action queue).
+       * server/parser/movie_def_impl.cpp (add_init_action): store
+         init actions togheter with all other control tags.
+       * server/swf/DoActionTag.h (execute): call execute_init_action
+         for init actions, execute them also by execute_state
+       * testsuite/misc-swfc.all/: action_execution_order_test10.sc,
+         movieclip_destruction_test1.sc: some successes (we'd get much
+         more with YOUTUBE_HAVE_PRECEDENCE defined in sprite_instance.cpp)
+
 2007-11-14 Benjamin Wolsey <address@hidden>
 
        * testsuite/actionscript.all/XML.as: adapt and reinclude

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- server/movie_root.cpp       10 Nov 2007 11:51:43 -0000      1.121
+++ server/movie_root.cpp       14 Nov 2007 13:23:46 -0000      1.122
@@ -1268,8 +1268,9 @@
 
        // Immediately execute code targetted at a lower level while processing
        // an higher level.
-       if ( _processingActionLevel < apSIZE && lvl < _processingActionLevel )
+       if ( processingActions() && lvl < _processingActionLevel )
        {
+               log_debug("Action pushed in level %d executed immediately (as 
we are currently executing level %d)", lvl, _processingActionLevel);
                code->execute();
                return;
        }
@@ -1289,8 +1290,9 @@
 
        // Immediately execute code targetted at a lower level while processing
        // an higher level.
-       if ( _processingActionLevel < apSIZE && lvl < _processingActionLevel )
+       if ( processingActions() && lvl < _processingActionLevel )
        {
+               log_debug("Action pushed in level %d executed immediately (as 
we are currently executing level %d)", lvl, _processingActionLevel);
                code->execute();
                return;
        }
@@ -1310,8 +1312,9 @@
 
        // Immediately execute code targetted at a lower level while processing
        // an higher level.
-       if ( _processingActionLevel < apSIZE && lvl < _processingActionLevel )
+       if ( processingActions() && lvl < _processingActionLevel )
        {
+               log_debug("Action pushed in level %d executed immediately (as 
we are currently executing level %d)", lvl, _processingActionLevel);
                code->execute();
                return;
        }

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- server/movie_root.h 9 Nov 2007 19:58:03 -0000       1.86
+++ server/movie_root.h 14 Nov 2007 13:23:47 -0000      1.87
@@ -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.86 2007/11/09 19:58:03 strk Exp $ */
+/* $Id: movie_root.h,v 1.87 2007/11/14 13:23:47 strk Exp $ */
 
 /// \page events_handling Handling of user events
 ///
@@ -622,6 +622,11 @@
     /// Return true if scripts execution is disabled
     bool scriptsDisabled() const { return _disableScripts; };
 
+    bool processingActions() const
+    {
+        return (_processingActionLevel < apSIZE);
+    }
+
 private:
 
     /// Take care of dragging, if needed

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.382
retrieving revision 1.383
diff -u -b -r1.382 -r1.383
--- server/sprite_instance.cpp  12 Nov 2007 23:17:21 -0000      1.382
+++ server/sprite_instance.cpp  14 Nov 2007 13:23:47 -0000      1.383
@@ -1789,6 +1789,8 @@
 bool sprite_instance::get_member(string_table::key name_key, as_value* val,
        string_table::key nsname)
 {
+       //constructAsScriptObject();
+
        const std::string& name = VM::get().getStringTable().value(name_key);
 
        // FIXME: use addProperty interface for these !!
@@ -2147,13 +2149,13 @@
                return false;
        }
 
-#if 1
        if ( id.m_id == event_id::INITIALIZE )
        {
                // Construct as ActionScript object.
+               // TODO: it could be we need to do this on-demand instead
+               // (on __proto__ query)
                constructAsScriptObject();
        }
-#endif
 
        if ( id.is_button_event() && ! isEnabled() )
        {
@@ -2180,6 +2182,15 @@
 
        // Fall through and call the function also, if it's defined!
 
+
+       // user-defined onInitialize is never called
+       if ( id.m_id == event_id::INITIALIZE )
+       {
+                       testInvariant();
+                       return called;
+       }
+
+
        // NOTE: user-defined onLoad is not invoked if the corresponding
        //       clip-defined onLoad is not present (zou mentions if
        //       NO clip-defined events are instead)
@@ -2195,6 +2206,7 @@
                        log_debug("Sprite %s won't check for user-defined LOAD 
event (didn't have a clipLoad event defined)", getTarget().c_str());
                        testInvariant();
 #endif
+                       // FIXME: shouldn't we return 'called' ?
                        return false;
                }
        }
@@ -2417,20 +2429,39 @@
 }
 
 void
-sprite_instance::execute_action(const action_buffer& ab)
+sprite_instance::execute_init_action_buffer(const action_buffer& a)
 {
-       as_environment& env = m_as_environment; // just type less
+       if ( m_init_actions_executed.find(m_current_frame) == 
m_init_actions_executed.end() )
+       {
+               log_debug("Queuing init actions in frame " SIZET_FMT " of 
sprite %s", m_current_frame, getTarget().c_str());
+               std::auto_ptr<ExecutableCode> code ( new GlobalCode(a, 
boost::intrusive_ptr<sprite_instance>(this)) );
 
-       // Do not cleanup locals here, as there's nothing like
-       // a movie-frame local scope...
+               // NOTE: we should really push these actions, but I still don't 
understand
+               //       why doing so breaks youtube :/
+               //       Undefining the YOUTUBE_TAKES_PRECEDENCE you'll get 
many XPASS
+               //       in our testsuite, and no failures, but youtube would 
break.
+               //
+#define YOUTUBE_TAKES_PRECEDENCE 1
+#ifdef YOUTUBE_TAKES_PRECEDENCE
+               code->execute();
+#else
+               movie_root& root = _vm.getRoot();
+               root.pushAction(code, movie_root::apINIT);
+#endif
+       }
+       else
+       {
+               log_debug("Init actions in frame " SIZET_FMT " of sprite %s 
already executed", m_current_frame, getTarget().c_str());
+       }
+}
        
-       //int local_stack_top = env.get_local_frame_top();
-       //env.add_frame_barrier();
+void
+sprite_instance::execute_action(const action_buffer& ab)
+{
+       as_environment& env = m_as_environment; // just type less
 
        ActionExec exec(ab, env);
        exec();
-
-       //env.set_local_frame_top(local_stack_top);
 }
 
 /*private*/
@@ -2491,40 +2522,6 @@
 
        assert(typeflags);
 
-       // Execute this frame's init actions, if necessary.
-       if ( m_init_actions_executed.insert(frame).second )
-       {
-
-               const PlayList* init_actions = m_def->get_init_actions(frame);
-
-               if ( init_actions && ! init_actions->empty() )
-               {
-
-                       IF_VERBOSE_ACTION(
-                               // Use 1-based frame numbers
-                               log_action(_("Executing " SIZET_FMT 
-                                       " *init* tags in frame " SIZET_FMT
-                                       "/" SIZET_FMT " of sprite %s"),
-                                       init_actions->size(),
-                                       frame+1, get_frame_count(),
-                                       getTargetPath().c_str());
-                       );
-
-
-                       // Need to execute these actions (init actions should 
be executed immediately)
-                       std::for_each(init_actions->begin(), 
init_actions->end(),
-                               
std::bind2nd(std::mem_fun(&execute_tag::execute), this));
-
-                       // Mark this frame done, so we never execute these
-                       // init actions again.
-                       //m_init_actions_executed[frame] = true;
-
-                       //do_actions();
-               }
-       }
-
-
-
        const PlayList* playlist = m_def->getPlaylist(frame);
        if ( playlist )
        {
@@ -2552,6 +2549,9 @@
                }
        }
 
+       // Mark this frame's init actions as executed 
+       m_init_actions_executed.insert(frame);
+
        testInvariant();
 }
 
@@ -3395,8 +3395,9 @@
        }
        else
        {
-               //log_debug("Sprite %s is not dynamic, queuing INITIALIZE and 
CONSTRUCT events", getTarget().c_str());
+               log_debug("Queuing INITIALIZE event for sprite %s", 
getTarget().c_str());
                queueEvent(event_id::INITIALIZE, movie_root::apINIT);
+               log_debug("Queuing CONSTRUCT event for sprite %s", 
getTarget().c_str());
                queueEvent(event_id::CONSTRUCT, movie_root::apCONSTRUCT);
        }
 
@@ -3442,6 +3443,7 @@
 void
 sprite_instance::constructAsScriptObject()
 {
+       //log_debug("constructAsScriptObject called for sprite %s", 
getTarget().c_str());
        do {
                if ( _name.empty() )
                {
@@ -3462,7 +3464,7 @@
                }
 
                as_function* ctor = def->getRegisteredClass();
-               //log_msg(_("Attached sprite's registered for %s class is %p"), 
getTarget().c_str(), (void*)ctor); 
+               log_debug(_("Attached sprites %s registered class is %p"), 
getTarget().c_str(), (void*)ctor); 
 
                // TODO: builtin constructors are different from user-defined 
ones
                // we should likely change that. See also vm/ASHandlers.cpp 
(construct_object)

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -b -r1.148 -r1.149
--- server/sprite_instance.h    2 Nov 2007 15:10:43 -0000       1.148
+++ server/sprite_instance.h    14 Nov 2007 13:23:47 -0000      1.149
@@ -518,6 +518,17 @@
                else execute_action(*a);
        }
 
+       
+       /// \brief
+       /// Execute the given init action buffer, if not done yet
+       /// for the current frame
+       //
+       /// The action will normally be pushed on queue, but will
+       /// be executed immediately if we are executing actions
+       /// resulting from a callFame instead.
+       ///
+       void execute_init_action_buffer(const action_buffer& a);
+
        /// Execute a single action buffer (DOACTION block)
        void execute_action(const action_buffer& ab);
 

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- server/parser/movie_def_impl.cpp    30 Oct 2007 18:55:43 -0000      1.86
+++ server/parser/movie_def_impl.cpp    14 Nov 2007 13:23:47 -0000      1.87
@@ -1180,7 +1180,8 @@
        assert(e);
        if ( m_init_action_defined.insert(cid).second )
        {
-               m_init_action_list[_frames_loaded].push_back(e);
+               add_execute_tag(e); // ownership transferred
+               //m_init_action_list[_frames_loaded].push_back(e);
        }
 }
 

Index: server/swf/DoActionTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DoActionTag.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/swf/DoActionTag.h    4 Oct 2007 22:55:53 -0000       1.6
+++ server/swf/DoActionTag.h    14 Nov 2007 13:23:47 -0000      1.7
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: DoActionTag.h,v 1.6 2007/10/04 22:55:53 strk Exp $ */
+/* $Id: DoActionTag.h,v 1.7 2007/11/14 13:23:47 strk Exp $ */
 
 #ifndef GNASH_SWF_DOACTIONTAG_H
 #define GNASH_SWF_DOACTIONTAG_H
@@ -63,11 +63,21 @@
            m_buf.readFullTag(in);
        }
 
+       virtual void execute_state(sprite_instance* m) const
+       {
+               if ( _isInitAction )
+               {
+                       //m->execute_action(m_buf);
+                       m->execute_init_action_buffer(m_buf);
+               }
+       }
+
        virtual void execute(sprite_instance* m) const
        {
                if ( _isInitAction )
                {
-                       m->execute_action(m_buf);
+                       //m->execute_action(m_buf);
+                       m->execute_init_action_buffer(m_buf);
                }
                else
                {

Index: testsuite/misc-swfc.all/action_execution_order_test10.sc
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-swfc.all/action_execution_order_test10.sc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- testsuite/misc-swfc.all/action_execution_order_test10.sc    14 Nov 2007 
10:35:42 -0000      1.11
+++ testsuite/misc-swfc.all/action_execution_order_test10.sc    14 Nov 2007 
13:23:47 -0000      1.12
@@ -183,7 +183,7 @@
     _root.mc4_onConstruct_executed = false;
 
     _root.note("mc4 init actions"); 
-    _root.xcheck_equals(typeof(mc4), 'movieclip');
+    _root.check_equals(typeof(mc4), 'movieclip');
     // What a bad bug the pp has !
     // First query of __proto__ turns it into the correct prototype
     // (MovieClip.prototype) buf first query returns the *old* rather
@@ -193,7 +193,7 @@
     //         returns Object.prototype.
     _root.xcheck(mc4.__proto__ == Object.prototype); // returns wrong answer 
at first, gnash does the right thing here
     _root.check(mc4.__proto__ != Object.prototype); // and correct at second 
and subsequent queries
-    _root.xcheck_equals(mc4.__proto__, MovieClip.prototype); // <--- this is 
the correct one
+    _root.check_equals(mc4.__proto__, MovieClip.prototype); // <--- this is 
the correct one
     
     mc4.onInitialize = function () { 
       _root.note("mc4 user defined onInitialize"); 
@@ -228,7 +228,7 @@
   
 .frame 9
   .action:
-    xcheck_equals(mc4_onConstruct_executed, true);
+    check_equals(mc4_onConstruct_executed, true);
     xcheck_equals(mc5_onConstruct_executed, true);
   .end
 

Index: testsuite/misc-swfc.all/movieclip_destruction_test1.sc
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-swfc.all/movieclip_destruction_test1.sc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/misc-swfc.all/movieclip_destruction_test1.sc      8 Nov 2007 
10:50:22 -0000       1.27
+++ testsuite/misc-swfc.all/movieclip_destruction_test1.sc      14 Nov 2007 
13:23:47 -0000      1.28
@@ -248,11 +248,11 @@
     _root.xcheck_equals(mc6.__proto__, Object.prototype); 
     _root.xcheck_equals(mc7.__proto__, Object.prototype); 
     trace(mc6.__proto__); trace(mc7.__proto__);
-    _root.xcheck_equals(mc6.__proto__, MovieClip.prototype); 
+    _root.check_equals(mc6.__proto__, MovieClip.prototype); 
     _root.xcheck_equals(mc7.__proto__, MovieClip.prototype); 
 
-    _root.xcheck_equals(typeof(mc6), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
-    _root.xcheck_equals(typeof(mc6.mc61), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
+    _root.check_equals(typeof(mc6), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
+    _root.check_equals(typeof(mc6.mc61), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
     _root.xcheck_equals(typeof(mc7), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
     _root.xcheck_equals(typeof(mc7.mc71), 'movieclip'); // Gnash fails because 
executes init actions before DLIST tags
     _root.check_equals(this, _root); // target is the root !




reply via email to

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