Moved nsMonitorable::MonitorLocker constructor and destructor into their

own cpp file. IRIX NuCache was not accepting inlined ones.
This commit is contained in:
gagan%netscape.com 1998-10-05 22:48:38 +00:00
parent 9773eecb93
commit 811ddc3c00
4 changed files with 21 additions and 20 deletions

View File

@ -29,6 +29,7 @@
//#include "nsISupports.h"
#include "prmon.h"
#include "prlog.h"
class nsMonitorable//: public nsISupports
{
@ -51,15 +52,8 @@ protected:
class MonitorLocker
{
public:
MonitorLocker(nsMonitorable* i_pThis):
m_pMonitorable(i_pThis)
{
if (m_pMonitorable) m_pMonitorable->Lock();
}
~MonitorLocker()
{
if (m_pMonitorable) m_pMonitorable->Unlock();
}
MonitorLocker(nsMonitorable* i_pThis);
~MonitorLocker();
private:
nsMonitorable* m_pMonitorable;
};

View File

@ -44,6 +44,7 @@ CPPSRCS = nsCacheObject.cpp \
CacheStubs.cpp \
nsFileStream.cpp \
nsMemStream.cpp \
nsMonitorable.cpp \
$(NULL)
REQUIRES = dbm nspr pref xpcom js

View File

@ -54,6 +54,7 @@ OBJS = \
.\$(OBJDIR)\CacheStubs.obj \
.\$(OBJDIR)\nsFileStream.obj \
.\$(OBJDIR)\nsMemStream.obj \
.\$(OBJDIR)\nsMonitorable.obj \
$(NULL)
LINCS = \

View File

@ -24,6 +24,7 @@
#include "prtypes.h"
#include "prinrval.h"
#include "plstr.h"
#include "prprf.h" //PR_smprintf and PR_smprintf_free
#include "nsCacheManager.h"
#include "nsCacheTrace.h"
@ -196,17 +197,20 @@ nsCacheManager::GetModule(PRInt16 i_index) const
void
nsCacheManager::InfoAsHTML(char* o_Buffer) const
{
MonitorLocker ml((nsMonitorable*)this);
char tmpbuffer[256];
MonitorLocker ml((nsMonitorable*)this);
/* TODO - make this cool */
sprintf(tmpbuffer, "<HTML><h2>Your cache has %d modules</h2> \
It has a total of %d cache objects. Hang in there for the details. </HTML>\0",
Entries(),
NumberOfObjects());
PL_strncpyz(o_Buffer, tmpbuffer, PL_strlen(tmpbuffer)+1);
}
char* tmpBuffer =/* TODO - make this cool */
PR_smprintf("<HTML><h2>Your cache has %d modules</h2> \
It has a total of %d cache objects. Hang in there for the details. </HTML>\0",
Entries(),
NumberOfObjects());
if (tmpBuffer)
{
PL_strncpyz(o_Buffer, tmpBuffer, PL_strlen(tmpBuffer)+1);
PR_smprintf_free(tmpBuffer);
}
}
void
nsCacheManager::Init()
@ -289,4 +293,5 @@ NumberOfObjects(void)
objs += TheManager.GetModule(--i)->Entries();
}
return objs;
}
}