From 80d4e2a7b06d7141da05f00fd4eec3c177a8ccbf Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Tue, 9 Apr 2002 04:03:39 +0000 Subject: [PATCH] bug 125100 Undoing resident size trimming and heapmin. sr=alecf, r=blythe, a=asa git-svn-id: svn://10.0.0.236/trunk@118526 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/appshell/src/nsXULWindow.cpp | 73 ----------------------- 1 file changed, 73 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index fd46ee2bd72..4d2f44774fb 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -67,10 +67,6 @@ #include "nsStyleConsts.h" -#if defined(XP_WIN32) -#include // for SetProcessWorkingSetSize() -#include // for _heapmin() -#endif // XXX Get rid of this #pragma message("WARNING: XXX bad include, remove it.") #include "nsIWebShellWindow.h" @@ -352,27 +348,6 @@ NS_IMETHODIMP nsXULWindow::Destroy() mBeingDestroyed = PR_TRUE; -#if defined(XP_WIN32) - // Heap compact if this the close of a major window - // like composer, mail, browser - PRBool compact = PR_FALSE; - nsCOMPtr windowElement; - GetWindowDOMElement(getter_AddRefs(windowElement)); - if (windowElement) - { - nsAutoString windowType; - nsresult rv = windowElement->GetAttribute(WINDOWTYPE_ATTRIBUTE, windowType); - if (NS_SUCCEEDED(rv) && - (windowType.Equals(NS_LITERAL_STRING("mail:3pane")) || - windowType.Equals(NS_LITERAL_STRING("navigator:browser")) || - windowType.Equals(NS_LITERAL_STRING("composer:html")) || - windowType.Equals(NS_LITERAL_STRING("msgcompose")))) - { - compact = PR_TRUE; - } - } -#endif - nsCOMPtr parentWindow(do_QueryReferent(mParentWindow)); if (parentWindow) parentWindow->RemoveChildWindow(this); @@ -447,54 +422,6 @@ NS_IMETHODIMP nsXULWindow::Destroy() mWindow = nsnull; } -#if defined(XP_WIN32) - if (compact) - { - // Heap compaction and shrink working set now -#ifdef DEBUG_dp - PRIntervalTime start = PR_IntervalNow(); - int ret = -#endif - _heapmin(); -#ifdef DEBUG_dp - printf("DEBUG: HeapCompact() %s - %d ms\n", (!ret ? "success" : "FAILED"), - PR_IntervalToMilliseconds(PR_IntervalNow()-start)); -#endif - - // shrink working set if we can - // static to figure out address of SetProcessWorkingSetSize() - // This function call is available only on winnt and above. - typedef BOOL WINAPI SetProcessWorkingSetProc(HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, - SIZE_T dwMaximumWorkingSetSize); - static PRBool firstTime = PR_TRUE; - static SetProcessWorkingSetProc *setProcessWorkingSetSizeP = NULL; - - if (firstTime) - { - firstTime = PR_FALSE; - HMODULE kernel = GetModuleHandle("kernel32.dll"); - if (kernel) - { - setProcessWorkingSetSizeP = (SetProcessWorkingSetProc *) - GetProcAddress(kernel, "SetProcessWorkingSetSize"); - } - } - - if (setProcessWorkingSetSizeP) - { - // shrink working set -#ifdef DEBUG_dp - start = PR_IntervalNow(); -#endif - (*setProcessWorkingSetSizeP)(GetCurrentProcess(), -1, -1); -#ifdef DEBUG_dp - printf("DEBUG: Honey! I shrunk the resident-set! - %d ms\n", - PR_IntervalToMilliseconds(PR_IntervalNow() - start)); -#endif - } - } // compact -#endif - return NS_OK; }