tstaskmonitor/server/src/tsrunningappstorage.cpp
changeset 104 9b022b1f357c
parent 103 b99b84bcd2d1
equal deleted inserted replaced
103:b99b84bcd2d1 104:9b022b1f357c
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 #include "tsrunningappstorage.h"
    17 #include "tsrunningappstorage.h"
    18 #include "tsfswdatalist.h"
    18 #include "tsdatalist.h"
    19 #include "tsfswentry.h"
    19 #include "tsentry.h"
    20 #include <s32strm.h>
    20 #include <s32strm.h>
    21 #include <s32mem.h>
    21 #include <s32mem.h>
    22 // -----------------------------------------------------------------------------
    22 // -----------------------------------------------------------------------------
    23 //
    23 //
    24 // -----------------------------------------------------------------------------
    24 // -----------------------------------------------------------------------------
    58 // -----------------------------------------------------------------------------
    58 // -----------------------------------------------------------------------------
    59 //
    59 //
    60 void CRunningAppStorage::ConstructL(MTsResourceManager& resources, 
    60 void CRunningAppStorage::ConstructL(MTsResourceManager& resources, 
    61                                     MTsWindowGroupsMonitor &wsMonitor)
    61                                     MTsWindowGroupsMonitor &wsMonitor)
    62 {
    62 {
    63     mEngine = CTsFswDataList::NewL(resources, wsMonitor, *this) ;
    63     mEngine = CTsDataList::NewL(resources, wsMonitor, *this) ;
    64     RArray<RWsSession::TWindowGroupChainInfo> wgList;
    64     RArray<RWsSession::TWindowGroupChainInfo> wgList;
    65     CleanupClosePushL(wgList);
    65     CleanupClosePushL(wgList);
    66     User::LeaveIfError(resources.WsSession().WindowGroupList(&wgList));
    66     User::LeaveIfError(resources.WsSession().WindowGroupList(&wgList));
    67     mEngine->HandleWindowGroupChanged(resources, wgList.Array());
    67     mEngine->HandleWindowGroupChanged(resources, wgList.Array());
    68     CleanupStack::PopAndDestroy(&wgList);
    68     CleanupStack::PopAndDestroy(&wgList);
    95 //
    95 //
    96 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    97 //
    97 //
    98 void CRunningAppStorage::DataChangedL()
    98 void CRunningAppStorage::DataChangedL()
    99 {
    99 {
   100     RTsFswArray taskList = mEngine->FswDataL();
       
   101     CTsFswEntry* entry = CTsFswEntry::NewLC();
       
   102     // Create a dynamic flat buffer to hold this object’s member data
       
   103     
       
   104     const TInt KExpandSize = 256; // "Granularity" of dynamic buffer
   100     const TInt KExpandSize = 256; // "Granularity" of dynamic buffer
   105     CBufFlat* buf = CBufFlat::NewL(KExpandSize);
   101     CBufFlat* buf = CBufFlat::NewL(KExpandSize);
   106     CleanupStack::PushL(buf);
   102     CleanupStack::PushL(buf);
   107     RBufWriteStream stream(*buf); 
   103     RBufWriteStream stream(*buf); 
   108     CleanupClosePushL(stream);
   104     CleanupClosePushL(stream);
   109     entry->ExternalizeArrayL(stream, taskList);
   105     CTsEntry::ExternalizeArrayL(stream, mEngine->Data());
   110     CleanupStack::PopAndDestroy(&stream);
   106     CleanupStack::PopAndDestroy(&stream);
   111     mData.Close();
   107     mData.Close();
   112     mData.CreateL( buf->Size() );
   108     mData.CreateL( buf->Size() );
   113     buf->Read(0, mData, buf->Size());
   109     buf->Read(0, mData, buf->Size());
   114     
       
   115 
       
   116     CleanupStack::PopAndDestroy(buf);
   110     CleanupStack::PopAndDestroy(buf);
   117     CleanupStack::PopAndDestroy(entry);  
       
   118 }
   111 }
   119 
   112 
   120 // -----------------------------------------------------------------------------
   113 // -----------------------------------------------------------------------------
   121 //
   114 //
   122 // -----------------------------------------------------------------------------
   115 // -----------------------------------------------------------------------------
   123 //
   116 //
   124 void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt /*param*/, TInt priority)
   117 void CRunningAppStorage::UpdateL(TInt key, const CFbsBitmap& data, TInt param, TInt priority)
   125     {
   118 {
   126     UpdatePriority newpriority = static_cast<UpdatePriority>(priority);
   119     mEngine->UpdateL(key, data, param, priority);
   127     mEngine->SetScreenshotL(&data, newpriority, key);
   120     
   128     }
   121 }
   129 
   122 
   130 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   131 //
   124 //
   132 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   133 //
   126 //
   134 void CRunningAppStorage::RemoveL(TInt key, TInt /*param*/)
   127 void CRunningAppStorage::UpdateL(TInt key, const Visibility& data, TInt param)
   135     {
   128 {
   136     mEngine->RemoveScreenshotL(key);
   129     mEngine->UpdateL(key, data, param);
   137     }
   130 }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CRunningAppStorage::RemoveL(TInt key, TInt param)
       
   137 {
       
   138     mEngine->RemoveL(key, param);
       
   139 }