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.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 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 nsLayoutStylesheetCache_h__ |
michael@0 | 8 | #define nsLayoutStylesheetCache_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIMemoryReporter.h" |
michael@0 | 11 | #include "nsIObserver.h" |
michael@0 | 12 | #include "nsAutoPtr.h" |
michael@0 | 13 | #include "mozilla/Attributes.h" |
michael@0 | 14 | #include "mozilla/MemoryReporting.h" |
michael@0 | 15 | |
michael@0 | 16 | class nsCSSStyleSheet; |
michael@0 | 17 | class nsIFile; |
michael@0 | 18 | class nsIURI; |
michael@0 | 19 | |
michael@0 | 20 | namespace mozilla { |
michael@0 | 21 | namespace css { |
michael@0 | 22 | class Loader; |
michael@0 | 23 | } |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | class nsLayoutStylesheetCache MOZ_FINAL |
michael@0 | 27 | : public nsIObserver |
michael@0 | 28 | , public nsIMemoryReporter |
michael@0 | 29 | { |
michael@0 | 30 | NS_DECL_ISUPPORTS |
michael@0 | 31 | NS_DECL_NSIOBSERVER |
michael@0 | 32 | NS_DECL_NSIMEMORYREPORTER |
michael@0 | 33 | |
michael@0 | 34 | static nsCSSStyleSheet* ScrollbarsSheet(); |
michael@0 | 35 | static nsCSSStyleSheet* FormsSheet(); |
michael@0 | 36 | // This function is expected to return nullptr when the dom.forms.number |
michael@0 | 37 | // pref is disabled. |
michael@0 | 38 | static nsCSSStyleSheet* NumberControlSheet(); |
michael@0 | 39 | static nsCSSStyleSheet* UserContentSheet(); |
michael@0 | 40 | static nsCSSStyleSheet* UserChromeSheet(); |
michael@0 | 41 | static nsCSSStyleSheet* UASheet(); |
michael@0 | 42 | static nsCSSStyleSheet* QuirkSheet(); |
michael@0 | 43 | static nsCSSStyleSheet* FullScreenOverrideSheet(); |
michael@0 | 44 | |
michael@0 | 45 | static void Shutdown(); |
michael@0 | 46 | |
michael@0 | 47 | size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; |
michael@0 | 48 | |
michael@0 | 49 | private: |
michael@0 | 50 | nsLayoutStylesheetCache(); |
michael@0 | 51 | ~nsLayoutStylesheetCache(); |
michael@0 | 52 | |
michael@0 | 53 | static void EnsureGlobal(); |
michael@0 | 54 | void InitFromProfile(); |
michael@0 | 55 | void InitMemoryReporter(); |
michael@0 | 56 | static void LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet> &aSheet); |
michael@0 | 57 | static void LoadSheet(nsIURI* aURI, nsRefPtr<nsCSSStyleSheet> &aSheet, |
michael@0 | 58 | bool aEnableUnsafeRules); |
michael@0 | 59 | |
michael@0 | 60 | static nsLayoutStylesheetCache* gStyleCache; |
michael@0 | 61 | static mozilla::css::Loader* gCSSLoader; |
michael@0 | 62 | nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet; |
michael@0 | 63 | nsRefPtr<nsCSSStyleSheet> mFormsSheet; |
michael@0 | 64 | nsRefPtr<nsCSSStyleSheet> mNumberControlSheet; |
michael@0 | 65 | nsRefPtr<nsCSSStyleSheet> mUserContentSheet; |
michael@0 | 66 | nsRefPtr<nsCSSStyleSheet> mUserChromeSheet; |
michael@0 | 67 | nsRefPtr<nsCSSStyleSheet> mUASheet; |
michael@0 | 68 | nsRefPtr<nsCSSStyleSheet> mQuirkSheet; |
michael@0 | 69 | nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | #endif |