Skip to content

Commit 8dbef9c

Browse files
author
Ed Morley
committed
Backed out changeset 240333c3d2c1 (bug 964039)
1 parent 6fee27b commit 8dbef9c

21 files changed

+31
-681
lines changed

netwerk/cache2/CacheEntry.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "nsICacheStorage.h"
1616
#include "nsISerializable.h"
1717
#include "nsIStreamTransportService.h"
18-
#include "nsISizeOf.h"
1918

2019
#include "nsComponentManagerUtils.h"
2120
#include "nsServiceManagerUtils.h"
@@ -1546,40 +1545,5 @@ NS_IMETHODIMP CacheOutputCloseListener::Run()
15461545
return NS_OK;
15471546
}
15481547

1549-
// Memory reporting
1550-
1551-
size_t CacheEntry::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
1552-
{
1553-
size_t n = 0;
1554-
nsCOMPtr<nsISizeOf> sizeOf;
1555-
1556-
n += mCallbacks.SizeOfExcludingThis(mallocSizeOf);
1557-
if (mFile) {
1558-
n += mFile->SizeOfIncludingThis(mallocSizeOf);
1559-
}
1560-
1561-
sizeOf = do_QueryInterface(mURI);
1562-
if (sizeOf) {
1563-
n += sizeOf->SizeOfIncludingThis(mallocSizeOf);
1564-
}
1565-
1566-
n += mEnhanceID.SizeOfExcludingThisIfUnshared(mallocSizeOf);
1567-
n += mStorageID.SizeOfExcludingThisIfUnshared(mallocSizeOf);
1568-
1569-
// mDoomCallback is an arbitrary class that is probably reported elsewhere.
1570-
// mOutputStream is reported in mFile.
1571-
// mWriter is one of many handles we create, but (intentionally) not keep
1572-
// any reference to, so those unfortunatelly cannot be reported. Handles are
1573-
// small, though.
1574-
// mSecurityInfo doesn't impl nsISizeOf.
1575-
1576-
return n;
1577-
}
1578-
1579-
size_t CacheEntry::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
1580-
{
1581-
return mallocSizeOf(this) + SizeOfExcludingThis(mallocSizeOf);
1582-
}
1583-
15841548
} // net
15851549
} // mozilla

netwerk/cache2/CacheEntry.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ class CacheEntry : public nsICacheEntry
105105
double mFrecency;
106106
uint32_t mSortingExpirationTime;
107107

108-
// Memory reporting
109-
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
110-
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
111-
112108
private:
113109
virtual ~CacheEntry();
114110

netwerk/cache2/CacheFile.cpp

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ CacheFile::Unlock()
923923
}
924924

925925
void
926-
CacheFile::AssertOwnsLock() const
926+
CacheFile::AssertOwnsLock()
927927
{
928928
mLock.AssertCurrentThreadOwns();
929929
}
@@ -1559,57 +1559,5 @@ CacheFile::InitIndexEntry()
15591559
return NS_OK;
15601560
}
15611561

1562-
// Memory reporting
1563-
1564-
namespace { // anon
1565-
1566-
size_t
1567-
CollectChunkSize(uint32_t const & aIdx,
1568-
nsRefPtr<mozilla::net::CacheFileChunk> const & aChunk,
1569-
mozilla::MallocSizeOf mallocSizeOf, void* aClosure)
1570-
{
1571-
return aChunk->SizeOfIncludingThis(mallocSizeOf);
1572-
}
1573-
1574-
} // anon
1575-
1576-
size_t
1577-
CacheFile::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
1578-
{
1579-
CacheFileAutoLock lock(const_cast<CacheFile*>(this));
1580-
1581-
size_t n = 0;
1582-
n += mChunks.SizeOfExcludingThis(CollectChunkSize, mallocSizeOf);
1583-
n += mCachedChunks.SizeOfExcludingThis(CollectChunkSize, mallocSizeOf);
1584-
if (mMetadata) {
1585-
n += mMetadata->SizeOfIncludingThis(mallocSizeOf);
1586-
}
1587-
1588-
// Input streams are not elsewhere reported.
1589-
n += mInputs.SizeOfExcludingThis(mallocSizeOf);
1590-
for (uint32_t i = 0; i < mInputs.Length(); ++i) {
1591-
n += mInputs[i]->SizeOfIncludingThis(mallocSizeOf);
1592-
}
1593-
1594-
// Output streams are not elsewhere reported.
1595-
if (mOutput) {
1596-
n += mOutput->SizeOfIncludingThis(mallocSizeOf);
1597-
}
1598-
1599-
// The listeners are usually classes reported just above.
1600-
n += mChunkListeners.SizeOfExcludingThis(nullptr, mallocSizeOf);
1601-
n += mObjsToRelease.SizeOfExcludingThis(mallocSizeOf);
1602-
1603-
// mHandle reported directly from CacheFileIOManager.
1604-
1605-
return n;
1606-
}
1607-
1608-
size_t
1609-
CacheFile::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
1610-
{
1611-
return mallocSizeOf(this) + SizeOfExcludingThis(mallocSizeOf);
1612-
}
1613-
16141562
} // net
16151563
} // mozilla

