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: Thu, 20 Dec 2007 22:31:31 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/20 22:31:31

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp LoadThread.h 

Log message:
        (setupCache) fix current position and _completed computation, (reset) 
join thread.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5230&r2=1.5231
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5230
retrieving revision 1.5231
diff -u -b -r1.5230 -r1.5231
--- ChangeLog   20 Dec 2007 21:50:09 -0000      1.5230
+++ ChangeLog   20 Dec 2007 22:31:31 -0000      1.5231
@@ -1,3 +1,8 @@
+2007-12-20 Sandro Santilli <address@hidden>
+
+       * libbase/LoadThread.{cpp,h}: (setupCache) fix current position
+         and _completed computation, (reset) join thread.
+
 2007-12-20  Rob Savoye  <address@hidden>
 
        * server/asobj/SharedObject.cpp: Make less verbose, don't dump

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libbase/LoadThread.cpp      12 Dec 2007 10:06:59 -0000      1.17
+++ libbase/LoadThread.cpp      20 Dec 2007 22:31:31 -0000      1.18
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: LoadThread.cpp,v 1.17 2007/12/12 10:06:59 zoulunkai Exp $
+// $Id: LoadThread.cpp,v 1.18 2007/12/20 22:31:31 strk Exp $
 
 #include "LoadThread.h"
 
@@ -47,6 +47,14 @@
 void
 LoadThread::reset()
 {
+#ifdef THREADED_LOADS
+       boost::mutex::scoped_lock lock(_mutex);
+       if ( _thread.get() )
+       {
+               _thread->join();
+               _thread.reset(NULL);
+       }
+#endif
        _completed=false;
        _loadPosition=0;
        _userPosition=0;
@@ -60,7 +68,6 @@
        _streamSize=0;
        _needAccess=false;
        _stream.reset();
-       _thread.reset();
 }
 
 LoadThread::~LoadThread()
@@ -280,11 +287,15 @@
        _cache.reset( new boost::uint8_t[1024*500] );
        _cacheSize = 1024*500;
 
-       int ret = _stream->read_bytes(_cache.get(), 1024);
+    size_t setupSize = 1024;
+
+       size_t ret = _stream->read_bytes(_cache.get(), setupSize);
        _cacheStart = 0;
        _cachedData = ret;
-       _loadPosition = 1024;
+       _loadPosition = ret;
        _streamSize = _stream->get_size();
+
+    if ( ret < setupSize ) _completed = true;
 }
 
 void LoadThread::downloadThread(LoadThread* lt)

Index: libbase/LoadThread.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- libbase/LoadThread.h        12 Dec 2007 10:06:59 -0000      1.16
+++ libbase/LoadThread.h        20 Dec 2007 22:31:31 -0000      1.17
@@ -26,6 +26,7 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/bind.hpp>
 #include <boost/scoped_array.hpp>
+#include <boost/noncopyable.hpp>
 
 #include <memory>
 
@@ -54,7 +55,7 @@
 /// @todo When we read from a real movie stream (rtmp) we might
 /// want to use a cirkular-buffer.
 
-class DSOEXPORT LoadThread
+class DSOEXPORT LoadThread : private boost::noncopyable
 {
 
 public:
@@ -135,6 +136,7 @@
        volatile long _userPosition;
        volatile long _actualPosition;
 
+       // If true, download request was canceled
     bool _cancelRequested;
 
        // Cache...




reply via email to

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