webengine/osswebengine/WebCore/platform/symbian/bitmap/SyncDecodeThread.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
--- a/webengine/osswebengine/WebCore/platform/symbian/bitmap/SyncDecodeThread.cpp	Thu Aug 19 10:58:56 2010 +0300
+++ b/webengine/osswebengine/WebCore/platform/symbian/bitmap/SyncDecodeThread.cpp	Tue Aug 31 16:17:46 2010 +0300
@@ -20,13 +20,13 @@
 #include <e32std.h> 
 #include "SyncDecodeThread.h"
 #include "MaskedBitmap.h"
-#include <ImageConversion.h>
+#include <imageconversion.h>
 
 namespace TBidirectionalState {
     class TRunInfo;
 };
 
-#include <EIKENV.H> 
+#include <eikenv.h> 
 
 #define KMaxHeapSize 0x1000000
 
@@ -40,7 +40,7 @@
         TInt iMaskHandle;
 };
 
-enum DecoderState {ENewDecodeRequest, EDecodeInProgress, EDecoderIdle, EDecoderTerminate};
+enum DecoderState {ENewDecodeRequest, EDecodeInProgress, EDecoderIdle};
 class CSynDecoder : public CActive
     {
     public:  // Constructors and destructor
@@ -51,7 +51,6 @@
         void Open(const TDesC8& aData, TRequestStatus *status);
         void Lock() { iDecoderLock.Wait(); }
         void Release() { iDecoderLock.Signal(); }
-        void Terminate() { iDecodeState = EDecoderTerminate; }
 
     private: // From base class CActive
         void DoCancel();
@@ -71,6 +70,7 @@
         CMaskedBitmap* iBitmap;
         RFastLock iDecoderLock;
         DecoderState iDecodeState;
+        RThread syncThread;
 
 friend class CSynDecodeThread;        
     };
@@ -119,10 +119,6 @@
 // -----------------------------------------------------------------------------
 void CSynDecoder::Open(const TDesC8& aData, TRequestStatus *status)
 {
-    // FbsSession is needed for parent thread if it doesn't have already
-    if(!RFbsSession::GetSession())
-        RFbsSession::Connect();
-
     iElem.iRequestStatus = status;
     iElem.iData.Set(aData); 
     iElem.iParentThreadId = RThread().Id();
@@ -134,7 +130,6 @@
 void CSynDecoder::SetIdle()
 {
     iDecodeState = EDecoderIdle;
-    iElem.iParentThreadId = 0;
     if(!IsActive()) {
         iStatus = KRequestPending;
         SetActive();
@@ -208,12 +203,6 @@
         SignalParent(iStatus.Int());
         SetIdle();
         break;
-    case EDecoderTerminate:
-        // if any thread is waiting for decode, signal it
-        if( iElem.iParentThreadId )
-            SignalParent(KErrCompletion);
-        CActiveScheduler::Stop();
-        break;
     default:
         SetIdle();
     }        
@@ -256,32 +245,15 @@
 
 CSynDecodeThread::~CSynDecodeThread()
 {
-    // signal the thread to do cleanup and stop
-    iSyncDecoder->Terminate();
-    TRequestStatus *ps = &(iSyncDecoder->iStatus);
-    iDecoderThread.RequestComplete(ps, KErrNone);
-    
-	iDecoderThread.Close();    
+    CActiveScheduler::Stop(); 
+	iDecoderThread.Close();
 }
 
 void CSynDecodeThread::ConstructL()
 {   
-    _LIT(KThreadName, "iconDecoder");
+    _LIT(KThreadName, "ImgDecoder");
     RAllocator &allocator = User::Allocator();
-    TInt err = iDecoderThread.Create(KThreadName, CSynDecodeThread::ScaleInThread, KDefaultStackSize, &allocator, NULL);
-    if(err == KErrAlreadyExists) {
-        // It may happen only in rare cases, if container browserengine..dll was unloaded and loaded again before
-        // syncDecodeThread could close itself (scheduled). In that case, we kill that thread since we can't reuse that
-        // and create a new one with same name.
-        RThread th;
-        th.Open(KThreadName);
-        th.Kill(KErrNone);
-        th.Close();
-
-        // Leave this time if problem still exists
-        User::LeaveIfError(iDecoderThread.Create(KThreadName, CSynDecodeThread::ScaleInThread, KDefaultStackSize, &allocator, NULL));
-    }
-
+    User::LeaveIfError(iDecoderThread.Create(KThreadName, CSynDecodeThread::ScaleInThread, KDefaultStackSize, &allocator, NULL));
     iDecoderThread.SetPriority(EPriorityMore);
     TRequestStatus status = KRequestPending;
     iDecoderThread.Rendezvous(status);