This commit is contained in:
warren%netscape.com 1999-09-26 05:52:24 +00:00
Родитель bc69b1199e
Коммит 48e53dfd90
4 изменённых файлов: 106 добавлений и 11 удалений

Просмотреть файл

@ -28,6 +28,11 @@ RESFILE = viewer.res
RCFLAGS=/d_DEBUG
!endif
# define PURIFY in your environment, and put pure.h and pure_api.c in this directory
!ifdef PURIFY
RCFLAGS=/dPURIFY
LCFLAGS=-DPURIFY
!endif
OBJS = \
.\$(OBJDIR)\nsBaseDialog.obj \
@ -44,6 +49,9 @@ OBJS = \
.\$(OBJDIR)\nsWebCrawler.obj \
.\$(OBJDIR)\nsWinMain.obj \
.\$(OBJDIR)\JSConsole.obj \
!ifdef PURIFY
.\$(OBJDIR)\pure_api.obj \
!endif
$(NULL)
LINCS= \

Просмотреть файл

@ -16,6 +16,7 @@
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsIPref.h"
#include "prmem.h"
@ -112,6 +113,9 @@ static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
#endif
#ifdef PURIFY
#include "pure.h"
#endif
#define THROBBING_N
@ -433,6 +437,52 @@ HandleLocationEvent(nsGUIEvent *aEvent)
return result;
}
#ifdef PURIFY
static void
DispatchPurifyEvent(PRInt32 aID)
{
if (!PurifyIsRunning()) {
printf("!!! Re-run viewer under Purify to use this menu item.\n");
return;
}
switch (aID) {
case VIEWER_PURIFY_SHOW_NEW_LEAKS:
PurifyPrintf("viewer: new leaks");
PurifyNewLeaks();
break;
case VIEWER_PURIFY_SHOW_ALL_LEAKS:
PurifyPrintf("viewer: all leaks");
PurifyAllLeaks();
break;
case VIEWER_PURIFY_CLEAR_ALL_LEAKS:
PurifyPrintf("viewer: clear leaks");
PurifyClearLeaks();
break;
case VIEWER_PURIFY_SHOW_ALL_HANDLES_IN_USE:
PurifyPrintf("viewer: all handles");
PurifyAllHandlesInuse();
break;
case VIEWER_PURIFY_SHOW_NEW_IN_USE:
PurifyPrintf("viewer: new in-use");
PurifyNewInuse();
break;
case VIEWER_PURIFY_SHOW_ALL_IN_USE:
PurifyPrintf("viewer: all in-use");
PurifyAllInuse();
break;
case VIEWER_PURIFY_CLEAR_ALL_IN_USE:
PurifyPrintf("viewer: clear in-use");
PurifyClearInuse();
break;
case VIEWER_PURIFY_HEAP_VALIDATE:
PurifyPrintf("viewer: heap validate");
PurifyHeapValidate(PURIFY_HEAP_ALL, PURIFY_HEAP_BLOCKS_ALL, NULL);
break;
}
}
#endif
nsEventStatus
nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
{
@ -573,6 +623,19 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
DoImageInspector();
break;
#ifdef PURIFY
case VIEWER_PURIFY_SHOW_NEW_LEAKS:
case VIEWER_PURIFY_SHOW_ALL_LEAKS:
case VIEWER_PURIFY_CLEAR_ALL_LEAKS:
case VIEWER_PURIFY_SHOW_ALL_HANDLES_IN_USE:
case VIEWER_PURIFY_SHOW_NEW_IN_USE:
case VIEWER_PURIFY_SHOW_ALL_IN_USE:
case VIEWER_PURIFY_CLEAR_ALL_IN_USE:
case VIEWER_PURIFY_HEAP_VALIDATE:
DispatchPurifyEvent(aID);
break;
#endif
case VIEWER_ZOOM_500:
case VIEWER_ZOOM_300:
case VIEWER_ZOOM_200:

Просмотреть файл

@ -153,4 +153,15 @@
#define IDC_SITE_NAME 40402
#define ID_EXIT 40404
#define VIEWER_PURIFY_SHOW_NEW_LEAKS 40910
#define VIEWER_PURIFY_SHOW_ALL_LEAKS 40911
#define VIEWER_PURIFY_CLEAR_ALL_LEAKS 40912
#define VIEWER_PURIFY_SHOW_ALL_HANDLES_IN_USE 40913
#define VIEWER_PURIFY_SHOW_NEW_IN_USE 40914
#define VIEWER_PURIFY_SHOW_ALL_IN_USE 40915
#define VIEWER_PURIFY_CLEAR_ALL_IN_USE 40916
#define VIEWER_PURIFY_HEAP_VALIDATE 40917
#endif /* resources_h___ */

Просмотреть файл

@ -156,6 +156,19 @@ VIEWER MENU DISCARDABLE
MENUITEM "Set Background YELLOW" VIEWER_EDIT_SET_BGCOLOR_YELLOW
}
}
#if defined(PURIFY)
POPUP "&Purify"
{
MENUITEM "Show New Leaks", VIEWER_PURIFY_SHOW_NEW_LEAKS
MENUITEM "Show All Leaks", VIEWER_PURIFY_SHOW_ALL_LEAKS
MENUITEM "Clear All Leaks", VIEWER_PURIFY_CLEAR_ALL_LEAKS
MENUITEM "Show All Handles In Use", VIEWER_PURIFY_SHOW_ALL_HANDLES_IN_USE
MENUITEM "Show New In Use", VIEWER_PURIFY_SHOW_NEW_IN_USE
MENUITEM "Show All In Use", VIEWER_PURIFY_SHOW_ALL_IN_USE
MENUITEM "Clear All In Use", VIEWER_PURIFY_CLEAR_ALL_IN_USE
MENUITEM "Heap Validate", VIEWER_PURIFY_HEAP_VALIDATE
}
#endif
}
PRINTPREVIEW MENU DISCARDABLE