[IPHONE] closing model caches on handling EnterBackground.

This commit is contained in:
rachytski 2011-03-22 00:54:04 +02:00 committed by Alex Zolotarev
parent 72271e3849
commit f000196e74
4 changed files with 30 additions and 8 deletions

View file

@ -42,6 +42,7 @@ withConfidenceRadius: (double) confidenceRadius
// called when app is terminated by system
- (void) OnTerminate;
- (void) OnEnterForeground;
- (void) OnEnterBackground;
- (void) Invalidate;

View file

@ -312,7 +312,8 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
- (void) OnTerminate
{
[self OnEnterBackground];
if (m_framework)
m_framework->SaveState();
}
- (void) Invalidate
@ -328,7 +329,19 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
if (m_framework)
{ // save world rect for next launch
m_framework->SaveState();
m_framework->SetUpdatesEnabled(false);
m_framework->SaveState();
m_framework->EnterBackground();
}
}
- (void) OnEnterForeground
{
if (m_framework)
{
m_framework->EnterForeground();
if (!m_framework->SetUpdatesEnabled(true))
m_framework->Invalidate();
}
}

View file

@ -24,6 +24,11 @@
[mapViewController OnEnterBackground];
}
- (void) applicationWillEnterForeground: (UIApplication *) application
{
[mapViewController OnEnterForeground];
}
- (void) applicationDidFinishLaunching: (UIApplication *) application
{
// Add the tab bar controller's current view as a subview of the window

View file

@ -456,38 +456,41 @@ public:
void MemoryWarning()
{
// clearing caches on memory warning.
m_model.ClearCaches();
m_informationDisplay.memoryWarning();
LOG(LINFO, ("MemoryWarning"));
/* m_informationDisplay.memoryWarning();
m_renderQueue.memoryWarning();
if (m_windowHandle)
m_windowHandle->drawer()->screen()->memoryWarning();
if (m_resourceManager)
m_resourceManager->memoryWarning();
m_resourceManager->memoryWarning();*/
}
void EnterBackground()
{
// clearing caches on entering background.
m_model.ClearCaches();
m_renderQueue.enterBackground();
/* m_renderQueue.enterBackground();
if (m_windowHandle)
m_windowHandle->drawer()->screen()->enterBackground();
if (m_resourceManager)
m_resourceManager->enterBackground();
m_resourceManager->enterBackground();*/
}
void EnterForeground()
{
if (m_resourceManager)
/* if (m_resourceManager)
m_resourceManager->enterForeground();
if (m_windowHandle)
m_windowHandle->drawer()->screen()->enterForeground();
m_renderQueue.enterForeground();
m_renderQueue.enterForeground();*/
}
void CenterViewport()