Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=4 et sw=4 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef GFXTEXTURESREPORTER_H_ |
michael@0 | 8 | #define GFXTEXTURESREPORTER_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIMemoryReporter.h" |
michael@0 | 11 | #include "GLTypes.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace mozilla { |
michael@0 | 14 | namespace gl { |
michael@0 | 15 | |
michael@0 | 16 | class GfxTexturesReporter MOZ_FINAL : public nsIMemoryReporter |
michael@0 | 17 | { |
michael@0 | 18 | public: |
michael@0 | 19 | NS_DECL_ISUPPORTS |
michael@0 | 20 | |
michael@0 | 21 | GfxTexturesReporter() |
michael@0 | 22 | { |
michael@0 | 23 | #ifdef DEBUG |
michael@0 | 24 | // There must be only one instance of this class, due to |sAmount| |
michael@0 | 25 | // being static. Assert this. |
michael@0 | 26 | static bool hasRun = false; |
michael@0 | 27 | MOZ_ASSERT(!hasRun); |
michael@0 | 28 | hasRun = true; |
michael@0 | 29 | #endif |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | enum MemoryUse { |
michael@0 | 33 | // when memory being allocated is reported to a memory reporter |
michael@0 | 34 | MemoryAllocated, |
michael@0 | 35 | // when memory being freed is reported to a memory reporter |
michael@0 | 36 | MemoryFreed |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | // When memory is used/freed for tile textures, call this method to update |
michael@0 | 40 | // the value reported by this memory reporter. |
michael@0 | 41 | static void UpdateAmount(MemoryUse action, GLenum format, GLenum type, |
michael@0 | 42 | int32_t tileWidth, int32_t tileHeight); |
michael@0 | 43 | |
michael@0 | 44 | NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport, |
michael@0 | 45 | nsISupports* aData) |
michael@0 | 46 | { |
michael@0 | 47 | return MOZ_COLLECT_REPORT( |
michael@0 | 48 | "gfx-textures", KIND_OTHER, UNITS_BYTES, sAmount, |
michael@0 | 49 | "Memory used for storing GL textures."); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | private: |
michael@0 | 53 | static int64_t sAmount; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | } |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | #endif // GFXTEXTURESREPORTER_H_ |