mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
883849ee32
This patch was automatically generated using the following script: function convert() { echo "Converting $1 to $2..." find . \ ! -wholename "*/.git*" \ ! -wholename "obj-ff-dbg*" \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert MOZ_OVERRIDE override convert MOZ_FINAL final
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* A memory allocator for zlib use in SPDY that reports to about:memory. */
|
|
|
|
#ifndef mozilla_net_SpdyZlibReporter_h
|
|
#define mozilla_net_SpdyZlibReporter_h
|
|
|
|
#include "mozilla/Assertions.h"
|
|
#include "mozilla/Atomics.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include "nsIMemoryReporter.h"
|
|
#include "zlib.h"
|
|
|
|
namespace mozilla {
|
|
|
|
class SpdyZlibReporter final : public nsIMemoryReporter
|
|
{
|
|
~SpdyZlibReporter() {}
|
|
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
|
|
SpdyZlibReporter()
|
|
{
|
|
#ifdef DEBUG
|
|
// There must be only one instance of this class, due to |sAmount|
|
|
// being static.
|
|
static bool hasRun = false;
|
|
MOZ_ASSERT(!hasRun);
|
|
hasRun = true;
|
|
#endif
|
|
sAmount = 0;
|
|
}
|
|
|
|
static void* Alloc(void*, uInt items, uInt size);
|
|
static void Free(void*, void* p);
|
|
|
|
private:
|
|
// |sAmount| can be (implicitly) accessed by multiple threads, so it
|
|
// must be thread-safe.
|
|
static Atomic<size_t> sAmount;
|
|
|
|
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
|
|
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(MallocSizeOfOnAlloc)
|
|
MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(MallocSizeOfOnFree)
|
|
|
|
NS_IMETHODIMP
|
|
CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
|
|
bool aAnonymize) override;
|
|
};
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_net_SpdyZlibReporter_h
|