Bug 662122: Add leak logging annotations to some WebSockets classes. r=mcmanus

This commit is contained in:
Kyle Huey 2011-06-07 13:12:19 -07:00
Родитель 3d7f74d60d
Коммит 5ba1a90b24
2 изменённых файлов: 23 добавлений и 10 удалений

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

@ -265,15 +265,18 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsPostMessage, nsIRunnable)
class nsWSAdmissionManager
{
public:
nsWSAdmissionManager() {}
nsWSAdmissionManager()
{
MOZ_COUNT_CTOR(nsWSAdmissionManager);
}
class nsOpenConn
{
public:
nsOpenConn(nsCString &addr, nsWebSocketHandler *handler)
: mAddress(addr), mHandler(handler)
{}
~nsOpenConn() {}
{ MOZ_COUNT_CTOR(nsOpenConn); }
~nsOpenConn() {MOZ_COUNT_DTOR(nsOpenConn); }
nsCString mAddress;
nsRefPtr<nsWebSocketHandler> mHandler;
@ -281,6 +284,7 @@ public:
~nsWSAdmissionManager()
{
MOZ_COUNT_DTOR(nsWSAdmissionManager);
for (PRUint32 i = 0; i < mData.Length(); i++)
delete mData[i];
}
@ -351,6 +355,8 @@ public:
mContext(aContext),
mListener(aListener)
{
MOZ_COUNT_CTOR(nsWSCompression);
mZlib.zalloc = allocator;
mZlib.zfree = destructor;
mZlib.opaque = Z_NULL;
@ -372,6 +378,8 @@ public:
~nsWSCompression()
{
MOZ_COUNT_DTOR(nsWSCompression);
if (mActive)
deflateEnd(&mZlib);
}

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

@ -67,7 +67,6 @@ namespace mozilla { namespace net {
class nsPostMessage;
class nsWSAdmissionManager;
class nsWSCompression;
class WSCallOnInputStreamReady;
class nsWebSocketHandler : public nsIWebSocketProtocol,
public nsIHttpUpgradeListener,
@ -129,8 +128,7 @@ protected:
private:
friend class nsPostMessage;
friend class nsWSAdmissionManager;
friend class WSCallOnInputStreamReady;
void SendMsgInternal(nsCString *aMsg, PRInt32 datalen);
void PrimeNewOutgoingMessage();
void GeneratePong(PRUint8 *payload, PRUint32 len);
@ -156,15 +154,22 @@ private:
{
public:
OutboundMessage (nsCString *str)
: mMsg(str), mIsControl(PR_FALSE), mBinaryLen(-1) {}
: mMsg(str), mIsControl(PR_FALSE), mBinaryLen(-1)
{ MOZ_COUNT_CTOR(WebSocketOutboundMessage); }
OutboundMessage (nsCString *str, PRInt32 dataLen)
: mMsg(str), mIsControl(PR_FALSE), mBinaryLen(dataLen) {}
: mMsg(str), mIsControl(PR_FALSE), mBinaryLen(dataLen)
{ MOZ_COUNT_CTOR(WebSocketOutboundMessage); }
OutboundMessage ()
: mMsg(nsnull), mIsControl(PR_TRUE), mBinaryLen(-1) {}
: mMsg(nsnull), mIsControl(PR_TRUE), mBinaryLen(-1)
{ MOZ_COUNT_CTOR(WebSocketOutboundMessage); }
~OutboundMessage() { delete mMsg; }
~OutboundMessage()
{
MOZ_COUNT_DTOR(WebSocketOutboundMessage);
delete mMsg;
}
PRBool IsControl() { return mIsControl; }
const nsCString *Msg() { return mMsg; }