dom/xbl/nsXBLDocumentInfo.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xbl/nsXBLDocumentInfo.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsXBLDocumentInfo_h__
     1.9 +#define nsXBLDocumentInfo_h__
    1.10 +
    1.11 +#include "mozilla/Attributes.h"
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsAutoPtr.h"
    1.14 +#include "nsWeakReference.h"
    1.15 +#include "nsIDocument.h"
    1.16 +#include "nsCycleCollectionParticipant.h"
    1.17 +
    1.18 +class nsXBLPrototypeBinding;
    1.19 +class nsXBLDocGlobalObject;
    1.20 +
    1.21 +class nsXBLDocumentInfo MOZ_FINAL : public nsSupportsWeakReference
    1.22 +{
    1.23 +public:
    1.24 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.25 +
    1.26 +  nsXBLDocumentInfo(nsIDocument* aDocument);
    1.27 +  virtual ~nsXBLDocumentInfo();
    1.28 +
    1.29 +  already_AddRefed<nsIDocument> GetDocument()
    1.30 +    { nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); }
    1.31 +
    1.32 +  bool GetScriptAccess() const { return mScriptAccess; }
    1.33 +
    1.34 +  nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
    1.35 +
    1.36 +  nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
    1.37 +  nsresult SetPrototypeBinding(const nsACString& aRef,
    1.38 +                               nsXBLPrototypeBinding* aBinding);
    1.39 +
    1.40 +  // This removes the binding without deleting it
    1.41 +  void RemovePrototypeBinding(const nsACString& aRef);
    1.42 +
    1.43 +  nsresult WritePrototypeBindings();
    1.44 +
    1.45 +  void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
    1.46 +
    1.47 +  void FlushSkinStylesheets();
    1.48 +
    1.49 +  bool IsChrome() { return mIsChrome; }
    1.50 +
    1.51 +  void MarkInCCGeneration(uint32_t aGeneration);
    1.52 +
    1.53 +  static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo);
    1.54 +
    1.55 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
    1.56 +
    1.57 +private:
    1.58 +  nsCOMPtr<nsIDocument> mDocument;
    1.59 +  bool mScriptAccess;
    1.60 +  bool mIsChrome;
    1.61 +  // the binding table owns each nsXBLPrototypeBinding
    1.62 +  nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
    1.63 +
    1.64 +  // non-owning pointer to the first binding in the table
    1.65 +  nsXBLPrototypeBinding* mFirstBinding;
    1.66 +};
    1.67 +
    1.68 +#ifdef DEBUG
    1.69 +void AssertInCompilationScope();
    1.70 +#else
    1.71 +inline void AssertInCompilationScope() {}
    1.72 +#endif
    1.73 +
    1.74 +#endif

mercurial