layout/style/nsLayoutStylesheetCache.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/nsLayoutStylesheetCache.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsLayoutStylesheetCache_h__
    1.11 +#define nsLayoutStylesheetCache_h__
    1.12 +
    1.13 +#include "nsIMemoryReporter.h"
    1.14 +#include "nsIObserver.h"
    1.15 +#include "nsAutoPtr.h"
    1.16 +#include "mozilla/Attributes.h"
    1.17 +#include "mozilla/MemoryReporting.h"
    1.18 +
    1.19 +class nsCSSStyleSheet;
    1.20 +class nsIFile;
    1.21 +class nsIURI;
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace css {
    1.25 +class Loader;
    1.26 +}
    1.27 +}
    1.28 +
    1.29 +class nsLayoutStylesheetCache MOZ_FINAL
    1.30 + : public nsIObserver
    1.31 + , public nsIMemoryReporter
    1.32 +{
    1.33 +  NS_DECL_ISUPPORTS
    1.34 +  NS_DECL_NSIOBSERVER
    1.35 +  NS_DECL_NSIMEMORYREPORTER
    1.36 +
    1.37 +  static nsCSSStyleSheet* ScrollbarsSheet();
    1.38 +  static nsCSSStyleSheet* FormsSheet();
    1.39 +  // This function is expected to return nullptr when the dom.forms.number
    1.40 +  // pref is disabled.
    1.41 +  static nsCSSStyleSheet* NumberControlSheet();
    1.42 +  static nsCSSStyleSheet* UserContentSheet();
    1.43 +  static nsCSSStyleSheet* UserChromeSheet();
    1.44 +  static nsCSSStyleSheet* UASheet();
    1.45 +  static nsCSSStyleSheet* QuirkSheet();
    1.46 +  static nsCSSStyleSheet* FullScreenOverrideSheet();
    1.47 +
    1.48 +  static void Shutdown();
    1.49 +
    1.50 +  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    1.51 +
    1.52 +private:
    1.53 +  nsLayoutStylesheetCache();
    1.54 +  ~nsLayoutStylesheetCache();
    1.55 +
    1.56 +  static void EnsureGlobal();
    1.57 +  void InitFromProfile();
    1.58 +  void InitMemoryReporter();
    1.59 +  static void LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet> &aSheet);
    1.60 +  static void LoadSheet(nsIURI* aURI, nsRefPtr<nsCSSStyleSheet> &aSheet,
    1.61 +                        bool aEnableUnsafeRules);
    1.62 +
    1.63 +  static nsLayoutStylesheetCache* gStyleCache;
    1.64 +  static mozilla::css::Loader* gCSSLoader;
    1.65 +  nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet;
    1.66 +  nsRefPtr<nsCSSStyleSheet> mFormsSheet;
    1.67 +  nsRefPtr<nsCSSStyleSheet> mNumberControlSheet;
    1.68 +  nsRefPtr<nsCSSStyleSheet> mUserContentSheet;
    1.69 +  nsRefPtr<nsCSSStyleSheet> mUserChromeSheet;
    1.70 +  nsRefPtr<nsCSSStyleSheet> mUASheet;
    1.71 +  nsRefPtr<nsCSSStyleSheet> mQuirkSheet;
    1.72 +  nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet;
    1.73 +};
    1.74 +
    1.75 +#endif

mercurial