michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set sw=2 ts=8 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "SpdyZlibReporter.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: NS_IMPL_ISUPPORTS(SpdyZlibReporter, nsIMemoryReporter) michael@0: michael@0: /* static */ Atomic SpdyZlibReporter::sAmount; michael@0: michael@0: /* static */ void* michael@0: SpdyZlibReporter::Alloc(void*, uInt items, uInt size) michael@0: { michael@0: void* p = moz_xmalloc(items * size); michael@0: sAmount += MallocSizeOfOnAlloc(p); michael@0: return p; michael@0: } michael@0: michael@0: /* static */ void michael@0: SpdyZlibReporter::Free(void*, void* p) michael@0: { michael@0: sAmount -= MallocSizeOfOnFree(p); michael@0: moz_free(p); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: SpdyZlibReporter::CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData) michael@0: { michael@0: return MOZ_COLLECT_REPORT( michael@0: "explicit/network/spdy-zlib-buffers", KIND_HEAP, UNITS_BYTES, sAmount, michael@0: "Memory allocated for SPDY zlib send and receive buffers."); michael@0: } michael@0: michael@0: } // namespace mozilla