imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp
branchRCL_3
changeset 9 dea39715fc05
parent 5 82749d516180
child 15 f0aa341a25bf
equal deleted inserted replaced
8:7403edfcf0fb 9:dea39715fc05
   141         return;
   141         return;
   142         }
   142         }
   143       
   143       
   144     if ( ClientThreadAlive() )
   144     if ( ClientThreadAlive() )
   145        {
   145        {
   146        TRAP_IGNORE(iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ));
   146        // pass bitmap handle to client
   147        const TSize bitmapSize = aBitmap->SizeInPixels();
       
   148        iBitmapHandle = aBitmap->Handle();
       
   149        aBitmap = NULL;
       
   150        
       
   151        // Complete message and pass bitmap handle to client
       
   152        TThumbnailRequestParams& params = iParamsBuf();
   147        TThumbnailRequestParams& params = iParamsBuf();
   153        TInt ret = iMessage.Read( 0, iParamsBuf );
   148        TInt ret = iMessage.Read( 0, iParamsBuf );
   154        
   149        
   155        if(ret == KErrNone )
   150        if(ret == KErrNone )
   156            {
   151            {
   157            params.iBitmapHandle = iBitmapHandle;
   152            params.iBitmapHandle = aBitmap->Handle();
   158            ret = iMessage.Write( 0, iParamsBuf );
   153            ret = iMessage.Write( 0, iParamsBuf );
   159            }
   154            }
   160        
   155        
   161        Complete( ret );
   156        // add bitmap to pool
   162        ResetMessageData();
   157        TRAPD(err, iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ) );
   163 
   158        if (err != KErrNone)
   164        // Successfully completed the message. The client will send
   159            {
   165        // EReleaseBitmap message later to delete the bitmap from pool.
   160            Complete( err );
   166        // CThumbnailScaleTask is no longer responsible for that.
   161            delete aBitmap;
   167        iBitmapHandle = 0;
   162            aBitmap = NULL;
       
   163            }
       
   164        else
       
   165            {
       
   166            aBitmap = NULL; // Server owns the bitmap now
       
   167        
       
   168            // Complete message
       
   169            Complete( ret );
       
   170            ResetMessageData();
       
   171            }
   168        }
   172        }
   169     else
   173     else
   170         {
   174         {
   171         delete aBitmap;
   175         delete aBitmap;
   172         aBitmap = NULL;
   176         aBitmap = NULL;