[Top][All Lists]
[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: |
Mon, 02 Jul 2007 00:18:26 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/07/02 00:18:26
Modified files:
. : ChangeLog
server : movie_root.cpp movie_root.h
testsuite : simple.exp
Log message:
* testsuite/simple.exp: increment timeout from 4 to 5 minutes.
* server/movie_root.{cpp,h}: store Timers into a map rather then
a vector, to allow for removal w/out loosing the timer
identifier.
Scan a *copy* of the container so that clearing or adding new
intervals don't invalidate iterators.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3630&r2=1.3631
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/simple.exp?cvsroot=gnash&r1=1.11&r2=1.12
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3630
retrieving revision 1.3631
diff -u -b -r1.3630 -r1.3631
--- ChangeLog 1 Jul 2007 17:34:58 -0000 1.3630
+++ ChangeLog 2 Jul 2007 00:18:24 -0000 1.3631
@@ -1,5 +1,13 @@
2007-07-01 Sandro Santilli <address@hidden>
+ * testsuite/simple.exp: increment timeout from 4 to 5 minutes.
+ * server/movie_root.{cpp,h}: store Timers into a map rather then
+ a vector, to allow for removal w/out loosing the timer identifier.
+ Scan a *copy* of the container so that clearing or adding new
+ intervals don't invalidate iterators.
+
+2007-07-01 Sandro Santilli <address@hidden>
+
* libbase/ref_counted.h: use 'long' for the ref count,
cleanup header inclusion, prepare for using an atomic
counter for thread safety (not enabled yet).
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- server/movie_root.cpp 1 Jul 2007 10:54:23 -0000 1.70
+++ server/movie_root.cpp 2 Jul 2007 00:18:25 -0000 1.71
@@ -70,6 +70,7 @@
m_on_event_xmlsocket_ondata_called(false),
m_on_event_xmlsocket_onxml_called(false),
m_on_event_load_progress_called(false),
+ _lastTimerId(0),
m_active_input_text(NULL),
m_time_remainder(0.0f),
m_drag_state(),
@@ -529,20 +530,23 @@
{
assert(testInvariant());
- int id = _intervalTimers.size()+1;
+ unsigned int id = ++_lastTimerId;
if ( _intervalTimers.size() >= 255 )
{
+ // TODO: Why this limitation ?
log_error("FIXME: " SIZET_FMT " timers currently active, won't
add another one", _intervalTimers.size());
}
- // TODO: find first NULL element in vector for reuse ?
- _intervalTimers.push_back(timer);
+ assert(_intervalTimers.find(id) == _intervalTimers.end());
+ _intervalTimers[id] = timer;
return id;
}
bool
movie_root::clear_interval_timer(unsigned int x)
{
+ return _intervalTimers.erase(x);
+#if 0
if ( ! x || x > _intervalTimers.size() ) return false;
Timer& timer = _intervalTimers[x-1];
@@ -553,6 +557,7 @@
assert(testInvariant());
return true;
+#endif
}
void
@@ -560,13 +565,16 @@
{
// GNASH_REPORT_FUNCTION;
+ // Copy to avoid timers invalidation.
+ // TODO: we might want to use pointers as elements rather then values,
+ // so to allow disabling of a timer (ie: should we still execute
expired
+ // timers if a previous timer execution cleared it ?)
// TODO: wrap this in a executeTimers() method
- for (TimerList::iterator it=_intervalTimers.begin(),
- itEnd=_intervalTimers.end();
- it != itEnd;
- ++it)
+ TimerMap timers = _intervalTimers;
+ for (TimerMap::iterator it=timers.begin(), itEnd=timers.end();
+ it != itEnd; ++it)
{
- Timer& timer = *it;
+ Timer& timer = it->second;
if ( timer.expired() )
{
// log_msg("FIXME: Interval Timer Expired!\n");
@@ -574,6 +582,7 @@
timer();
}
}
+
#ifndef NEW_KEY_LISTENER_LIST_DESIGN
// Cleanup key listeners (remove unloaded characters)
// FIXME: not all key listeners could be cleaned here!
@@ -1028,10 +1037,10 @@
m_mouse_button_state.markReachableResources();
// Mark timer targets
- for (TimerList::const_iterator i=_intervalTimers.begin(),
e=_intervalTimers.end();
+ for (TimerMap::const_iterator i=_intervalTimers.begin(),
e=_intervalTimers.end();
i != e; ++i)
{
- i->markReachableResources();
+ i->second.markReachableResources();
}
// Mark resources reachable by queued action code
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/movie_root.h 1 Jul 2007 10:54:23 -0000 1.61
+++ server/movie_root.h 2 Jul 2007 00:18:25 -0000 1.62
@@ -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.61 2007/07/01 10:54:23 bjacques Exp $ */
+/* $Id: movie_root.h,v 1.62 2007/07/02 00:18:25 strk Exp $ */
/// \page events_handling Handling of user events
///
@@ -521,13 +521,10 @@
bool m_on_event_xmlsocket_onxml_called;
bool m_on_event_load_progress_called;
- // TODO: should maintain refcount ?
- // FIXME: std::vector is not an appropriate container
- // for timers, as we'll be removing them from the
- // list but still want Timer "identifiers" to be
- // valid.
- typedef std::vector<Timer> TimerList;
- TimerList _intervalTimers;
+ typedef std::map<int, Timer> TimerMap;
+
+ TimerMap _intervalTimers;
+ unsigned int _lastTimerId;
/// A set of as_objects kept by intrusive_ptr
typedef std::set< boost::intrusive_ptr<as_object> > ListenerSet;
Index: testsuite/simple.exp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/simple.exp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- testsuite/simple.exp 7 Mar 2007 16:57:15 -0000 1.11
+++ testsuite/simple.exp 2 Jul 2007 00:18:25 -0000 1.12
@@ -12,7 +12,7 @@
# This is to handle deadlocks. We don't reset the timeout when a match is
# found to avoid hanging in case of a testcase sending matches in an infinite
loops.
# (not unlikely as it seems, think about flash movies...)
-set timeout 240
+set timeout 300
set file all
set params ""
- [Gnash-commit] gnash ChangeLog server/movie_root.cpp server/mo...,
Sandro Santilli <=