Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "SpdyZlibReporter.h"
9 namespace mozilla {
11 NS_IMPL_ISUPPORTS(SpdyZlibReporter, nsIMemoryReporter)
13 /* static */ Atomic<size_t> SpdyZlibReporter::sAmount;
15 /* static */ void*
16 SpdyZlibReporter::Alloc(void*, uInt items, uInt size)
17 {
18 void* p = moz_xmalloc(items * size);
19 sAmount += MallocSizeOfOnAlloc(p);
20 return p;
21 }
23 /* static */ void
24 SpdyZlibReporter::Free(void*, void* p)
25 {
26 sAmount -= MallocSizeOfOnFree(p);
27 moz_free(p);
28 }
30 NS_IMETHODIMP
31 SpdyZlibReporter::CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData)
32 {
33 return MOZ_COLLECT_REPORT(
34 "explicit/network/spdy-zlib-buffers", KIND_HEAP, UNITS_BYTES, sAmount,
35 "Memory allocated for SPDY zlib send and receive buffers.");
36 }
38 } // namespace mozilla