netwerk/cache2/CacheFile.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ class CacheFile : public CacheFileChunkListener
9999
void Key(nsACString& aKey) { aKey = mKey; }
100100
bool IsDoomed();
101101

102-
// Memory reporting
103-
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
104-
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
105-
106102
private:
107103
friend class CacheFileIOManager;
108104
friend class CacheFileChunk;
@@ -115,7 +111,7 @@ class CacheFile : public CacheFileChunkListener
115111

116112
void Lock();
117113
void Unlock();
118-
void AssertOwnsLock() const;
114+
void AssertOwnsLock();
119115
void ReleaseOutsideLock(nsISupports *aObject);
120116

121117
nsresult GetChunk(uint32_t aIndex, bool aWriter,

netwerk/cache2/CacheFileChunk.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -597,23 +597,23 @@ CacheFileChunk::OnFileRenamed(CacheFileHandle *aHandle, nsresult aResult)
597597
}
598598

599599
bool
600-
CacheFileChunk::IsReady() const
600+
CacheFileChunk::IsReady()
601601
{
602602
mFile->AssertOwnsLock();
603603

604604
return (mState == READY || mState == WRITING);
605605
}
606606

607607
bool
608-
CacheFileChunk::IsDirty() const
608+
CacheFileChunk::IsDirty()
609609
{
610610
mFile->AssertOwnsLock();
611611

612612
return mIsDirty;
613613
}
614614

615615
char *
616-
CacheFileChunk::BufForWriting() const
616+
CacheFileChunk::BufForWriting()
617617
{
618618
mFile->AssertOwnsLock();
619619

@@ -627,7 +627,7 @@ CacheFileChunk::BufForWriting() const
627627
}
628628

629629
const char *
630-
CacheFileChunk::BufForReading() const
630+
CacheFileChunk::BufForReading()
631631
{
632632
mFile->AssertOwnsLock();
633633

@@ -677,24 +677,5 @@ CacheFileChunk::EnsureBufSize(uint32_t aBufSize)
677677
DoMemoryReport(MemorySize());
678678
}
679679

680-
// Memory reporting
681-
682-
size_t
683-
CacheFileChunk::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
684-
{
685-
size_t n = 0;
686-
n += mallocSizeOf(mBuf);
687-
n += mallocSizeOf(mRWBuf);
688-
n += mValidityMap.SizeOfExcludingThis(mallocSizeOf);
689-
690-
return n;
691-
}
692-
693-
size_t
694-
CacheFileChunk::SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const
695-
{
696-
return mallocSizeOf(this) + SizeOfExcludingThis(mallocSizeOf);
697-
}
698-
699680
} // net
700681
} // mozilla

netwerk/cache2/CacheFileChunk.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,13 @@ class CacheFileChunk : public CacheFileIOListener
9494
NS_IMETHOD OnEOFSet(CacheFileHandle *aHandle, nsresult aResult);
9595
NS_IMETHOD OnFileRenamed(CacheFileHandle *aHandle, nsresult aResult);
9696

97-
bool IsReady() const;
98-
bool IsDirty() const;
97+
bool IsReady();
98+
bool IsDirty();
9999

100-
char * BufForWriting() const;
101-
const char * BufForReading() const;
100+
char * BufForWriting();
101+
const char * BufForReading();
102102
void EnsureBufSize(uint32_t aBufSize);
103-
uint32_t MemorySize() const { return mRWBufSize + mBufSize; }
104-
105-
// Memory reporting
106-
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
107-
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
103+
uint32_t MemorySize() { return mRWBufSize + mBufSize; }
108104

109105
private:
110106
friend class CacheFileInputStream;

0 commit comments

Comments
 (0)