Bug 745075 - Close disk cache when pausing. r=gbrown f=mfinkle,michal

This commit is contained in:
Brian Nicholson 2012-04-17 10:29:52 -07:00
parent 047aceb802
commit 8b681e655b
2 changed files with 12 additions and 0 deletions

View File

@ -106,6 +106,7 @@ LOCAL_INCLUDES += \
-I$(topsrcdir)/toolkit/components/places \
-I$(topsrcdir)/docshell/base \
-I$(topsrcdir)/content/events/src \
-I$(topsrcdir)/netwerk/cache \
-I$(srcdir) \
$(NULL)

View File

@ -48,6 +48,7 @@
#include "nsIObserverService.h"
#include "nsIAppStartup.h"
#include "nsIGeolocationProvider.h"
#include "nsCacheService.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
@ -330,6 +331,11 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
obsServ->NotifyObservers(nsnull, "application-background", nsnull);
// If we are OOM killed with the disk cache enabled, the entire
// cache will be cleared (bug 105843), so shut down the cache here
// and re-init on resume
nsCacheService::GlobalInstance()->Shutdown();
}
// We really want to send a notification like profile-before-change,
@ -458,6 +464,11 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
case AndroidGeckoEvent::ACTIVITY_RESUMING: {
if (curEvent->Flags() == 0) {
// If we are OOM killed with the disk cache enabled, the entire
// cache will be cleared (bug 105843), so shut down cache on pause
// and re-init here
nsCacheService::GlobalInstance()->Init();
// We didn't return from one of our own activities, so restore
// to foreground status
nsCOMPtr<nsIObserverService> obsServ =