Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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