Backed out changeset 8b90b21e0c64 (bug 986302) for static build failures

This commit is contained in:
Carsten "Tomcat" Book 2015-07-21 08:53:37 +02:00
Родитель de3872af29
Коммит f7531b86f7
4 изменённых файлов: 1 добавлений и 113 удалений

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

@ -16,7 +16,6 @@
#include "Http2Compression.h"
#include "Http2HuffmanIncoming.h"
#include "Http2HuffmanOutgoing.h"
#include "mozilla/StaticPtr.h"
extern PRThread *gSocketThread;
@ -25,70 +24,12 @@ namespace net {
static nsDeque *gStaticHeaders = nullptr;
class HpackStaticTableReporter final : public nsIMemoryReporter
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
HpackStaticTableReporter() {}
NS_IMETHODIMP
CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
bool aAnonymize)
{
return MOZ_COLLECT_REPORT(
"explicit/network/hpack/static-table", KIND_HEAP, UNITS_BYTES,
gStaticHeaders->SizeOfIncludingThis(MallocSizeOf),
"Memory usage of HPACK static table.");
}
private:
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
~HpackStaticTableReporter() {}
};
NS_IMPL_ISUPPORTS(HpackStaticTableReporter, nsIMemoryReporter)
class HpackDynamicTableReporter final : public nsIMemoryReporter
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
explicit HpackDynamicTableReporter(Http2BaseCompressor* aCompressor)
: mCompressor(aCompressor)
{}
NS_IMETHODIMP
CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
bool aAnonymize)
{
return MOZ_COLLECT_REPORT(
"explicit/network/hpack/dynamic-tables", KIND_HEAP, UNITS_BYTES,
mCompressor->SizeOfExcludingThis(MallocSizeOf),
"Aggregate memory usage of HPACK dynamic tables.");
}
private:
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
~HpackDynamicTableReporter() {}
Http2BaseCompressor* mCompressor;
};
NS_IMPL_ISUPPORTS(HpackDynamicTableReporter, nsIMemoryReporter)
StaticRefPtr<HpackStaticTableReporter> gStaticReporter;
void
Http2CompressionCleanup()
{
// this happens after the socket thread has been destroyed
delete gStaticHeaders;
gStaticHeaders = nullptr;
UnregisterStrongMemoryReporter(gStaticReporter);
gStaticReporter = nullptr;
}
static void
@ -110,8 +51,6 @@ InitializeStaticHeaders()
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (!gStaticHeaders) {
gStaticHeaders = new nsDeque();
gStaticReporter = new HpackStaticTableReporter();
RegisterStrongMemoryReporter(gStaticReporter);
AddStaticElement(NS_LITERAL_CSTRING(":authority"));
AddStaticElement(NS_LITERAL_CSTRING(":method"), NS_LITERAL_CSTRING("GET"));
AddStaticElement(NS_LITERAL_CSTRING(":method"), NS_LITERAL_CSTRING("POST"));
@ -176,17 +115,6 @@ InitializeStaticHeaders()
}
}
size_t nvPair::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
return mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
mValue.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
size_t nvPair::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
nvFIFO::nvFIFO()
: mByteCount(0)
, mTable()
@ -275,13 +203,6 @@ Http2BaseCompressor::Http2BaseCompressor()
: mOutput(nullptr)
, mMaxBuffer(kDefaultMaxBuffer)
{
mDynamicReporter = new HpackDynamicTableReporter(this);
RegisterStrongMemoryReporter(mDynamicReporter);
}
Http2BaseCompressor::~Http2BaseCompressor()
{
UnregisterStrongMemoryReporter(mDynamicReporter);
}
void
@ -290,16 +211,6 @@ Http2BaseCompressor::ClearHeaderTable()
mHeaderTable.Clear();
}
size_t
Http2BaseCompressor::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
size_t size = 0;
for (uint32_t i = mHeaderTable.StaticLength(); i < mHeaderTable.Length(); ++i) {
size += mHeaderTable[i]->SizeOfIncludingThis(aMallocSizeOf);
}
return size;
}
void
Http2BaseCompressor::MakeRoom(uint32_t amount, const char *direction)
{

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

@ -12,7 +12,6 @@
#include "mozilla/Attributes.h"
#include "nsDeque.h"
#include "nsString.h"
#include "nsIMemoryReporter.h"
namespace mozilla {
namespace net {
@ -30,8 +29,6 @@ nvPair(const nsACString &name, const nsACString &value)
{ }
uint32_t Size() const { return mName.Length() + mValue.Length() + 32; }
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
nsCString mName;
nsCString mValue;
@ -57,14 +54,11 @@ private:
nsDeque mTable;
};
class HpackDynamicTableReporter;
class Http2BaseCompressor
{
public:
Http2BaseCompressor();
virtual ~Http2BaseCompressor();
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual ~Http2BaseCompressor() { };
protected:
const static uint32_t kDefaultMaxBuffer = 4096;
@ -77,9 +71,6 @@ protected:
nvFIFO mHeaderTable;
uint32_t mMaxBuffer;
private:
nsRefPtr<HpackDynamicTableReporter> mDynamicReporter;
};
class Http2Compressor;

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

@ -464,9 +464,6 @@ XPCOM_API(nsresult) RegisterStrongMemoryReporter(nsIMemoryReporter* aReporter);
// to this reporter.
XPCOM_API(nsresult) RegisterWeakMemoryReporter(nsIMemoryReporter* aReporter);
// Unregister a strong memory reporter.
XPCOM_API(nsresult) UnregisterStrongMemoryReporter(nsIMemoryReporter* aReporter);
// Unregister a weak memory reporter.
XPCOM_API(nsresult) UnregisterWeakMemoryReporter(nsIMemoryReporter* aReporter);

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

@ -2293,17 +2293,6 @@ RegisterWeakMemoryReporter(nsIMemoryReporter* aReporter)
return mgr->RegisterWeakReporter(aReporter);
}
nsresult
UnregisterStrongMemoryReporter(nsIMemoryReporter* aReporter)
{
nsCOMPtr<nsIMemoryReporterManager> mgr =
do_GetService("@mozilla.org/memory-reporter-manager;1");
if (!mgr) {
return NS_ERROR_FAILURE;
}
return mgr->UnregisterStrongReporter(aReporter);
}
nsresult
UnregisterWeakMemoryReporter(nsIMemoryReporter* aReporter)
{