memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp
branchRCL_3
changeset 59 8ad140f3dd41
parent 49 7fdc9a71d314
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
   121     {
   121     {
   122     CItem* item = iItems[ aIndex ];
   122     CItem* item = iItems[ aIndex ];
   123     return TPtrC( item->Combined() );
   123     return TPtrC( item->Combined() );
   124     }
   124     }
   125 
   125 
   126 EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Caption(TInt aIndex ) const
       
   127 	{
       
   128 	CItem* item = iItems[ aIndex ];
       
   129 	return TPtrC( item->Caption() );
       
   130 	}
       
   131 
       
   132 EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Value(TInt aIndex ) const
       
   133 	{
       
   134 	CItem* item = iItems[ aIndex ];
       
   135 	return TPtrC( item->Value() );
       
   136 	}
       
   137 
   126 
   138 EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const
   127 EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const
   139     {
   128     {
   140     return iContainer.Engine();
   129     return iContainer.Engine();
   141     }
   130     }
  1700 #ifdef _DEBUG
  1689 #ifdef _DEBUG
  1701     RDebug::Print( _L("CMemSpyThreadInfoSession::ConnectionCount() - START - aName: %S"), &aName );
  1690     RDebug::Print( _L("CMemSpyThreadInfoSession::ConnectionCount() - START - aName: %S"), &aName );
  1702 #endif
  1691 #endif
  1703 
  1692 
  1704     // See if we have an entry with that name...
  1693     // See if we have an entry with that name...
  1705     TInt foundIndex = 0;
  1694     TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
  1706     TRAP(ret, foundIndex = FindServerL(aName));
  1695     HBufC* name = aName.AllocLC();
       
  1696     CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
       
  1697     CleanupStack::Pop( name );
       
  1698     CleanupStack::PushL( entry );
       
  1699     const TInt foundIndex = iServerNames.Find( entry, comparer );
       
  1700     CleanupStack::PopAndDestroy( entry );
  1707     
  1701     
  1708     if (ret == KErrNone)
  1702     // If we did, get the count
  1709         {
  1703     if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
  1710         // If we did, get the count
  1704         {
  1711         if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
  1705         ret = iServerNames[ foundIndex ]->iCount;
  1712             {
  1706         }
  1713             ret = iServerNames[ foundIndex ]->iCount;
  1707     //
  1714             }
       
  1715         }
       
  1716 
       
  1717 #ifdef _DEBUG
  1708 #ifdef _DEBUG
  1718     RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret );
  1709     RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret );
  1719 #endif
  1710 #endif
  1720     //
  1711     //
  1721     return ret;
  1712     return ret;
  1722     }
  1713     }
  1723 
  1714 
  1724 TInt CMemSpyThreadInfoSession::FindServerL( const TDesC& aName ) const
       
  1725     {
       
  1726     TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
       
  1727     HBufC* name = aName.AllocLC();
       
  1728     CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
       
  1729     CleanupStack::Pop( name ); // don't destroy it as name is now owned by entry 
       
  1730     CleanupStack::PushL( entry );
       
  1731     const TInt foundIndex = iServerNames.Find( entry, comparer );
       
  1732     User::LeaveIfError(foundIndex); // so we only return a real index
       
  1733     CleanupStack::PopAndDestroy( entry );
       
  1734     return foundIndex;
       
  1735     }
       
  1736 
  1715 
  1737 void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
  1716 void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
  1738     {
  1717     {
  1739     // Check whether we have the item already
  1718     // Check whether we have the item already?
  1740     TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
  1719     TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
  1741 
  1720 
  1742     // Prepare object, just in case we don't find it...
  1721     // Prepare object, just in case we don't find it...
  1743     HBufC* name = aFullName.AllocLC();
  1722     HBufC* name = aFullName.AllocLC();
  1744 
  1723