diff -r e5af45d51884 -r 31fccae4f8a7 uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Tue Aug 31 16:07:35 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Wed Sep 01 12:16:53 2010 +0100 @@ -163,6 +163,20 @@ { // Get the config for this plugin CGOomRunPluginConfig& pluginConfig = aConfig.GetPluginConfig(iPluginList->Uid(pluginIndex)); + TInt priority = pluginConfig.CalculatePluginPriority(aWindowGroupList); + + TGOomSyncMode syncMode = pluginConfig.iSyncMode; + TInt ramEstimate = pluginConfig.iRamEstimate; + + TActionRef::TActionType actionType; + + if (pluginConfig.PluginType() == EGOomAppPlugin) + { + actionType = TActionRef::EAppPlugin; + } + else + actionType = TActionRef::ESystemPlugin; + //get skip plugin config for foreground app TUint foregroundUid = iMonitor.ForegroundAppUid(); @@ -183,27 +197,12 @@ continue ; //skip this and continue with next plugin } } - - actionsIndex--; - CGOomRunPluginConfig * nextConfigForSamePlugin = &pluginConfig; - while(nextConfigForSamePlugin) - { - TInt priority = nextConfigForSamePlugin->CalculatePluginPriority(aWindowGroupList); - TGOomSyncMode syncMode = nextConfigForSamePlugin->iSyncMode; - TInt ramEstimate = nextConfigForSamePlugin->iRamEstimate; - TActionRef::TActionType actionType; - if (nextConfigForSamePlugin->PluginType() == EGOomAppPlugin) - actionType = TActionRef::EAppPlugin; - else - actionType = TActionRef::ESystemPlugin; - - TActionRef ref = TActionRef(actionType, priority, syncMode, ramEstimate, *(iRunPluginActions[++actionsIndex]), aWindowGroupList.GetIndexFromAppId(nextConfigForSamePlugin->TargetApp())); - iAppsProtectedByPlugins.Append(nextConfigForSamePlugin->TargetApp()); - TRACES2("Creating Plugin Action Item %x , TargetAppId %x", iPluginList->Uid(pluginIndex), nextConfigForSamePlugin->TargetApp()); - //It is valid to have plugins with equal priority - User::LeaveIfError(iActionRefs.InsertInOrderAllowRepeats(ref, ComparePriorities)); - nextConfigForSamePlugin = nextConfigForSamePlugin->iNextConfig; - } + + TActionRef ref = TActionRef(actionType, priority, syncMode, ramEstimate, *(iRunPluginActions[actionsIndex]), aWindowGroupList.GetIndexFromAppId(pluginConfig.TargetApp())); + iAppsProtectedByPlugins.Append(pluginConfig.TargetApp()); + TRACES2("Creating Plugin Action Item %x , TargetAppId %x", iPluginList->Uid(pluginIndex), pluginConfig.TargetApp()); + //It is valid to have plugins with equal priority + User::LeaveIfError(iActionRefs.InsertInOrderAllowRepeats(ref, ComparePriorities)); actionsIndex++; } @@ -236,7 +235,7 @@ if (aWindowGroupList.Count()) { // Go through each item in the wglist, create an app close action for this application - TInt wgIndex = aWindowGroupList.Count() - 1; + TInt wgIndex = 0; TRACES1("BuildActionListL: Windowgroup list count %d ",aWindowGroupList.Count()); @@ -247,7 +246,7 @@ TRACES1("BuildActionListL: Foreground App %x ", foregroundUid); - while (wgIndex >= 0) + while (wgIndex < aWindowGroupList.Count()) { CGOomCloseAppConfig* appCloseConfig = NULL; @@ -257,7 +256,8 @@ if(AppCloseActionAlreadyExists(aWindowGroupList, appId)) { - wgIndex--; + TRACES2("CGOomActionList::BuildKillAppActionListL - Action item already exists for this app %x wgid %d", appId, aWindowGroupList.WgId(wgIndex).iId) + wgIndex++; continue; } @@ -319,7 +319,7 @@ TRACES3("BuildActionListL: Adding app to action list, Uid = %x, wgId = %d, wgIndex = %d", appId, wgId, wgIndex); } - wgIndex--; + wgIndex++; } } @@ -335,7 +335,10 @@ if(ref.Type() == TActionRef::EAppClose ) { if(aWindowGroupList.AppIdfromWgId(ref.WgId(), ETrue) == appId) + { + TRACES2("CGOomActionList::AppCloseActionAlreadyExists AppId %x already added with wgid %d",appId, ref.WgId()); return ETrue; + } } } return EFalse; @@ -662,19 +665,21 @@ { FUNC_LOG; - TInt index = iCloseAppActions.Count(); - TRACES1("CGOomCloseApp::AppNotExiting: count of actions %d",index); + TInt index = 0; - while (index--) + while (index < iCloseAppActions.Count()) { CGOomCloseApp* action = iCloseAppActions[index]; - TRACES3("CGOomCloseApp::AppNotExiting: %d %d %d", aWgId, action->WgId(), action->IsRunning()); + TRACES3("CGOomCloseApp::AppNotExiting: recvd from %d , checking against %d , isRunning %d", aWgId, action->WgId(), action->IsRunning()); if ( (action->WgId() == aWgId) && (action->IsRunning()) ) { - TRACES1("CGOomCloseApp::AppNotExiting: App with window group id %d has not responded to the close event", aWgId); + TRACES1("CGOomCloseApp::AppNotExiting: App with window group id %d has responded to the close event", aWgId); action->CloseAppEvent(); + break; } + + index++; } } @@ -738,7 +743,6 @@ } else { - iMonitor.SwitchMemMode(CMemoryMonitor::EGOomLowMemMode); TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory); iRunningKillAppActions = ETrue; iMonitor.RunCloseAppActions(iMaxPriority); @@ -784,14 +788,6 @@ CGOomRunPlugin* action = CGOomRunPlugin::NewL(iPluginList->Uid(pluginIndex), pluginConfig, *this, iPluginList->Implementation(pluginIndex)); iRunPluginActions.AppendL(action); - - CGOomRunPluginConfig * nextConfigForSamePlugin = pluginConfig.iNextConfig; - while(nextConfigForSamePlugin) - { - CGOomRunPlugin* action = CGOomRunPlugin::NewL(iPluginList->Uid(pluginIndex), *(nextConfigForSamePlugin), *this, iPluginList->Implementation(pluginIndex)); - iRunPluginActions.AppendL(action); - nextConfigForSamePlugin = nextConfigForSamePlugin->iNextConfig; - } } //references to v2 plugin types removed as these are not yet used by GOOM