gfx/gl/GfxTexturesReporter.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set ts=8 sts=4 et sw=4 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 #ifndef GFXTEXTURESREPORTER_H_
     8 #define GFXTEXTURESREPORTER_H_
    10 #include "nsIMemoryReporter.h"
    11 #include "GLTypes.h"
    13 namespace mozilla {
    14 namespace gl {
    16 class GfxTexturesReporter MOZ_FINAL : public nsIMemoryReporter
    17 {
    18 public:
    19     NS_DECL_ISUPPORTS
    21     GfxTexturesReporter()
    22     {
    23 #ifdef DEBUG
    24         // There must be only one instance of this class, due to |sAmount|
    25         // being static.  Assert this.
    26         static bool hasRun = false;
    27         MOZ_ASSERT(!hasRun);
    28         hasRun = true;
    29 #endif
    30     }
    32     enum MemoryUse {
    33         // when memory being allocated is reported to a memory reporter
    34         MemoryAllocated,
    35         // when memory being freed is reported to a memory reporter
    36         MemoryFreed
    37     };
    39     // When memory is used/freed for tile textures, call this method to update
    40     // the value reported by this memory reporter.
    41     static void UpdateAmount(MemoryUse action, GLenum format, GLenum type,
    42                              int32_t tileWidth, int32_t tileHeight);
    44     NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
    45                               nsISupports* aData)
    46     {
    47         return MOZ_COLLECT_REPORT(
    48             "gfx-textures", KIND_OTHER, UNITS_BYTES, sAmount,
    49             "Memory used for storing GL textures.");
    50     }
    52 private:
    53     static int64_t sAmount;
    54 };
    56 }
    57 }
    59 #endif // GFXTEXTURESREPORTER_H_

mercurial