gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp... [relea


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp... [release_0_7_2]
Date: Thu, 16 Nov 2006 21:38:56 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         release_0_7_2
Changes by:     Sandro Santilli <strk>  06/11/16 21:38:55

Modified files:
        .              : ChangeLog 
        server/parser  : movie_def_impl.cpp movie_def_impl.h 

Log message:
        back-port of the IMPORT tag loader fix (most work done in 
movie_def_impl::get_exported_resource). Note that this patch is *better* in 
release branch then in head, will need to fwd-port again (safer locking)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.1412.2.178&r2=1.1412.2.179
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.30.2.4&r2=1.30.2.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.12.2.2&r2=1.12.2.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1412.2.178
retrieving revision 1.1412.2.179
diff -u -b -r1.1412.2.178 -r1.1412.2.179
--- ChangeLog   16 Nov 2006 08:55:02 -0000      1.1412.2.178
+++ ChangeLog   16 Nov 2006 21:38:55 -0000      1.1412.2.179
@@ -1,5 +1,15 @@
 2006-11-15 Sandro Santilli <address@hidden>
 
+       * server/parser/movie_def_impl.{cpp,h}:
+         get_exported_resource() and export_resource() moved
+         from header to implementation file.
+         get_exported_resource() changed to take incremental
+         loading into account, by making sure the whole
+         stream has been parsed before returning a failure
+         (the EXPORT tag might be at the end of the stream!)
+
+2006-11-16 Sandro Santilli <address@hidden>
+
        * macros/agg.m4: don't assume AGG is installed
          if agg_gradient_lut.h is not found.
 

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.30.2.4
retrieving revision 1.30.2.5
diff -u -b -r1.30.2.4 -r1.30.2.5
--- server/parser/movie_def_impl.cpp    8 Nov 2006 02:13:21 -0000       1.30.2.4
+++ server/parser/movie_def_impl.cpp    16 Nov 2006 21:38:55 -0000      1.30.2.5
@@ -946,5 +946,87 @@
 
 }
 
+void
+movie_def_impl::export_resource(const tu_string& symbol, resource* res)
+{
+       // FIXME: m_exports access should be protected by a mutex
+
+       // SWF sometimes exports the same thing more than once!
+       m_exports[symbol] = res;
+}
+
+
+smart_ptr<resource>
+movie_def_impl::get_exported_resource(const tu_string& symbol)
+{
+       smart_ptr<resource> res;
+
+//#define DEBUG_EXPORTS
+
+#ifdef DEBUG_EXPORTS
+       log_msg("get_exported_resource called, frame count=%u", m_frame_count);
+#endif
+
+       // FIXME: a movie importing from itself will likely
+       //        end up in a dead lock
+
+       // this is a simple utility so we don't forget
+       // to release our locks...
+       struct scoped_loader_locker {
+               MovieLoader& _loader;
+               scoped_loader_locker(MovieLoader& loader)
+                       :
+                       _loader(loader)
+               {
+                       _loader.lock();
+               }
+               ~scoped_loader_locker()
+               {
+                       _loader.unlock();
+               }
+       };
+
+       // Keep trying until either we found the export or
+       // the stream is over.
+       bool found=false;
+       for (;;)
+       {
+               {
+               // lock the loader
+               scoped_loader_locker locker(_loader);
+       
+               if ( m_exports.get(symbol, &res) )
+               {
+                       found=true;
+                       break;
+               }
+
+               // be aware of not getting the lock twice
+               // (can happen if get_loading_frame() becomes
+               //  a locking function)
+               if ( get_loading_frame() >= m_frame_count ) break;
+
+#ifdef DEBUG_EXPORTS
+               log_msg("We haven't finished loading (loading frame %u), "
+                       "and m_exports.get returned no entries, "
+                       "sleeping a bit and trying again",
+                       get_loading_frame());
+#endif
+               }
+
+               usleep(100); // take a breath
+       }
+
+       if ( ! found )
+       {
+               log_msg("At end of stream, still no '%s' symbol found "
+                       "in m_exports (%u entries in it)",
+                       symbol.c_str(), m_exports.size());
+       }
+
+       return res;
+}
+
+
 } // namespace gnash
 

Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -u -b -r1.12.2.2 -r1.12.2.3
--- server/parser/movie_def_impl.h      15 Nov 2006 09:58:29 -0000      1.12.2.2
+++ server/parser/movie_def_impl.h      16 Nov 2006 21:38:55 -0000      1.12.2.3
@@ -322,20 +322,12 @@
        /// Expose one of our resources under the given symbol,
        /// for export.  Other movies can import it.
        virtual void export_resource(const tu_string& symbol,
-                       resource* res)
-       {
-           // SWF sometimes exports the same thing more than once!
-           m_exports[symbol] = res;
-       }
+                       resource* res);
 
        /// Get the named exported resource, if we expose it.
        /// Otherwise return NULL.
-       virtual smart_ptr<resource> get_exported_resource(const tu_string& 
symbol)
-       {
-           smart_ptr<resource> res;
-           m_exports.get(symbol, &res);
-           return res;
-       }
+       virtual smart_ptr<resource> get_exported_resource(
+                       const tu_string& symbol);
 
        /// Adds an entry to a table of resources that need to
        /// be imported from other movies.  Client code must




reply via email to

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