[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/array.cpp server/as_envi...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/array.cpp server/as_envi... |
Date: |
Thu, 10 Jan 2008 17:34:47 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/01/10 17:34:46
Modified files:
. : ChangeLog
server : array.cpp as_environment.cpp movie_root.cpp
movie_root.h timers.cpp timers.h
server/asobj : NetStream.h NetStreamFfmpeg.cpp xml.cpp
server/vm : VM.cpp VM.h
testsuite/swfdec: PASSING
utilities : processor.cpp
Log message:
execute timers in order of expiration, cleanup headers inclusion, fix
a compiler warning in Array constructor.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5366&r2=1.5367
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.148&r2=1.149
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/swfdec/PASSING?cvsroot=gnash&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.79&r2=1.80
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5366
retrieving revision 1.5367
diff -u -b -r1.5366 -r1.5367
--- ChangeLog 10 Jan 2008 11:44:03 -0000 1.5366
+++ ChangeLog 10 Jan 2008 17:34:45 -0000 1.5367
@@ -1,5 +1,17 @@
2008-01-10 Sandro Santilli <address@hidden>
+ * < all over > : since I dropped timers.h inclusion from movie_root.h
+ the remaining of the changes are adding missing include here and
+ there.
+ * server/array.cpp: fix double-to-int cast in Array ctor.
+ * testsuite/swfdec/PASSING: settimeout-*.swf succeed.
+ * server/movie_root.cpp (executeTimers): execute timers
+ in order of expiration.
+ * server/timers.{cpp,h}: extend interfaces to allow for
+ less clock lookup calls and query expiration time.
+
+2008-01-10 Sandro Santilli <address@hidden>
+
* server/swf/tag_loaders.cpp (sound_stream_head_loader,
define_sound_loader): check sample rate arguments.
Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- server/array.cpp 7 Jan 2008 18:30:15 -0000 1.89
+++ server/array.cpp 10 Jan 2008 17:34:45 -0000 1.90
@@ -1411,7 +1411,7 @@
else if (fn.nargs == 1 && fn.arg(0).is_number() )
{
// TODO: limit max size !!
- int newSize = fn.arg(0).to_number();
+ int newSize = fn.arg(0).to_int();
if ( newSize < 0 ) newSize = 0;
else ao->resize(newSize);
}
Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- server/as_environment.cpp 26 Dec 2007 08:04:59 -0000 1.118
+++ server/as_environment.cpp 10 Jan 2008 17:34:45 -0000 1.119
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: as_environment.cpp,v 1.118 2007/12/26 08:04:59 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.119 2008/01/10 17:34:45 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -34,6 +34,7 @@
#include "Property.h"
#include "as_object.h"
#include "namedStrings.h"
+#include "as_function.h" // for
as_environment::CallFrame::markReachableResources
#include <string>
#include <utility> // for std::pair
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -b -r1.148 -r1.149
--- server/movie_root.cpp 10 Jan 2008 09:37:04 -0000 1.148
+++ server/movie_root.cpp 10 Jan 2008 17:34:45 -0000 1.149
@@ -34,9 +34,11 @@
#include "namedStrings.h"
#include "GnashException.h"
#include "sound_handler.h"
+#include "timers.h" // for Timer use
#include <iostream>
#include <string>
+#include <map>
#include <typeinfo>
#include <cassert>
#include <boost/algorithm/string/case_conv.hpp>
@@ -1432,6 +1434,12 @@
#ifdef GNASH_DEBUG_TIMERS_EXPIRATION
log_debug("Checking %d timers for expiration", _intervalTimers.size());
#endif
+
+ unsigned long now = VM::get().getTime();
+
+ typedef std::multimap<unsigned int, Timer*> ExpiredTimers;
+ ExpiredTimers expiredTimers;
+
for (TimerMap::iterator it=_intervalTimers.begin(),
itEnd=_intervalTimers.end();
it != itEnd; )
{
@@ -1458,13 +1466,24 @@
}
else
{
- timer->executeIfExpired();
+ unsigned long elapsed;
+ if ( timer->expired(now, elapsed) )
+ {
+ expiredTimers.insert( make_pair(elapsed, timer)
);
+ }
}
it = nextIterator;
}
- if( ! _intervalTimers.empty() )
+ for (ExpiredTimers::iterator it=expiredTimers.begin(),
+ itEnd=expiredTimers.end();
+ it != itEnd; ++it)
+ {
+ it->second->executeAndReset();
+ }
+
+ if ( ! expiredTimers.empty() )
{
// process actions queued when executing interval callbacks
processActionQueue();
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- server/movie_root.h 9 Jan 2008 18:31:43 -0000 1.102
+++ server/movie_root.h 10 Jan 2008 17:34:45 -0000 1.103
@@ -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.102 2008/01/09 18:31:43 strk Exp $ */
+/* $Id: movie_root.h,v 1.103 2008/01/10 17:34:45 strk Exp $ */
/// \page events_handling Handling of user events
///
@@ -75,7 +75,7 @@
#include "mouse_button_state.h" // for composition
#include "drag_state.h" // for composition
#include "movie_instance.h" // for inlines
-#include "timers.h" // for composition
+//#include "timers.h" // for composition
#include "asobj/Key.h"
#include "smart_ptr.h" // for memory management
#include "URL.h" // for loadMovie
@@ -89,6 +89,7 @@
class ExecutableCode; // for ActionQueue
class Stage;
class URL;
+ class Timer;
}
namespace gnash
Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/timers.cpp 11 Dec 2007 00:14:23 -0000 1.44
+++ server/timers.cpp 10 Jan 2008 17:34:46 -0000 1.45
@@ -19,7 +19,7 @@
//
//
-/* $Id: timers.cpp,v 1.44 2007/12/11 00:14:23 strk Exp $ */
+/* $Id: timers.cpp,v 1.45 2008/01/10 17:34:46 strk Exp $ */
#include "timers.h"
#include "as_function.h" // for class as_function
@@ -102,38 +102,23 @@
}
-void
-Timer::executeIfExpired()
+bool
+Timer::expired(unsigned long now, unsigned long& elapsed)
{
- if ( _start != std::numeric_limits<unsigned long>::max() )
- {
- unsigned long now = VM::get().getTime();
- assert(now >= _start); // it is possible for now to be ==
_start
+ if ( cleared() ) return false;
+ long unsigned expTime = _start + _interval;
+ if ( now < expTime ) return false;
+ elapsed = expTime-now;
+ return true;
+}
- //cout << "Start is " << _start << " interval is " << _interval
<< " now is " << now << endl;
- if (now >= _start + _interval)
- {
+void
+Timer::executeAndReset()
+{
+ if ( cleared() ) return;
execute();
- if ( _runOnce )
- {
- clearInterval();
- }
- else
- {
- // TODO: set _start to save lost time in
calling expired ?
- _start += _interval; // reset the timer
- //cout << " Expired, reset start to " << _start
<< endl;
- //log_msg("Timer expired! \n");
- //return true;
- }
- }
- }
- else
- {
- log_msg("Timer not enabled!");
- }
-
- //return false;
+ if ( _runOnce ) clearInterval();
+ else _start += _interval; // reset the timer
}
void
Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/timers.h 11 Dec 2007 00:14:23 -0000 1.33
+++ server/timers.h 10 Jan 2008 17:34:46 -0000 1.34
@@ -31,7 +31,7 @@
#include "as_function.h" // for visibility of destructor by intrusive_ptr
#include "smart_ptr.h"
-#include "tu_timer.h"
+//#include "tu_timer.h"
#include <string>
#include <vector>
@@ -148,12 +148,18 @@
///
void clearInterval();
- /// Execute the associated callback if timer expired.
+ /// Get expiration state
//
- /// If single run is requested the timer is cleared after execution,
- /// otherwise the timer is reset after that.
+ /// @param now
+ /// Current time, in milliseconds.
///
- void executeIfExpired();
+ /// @param elapsed
+ /// Output parameter, will be set to the amount of milliseconds
+ /// elapsed since actual expiration, if expired.
+ ///
+ /// @return true if the timer expired, false otherwise.
+ ///
+ bool expired(unsigned long now, unsigned long& elapsed);
/// Return true if interval has been cleared.
//
@@ -164,12 +170,16 @@
return _start == std::numeric_limits<unsigned long>::max();
}
- /// Execute associated function properly setting up context
- void execute();
-
- /// Execute associated function properly setting up context
- void operator() () { execute(); }
-
+ /// Execute associated function and reset state
+ //
+ /// After execution either the timer is cleared
+ /// (if runOnce) or start time is incremented
+ /// by the interval.
+ ///
+ /// NOTE: if the timer is cleared this call
+ /// results in a no-op.
+ ///
+ void executeAndReset();
/// Arguments list type
typedef std::vector<as_value> ArgsContainer;
@@ -188,6 +198,12 @@
private:
+ /// Execute associated function properly setting up context
+ void execute();
+
+ /// Execute associated function properly setting up context
+ void operator() () { execute(); }
+
/// Return number of milliseconds between expirations
unsigned long getInterval() const { return _interval; }
Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- server/asobj/NetStream.h 4 Dec 2007 11:45:31 -0000 1.53
+++ server/asobj/NetStream.h 10 Jan 2008 17:34:46 -0000 1.54
@@ -19,7 +19,7 @@
//
//
-/* $Id: NetStream.h,v 1.53 2007/12/04 11:45:31 strk Exp $ */
+/* $Id: NetStream.h,v 1.54 2008/01/10 17:34:46 strk Exp $ */
#ifndef __NETSTREAM_H__
#define __NETSTREAM_H__
@@ -36,6 +36,7 @@
#include "video_stream_instance.h"
#include "NetConnection.h"
#include "FLVParser.h"
+#include "as_function.h" // for visibility of destructor by intrusive_ptr
#include <deque>
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- server/asobj/NetStreamFfmpeg.cpp 12 Dec 2007 10:23:46 -0000 1.102
+++ server/asobj/NetStreamFfmpeg.cpp 10 Jan 2008 17:34:46 -0000 1.103
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: NetStreamFfmpeg.cpp,v 1.102 2007/12/12 10:23:46 zoulunkai Exp $ */
+/* $Id: NetStreamFfmpeg.cpp,v 1.103 2008/01/10 17:34:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -34,6 +34,7 @@
#include "NetConnection.h"
#include "sound_handler.h"
#include "VideoDecoderFfmpeg.h"
+#include "tu_timer.h" // TODO: use the VirtualClock instead ?
#include <boost/scoped_array.hpp>
Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- server/asobj/xml.cpp 7 Jan 2008 20:37:31 -0000 1.64
+++ server/asobj/xml.cpp 10 Jan 2008 17:34:46 -0000 1.65
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: xml.cpp,v 1.64 2008/01/07 20:37:31 strk Exp $ */
+/* $Id: xml.cpp,v 1.65 2008/01/10 17:34:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -40,6 +40,7 @@
#include "URL.h"
#include "VM.h"
#include "namedStrings.h"
+#include "timers.h" // for setting up timers to check loads
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/vm/VM.cpp 5 Jan 2008 02:26:19 -0000 1.29
+++ server/vm/VM.cpp 10 Jan 2008 17:34:46 -0000 1.30
@@ -16,7 +16,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: VM.cpp,v 1.29 2008/01/05 02:26:19 strk Exp $ */
+/* $Id: VM.cpp,v 1.30 2008/01/10 17:34:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -86,7 +86,6 @@
_root_movie(new movie_root()),
_swfversion(topmovie.get_version()),
_swfurl(topmovie.get_url()),
- _start_time(tu_timer::get_ticks()),
mClassHierarchy(0),
mMachine(0),
_clock(clock)
@@ -128,7 +127,7 @@
VM::randomNumberGenerator() const
{
- static RNG rnd(tu_timer::get_ticks());
+ static RNG rnd(_clock.elapsed());
return rnd;
}
Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/vm/VM.h 5 Jan 2008 02:26:19 -0000 1.24
+++ server/vm/VM.h 10 Jan 2008 17:34:46 -0000 1.25
@@ -126,9 +126,6 @@
/// Originating URL
std::string _swfurl;
- /// Time when the VM get started
- boost::uint64_t _start_time;
-
/// Set the _global Object for actions run by Virtual Machine
//
/// Will be called by the init() function
Index: testsuite/swfdec/PASSING
===================================================================
RCS file: /sources/gnash/gnash/testsuite/swfdec/PASSING,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- testsuite/swfdec/PASSING 9 Jan 2008 14:53:18 -0000 1.81
+++ testsuite/swfdec/PASSING 10 Jan 2008 17:34:46 -0000 1.82
@@ -539,6 +539,9 @@
settarget2-tostring-5.swf:66b7402854ca261fc8102c916a3efe6d
settarget2-tostring-7.swf:cfa9318ea413cc8ebf950902c952a3fd
settarget2-tostring-8.swf:ca6f5fe29c73ef074a6ad39c0ecfa1d8
+settimeout-5.swf:0afc40ba5b8c811a1513512692c0180d
+settimeout-6.swf:b3366e3bc859ffd5c4bff3dc936288ce
+settimeout-7.swf:5552479da4b54aca1317ba514a611416
settimeout-clear-self-5.swf:4b87d29d2b95ef3e19b0bd166a663824
settimeout-clear-self-6.swf:c3af4774a839a83d71900e49ffbd472f
settimeout-clear-self-7.swf:be3a0acb447f02e06fe2599c020c3aba
Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- utilities/processor.cpp 29 Dec 2007 13:02:59 -0000 1.79
+++ utilities/processor.cpp 10 Jan 2008 17:34:46 -0000 1.80
@@ -16,7 +16,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: processor.cpp,v 1.79 2007/12/29 13:02:59 strk Exp $ */
+/* $Id: processor.cpp,v 1.80 2008/01/10 17:34:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -45,6 +45,7 @@
#include "VM.h"
#include "noseek_fd_adapter.h"
#include "ManualClock.h"
+#include "tu_timer.h"
extern "C"{
#include <unistd.h>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/array.cpp server/as_envi...,
Sandro Santilli <=