Fix for bug 20743 -- implement a memory cushion for Mac, to better handle low memory conditions. r=pinkerton

git-svn-id: svn://10.0.0.236/trunk@74723 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sfraser%netscape.com
2000-07-25 01:04:55 +00:00
parent f304a6a21b
commit cf8acf4b78
4 changed files with 118 additions and 2 deletions

View File

@@ -84,6 +84,15 @@ NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv)
mMacSink = auto_ptr<nsMacMessageSink>( new nsMacMessageSink() );
nsIToolkit* toolkit = mToolkit.get();
mMacPump = auto_ptr<nsMacMessagePump>( new nsMacMessagePump(static_cast<nsToolkit*>(toolkit), mMacSink.get()) );
mMacMemoryCushion = auto_ptr<nsMacMemoryCushion>( new nsMacMemoryCushion() );
if (!mMacSink.get() || !mMacPump.get() || !mMacMemoryCushion.get())
return NS_ERROR_OUT_OF_MEMORY;
OSErr err = mMacMemoryCushion->Init(nsMacMemoryCushion::kMemoryReserveSize);
if (err != noErr)
return NS_ERROR_FAILURE;
return NS_OK;
}
@@ -97,6 +106,7 @@ NS_IMETHODIMP nsAppShell::Run(void)
if (!mMacPump.get())
return NS_ERROR_NOT_INITIALIZED;
mMacMemoryCushion->StartRepeating();
mMacPump->StartRunning();
mMacPump->DoMessagePump();