diff -r 516af714ebb4 -r f2950aff7424 perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp --- a/perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp Fri Sep 17 08:38:31 2010 +0300 +++ b/perfsrv/memspy/Engine/Source/ClientServer/MemSpyEngineServer.cpp Mon Oct 04 02:45:59 2010 +0300 @@ -20,8 +20,7 @@ // System includes #include #include -#include -#include +//#include // User includes #include @@ -556,8 +555,9 @@ RArray wgArray; CleanupClosePushL( wgArray ); User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) ); - TApaTask task( wsSession ); - TBool brought( EFalse ); + + //TApaTask task( wsSession ); + TBool brought = EFalse; TInt wgId( KErrNotFound ); TThreadId threadId; @@ -571,16 +571,27 @@ User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); if ( threadId == id() ) { - CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); - task.SetWgId( wgId ); - if ( !wgName->Hidden() && task.Exists() ) + TInt handle = wsSession.GetWindowGroupHandle( wgId ); + if( handle == KErrNone ) { - task.BringToForeground(); - brought = ETrue; + RWindowGroup* group = new (ELeave) RWindowGroup(); + group->Construct( handle ); + group->SetOrdinalPosition( 0 ); //foreground + + brought = ETrue; + + group->Close(); + delete group; } - CleanupStack::PopAndDestroy( wgName ); + } + //task.SetWgId( wgId ); + //if ( !wgName->Hidden() && task.Exists() ) + // { + // task.BringToForeground(); + // brought = ETrue; + // } } - } + TPckgBuf ret( brought ); aMessage.WriteL( 1, ret ); @@ -892,7 +903,8 @@ TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread ); if (error == KErrNone && thread) { - data.iId = thread->Process().Id(); + data.iProcessId = thread->Process().Id(); + data.iThreadId = thread->Id(); } data.iName.Copy(server.Name().Left(KMaxFullName)); data.iSessionCount = server.SessionCount(); @@ -933,7 +945,14 @@ const CMemSpyEngineServerEntry& server = list->At(i); TMemSpyServerData data; - data.iId = server.Id(); + CMemSpyProcess* process = NULL; + CMemSpyThread* thread = NULL; + TInt error = iEngine.Container().ProcessAndThreadByThreadId( server.Id(), process, thread ); + if (error == KErrNone && thread) + { + data.iProcessId = thread->Process().Id(); + data.iThreadId = thread->Id(); + } data.iName.Copy(server.Name().Left(KMaxFullName)); data.iSessionCount = server.SessionCount(); @@ -1227,6 +1246,59 @@ break; } + case EMemSpyClientServerOpGetWindowGroupCount: + { + if (!iEngine.IsHelperWindowServerSupported()) + { + User::Leave(KErrNotSupported); + } + + RWsSession windowSession; + windowSession.Connect(); + TInt result = windowSession.NumWindowGroups(); + windowSession.Close(); + User::LeaveIfError(result); + + aMessage.WriteL(0, TPckgBuf(result)); + break; + } + + case EMemSpyClientServerOpGetWindowGroups: + { + if (!iEngine.IsHelperWindowServerSupported()) + { + User::Leave(KErrNotSupported); + } + + RArray groups; + CleanupClosePushL( groups ); + + iEngine.HelperWindowServer().GetWindowGroupListL( groups ); + + TPckgBuf a0; + aMessage.ReadL(0, a0); + TInt realCount = Min(a0(), groups.Count()); + + for (TInt i=0, offset = 0; i buffer(data); + aMessage.WriteL(1, buffer, offset); + } + + a0 = realCount; + aMessage.WriteL(0, a0); + + CleanupStack::PopAndDestroy( &groups ); + + break; + } + + } }