[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cpp |
Date: |
Fri, 30 May 2008 13:17:05 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/05/30 13:17:04
Modified files:
. : ChangeLog
server/parser : movie_def_impl.cpp
Log message:
(get_exported_resource):
Rework the check/timeout loop to really sleep between
checks (old code wasn't...). Avoid valgrind runs timing-out
on Dejagnu.swf import.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6765&r2=1.6766
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.111&r2=1.112
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6765
retrieving revision 1.6766
diff -u -b -r1.6765 -r1.6766
--- ChangeLog 29 May 2008 18:10:52 -0000 1.6765
+++ ChangeLog 30 May 2008 13:17:03 -0000 1.6766
@@ -1,3 +1,10 @@
+2008-05-30 Sandro Santilli <address@hidden>
+
+ * server/parser/movie_def_impl.cpp (get_exported_resource):
+ Rework the check/timeout loop to really sleep between
+ checks (old code wasn't...). Avoid valgrind runs timing-out
+ on Dejagnu.swf import.
+
2008-05-29 Benjamin Wolsey <address@hidden>
* server/asobj/Global.cpp: add note on undefined 'this'.
Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- server/parser/movie_def_impl.cpp 29 May 2008 15:40:44 -0000 1.111
+++ server/parser/movie_def_impl.cpp 30 May 2008 13:17:04 -0000 1.112
@@ -769,8 +769,6 @@
boost::intrusive_ptr<resource>
movie_def_impl::get_exported_resource(const std::string& symbol)
{
- boost::intrusive_ptr<resource> res;
-
#ifdef DEBUG_EXPORTS
log_debug(_("get_exported_resource called, frame count=%u"),
m_frame_count);
#endif
@@ -794,12 +792,16 @@
const unsigned long naptime=500000;
// Timeout after two seconds of NO frames progress
- const unsigned long def_timeout=2000000/naptime;
+ const unsigned long timeout_ms=2000000;
+ const unsigned long def_timeout=timeout_ms/naptime;
unsigned long timeout=def_timeout;
size_t loading_frame = (size_t)-1; // used to keep track of advancements
- for (;;)
+
+ for(;;)
{
+ size_t new_loading_frame = get_loading_frame();
+
// _exportedResources access is thread-safe
{
boost::mutex::scoped_lock lock(_exportedResourcesMutex);
@@ -807,8 +809,6 @@
if ( it != _exportedResources.end() ) return it->second;
}
- size_t new_loading_frame = get_loading_frame();
-
if ( new_loading_frame != loading_frame )
{
#ifdef DEBUG_EXPORTS
@@ -817,60 +817,34 @@
loading_frame, new_loading_frame);
#endif
loading_frame = new_loading_frame;
- timeout = def_timeout;
+ timeout = def_timeout+1;
}
- else
- {
- if ( ! timeout-- )
+ else if ( ! --timeout || loading_frame >= m_frame_count )
{
- log_error(_("No frame progress in movie %s "
- "after %lu milliseconds "
- "(%lu microseconds = %lu iterations), "
- "giving up on "
- "get_exported_resource(%s): "
- "circular IMPORTS?"),
- get_url(),
- (def_timeout*naptime)/1000,
- def_timeout*naptime,
- def_timeout,
- symbol);
- return res;
+ break;
}
-#ifdef DEBUG_EXPORTS
- log_debug(_("No frame progress at iteration %lu of
get_exported_resource(%s)"),
- timeout, symbol);
-#endif
+ // take a breath to give other threads more time to advance
+ usleep(naptime);
- continue; // not worth checking
}
- if ( loading_frame >= m_frame_count )
+ if ( ! timeout ) // timed out
{
-#ifdef DEBUG_EXPORTS
- boost::mutex::scoped_lock lock(_exportedResourcesMutex);
- log_debug(_("At end of stream, still no '%s' symbol
found "
- "in _exportedResources (%d entries in it, "
- "follow)"), symbol, _exportedResources.size());
- for (ExportMap::const_iterator
it=_exportedResources.begin(); it!=_exportedResources.end(); ++it)
- {
- log_debug(" symbol %s (%s)", it->first,
typeName(*(it->second)));
+ log_error("Timeout (%d milliseconds) seeking export symbol %s
in movie %s. "
+ "Frames loaded %d/%d",
+ timeout_ms/1000, symbol, _url, loading_frame,
m_frame_count);
}
-#endif
- return res;
+ else // eof
+ {
+ assert(loading_frame >= m_frame_count);
+ log_error("No export symbol %s found in movie %s. "
+ "Frames loaded %d/%d",
+ symbol, _url, loading_frame, m_frame_count);
}
-#ifdef DEBUG_EXPORTS
- log_debug(_("We haven't finished loading (loading frame %u), "
- "and _exportedResources.get returned no entries, "
- "sleeping a bit and trying again"),
- get_loading_frame());
-#endif
-
- usleep(naptime); // take a breath
- }
+ return boost::intrusive_ptr<resource>(0); // 0
- return res;
}
void