gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...
Date: Tue, 10 Jun 2008 07:14:31 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/06/10 07:14:31

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp LoadThread.h 
        server/asobj   : LoadVars.cpp xml.cpp 

Log message:
        * libbase/LoadThread.{cpp,h}: take the IOChannel input at construction
          time
        * server/asobj/LoadVars.cpp: update calls to LoadThread.
        * server/asobj/xml.cpp: update calls to LoadThread.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6879&r2=1.6880
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.cpp?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.83&r2=1.84

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6879
retrieving revision 1.6880
diff -u -b -r1.6879 -r1.6880
--- ChangeLog   10 Jun 2008 07:03:01 -0000      1.6879
+++ ChangeLog   10 Jun 2008 07:14:29 -0000      1.6880
@@ -1,5 +1,12 @@
 2008-06-10 Sandro Santilli <address@hidden>
 
+       * libbase/LoadThread.{cpp,h}: take the IOChannel input at construction
+         time
+       * server/asobj/LoadVars.cpp: update calls to LoadThread.
+       * server/asobj/xml.cpp: update calls to LoadThread.
+
+2008-06-10 Sandro Santilli <address@hidden>
+
        * testsuite/libbase/NoSeekFileTest.cpp: fix build (don't use
          'read' as a variable name, being already a library function).
 

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libbase/LoadThread.cpp      10 Jun 2008 06:12:11 -0000      1.27
+++ libbase/LoadThread.cpp      10 Jun 2008 07:14:30 -0000      1.28
@@ -27,10 +27,11 @@
 # include "unistd.h" // for usleep()
 #endif
 
-using namespace gnash;
+namespace gnash {
 
-LoadThread::LoadThread()
+LoadThread::LoadThread(std::auto_ptr<IOChannel> stream)
        :
+       _stream(stream),
        _completed(false),
        _loadPosition(0),
        _userPosition(0),
@@ -44,6 +45,15 @@
        _streamSize(0),
        _needAccess(false)
 {
+       assert(_stream.get());
+
+       // Start the downloading.
+       setupCache(); // what for ??
+#ifdef THREADED_LOADS
+       _thread.reset( new 
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
+#else
+       downloadThread(this);
+#endif
 }
 
 void
@@ -102,25 +112,6 @@
     return _cancelRequested;
 }
 
-bool LoadThread::setStream(std::auto_ptr<gnash::IOChannel> stream)
-{
-       _stream = stream;
-       if (_stream.get() != NULL) {
-               // Start the downloading.
-               setupCache();
-               _cancelRequested = false;
-#ifdef THREADED_LOADS
-               _thread.reset( new 
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
-#else
-               downloadThread(this);
-#endif
-
-               return true;
-       } else {
-               return false;
-       }
-}
-
 int
 LoadThread::seek(size_t pos)
 {
@@ -421,3 +412,4 @@
 
 }
 
+} // namespace gnash

Index: libbase/LoadThread.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- libbase/LoadThread.h        10 Jun 2008 06:12:11 -0000      1.22
+++ libbase/LoadThread.h        10 Jun 2008 07:14:30 -0000      1.23
@@ -16,8 +16,8 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef __LOADTHREAD_H__
-#define __LOADTHREAD_H__
+#ifndef GNASH_LOADTHREAD_H
+#define GNASH_LOADTHREAD_H
 
 
 #include "IOChannel.h"
@@ -34,11 +34,12 @@
 // This is useful for debugging.
 #define THREADED_LOADS 1
 
+namespace gnash {
 
 /// \brief
 /// The LoadThread class can be used to download from a file
 /// or stream using a thread, without having to block.
-///
+//
 /// When the object is created it starts a thread which seeks forward
 /// in the IOCHannel given as an argument to the constructor, which will
 /// make cause the IOChannel backend to download the amount of data needed
@@ -49,26 +50,19 @@
 /// not been downloaded enough data to accomendate a request (seek/read)
 /// it will block until the data is present (curl_adaptor behavoir).
 ///
-/// When using the LoadThread, all access to the gnash::IOChannel should be
+/// When using the LoadThread, all access to the IOChannel should be
 /// done through LoadThread, or it will likely break.
 ///
-/// @todo When we read from a real movie stream (rtmp) we might
-/// want to use a cirkular-buffer.
-
 class DSOEXPORT LoadThread : private boost::noncopyable
 {
 
 public:
-       /// Just sets up the object
-       LoadThread();
+       /// Create a LoadThread using to the given IOChannel as input
+       LoadThread(std::auto_ptr<IOChannel> str);
 
        /// Stops the download if still running
        ~LoadThread();
 
-       /// Sets the stream used for the connection, and starts the download
-       /// is the stream is valid. Returns true is the stream is valid, and 
else false.
-       bool setStream(std::auto_ptr<gnash::IOChannel> str);
-
        /// Put read pointer at given position
        //
        /// Will block if there is not enough data buffered,
@@ -142,7 +136,7 @@
        void fillCache();
 
        /// The stream/file we want to access
-       std::auto_ptr<gnash::IOChannel> _stream;
+       std::auto_ptr<IOChannel> _stream;
 
        volatile bool _completed;
 
@@ -188,4 +182,6 @@
        void reset();
 };
 
-#endif // __LOADTHREAD_H__
+} // namespace gnash
+
+#endif // GNASH_LOADTHREAD_H

Index: server/asobj/LoadVars.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/asobj/LoadVars.cpp   9 Jun 2008 14:31:55 -0000       1.49
+++ server/asobj/LoadVars.cpp   10 Jun 2008 07:14:30 -0000      1.50
@@ -347,8 +347,7 @@
 
        bool startTimer = _loadThreads.empty();
 
-       std::auto_ptr<LoadThread> lt ( new LoadThread );
-       lt->setStream(str);
+       std::auto_ptr<LoadThread> lt ( new LoadThread(str) );
 
        // we push on the front to avoid invalidating
        // iterators when queueLoad is called as effect

Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- server/asobj/xml.cpp        9 Jun 2008 14:31:55 -0000       1.83
+++ server/asobj/xml.cpp        10 Jun 2008 07:14:30 -0000      1.84
@@ -430,8 +430,7 @@
 
     bool startTimer = _loadThreads.empty();
 
-    std::auto_ptr<LoadThread> lt ( new LoadThread );
-    lt->setStream(str);
+    std::auto_ptr<LoadThread> lt ( new LoadThread(str) );
 
     // we push on the front to avoid invalidating
     // iterators when queueLoad is called as effect




reply via email to

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