netwerk/protocol/http/SpdyZlibReporter.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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

mercurial