1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/nsXBLResourceLoader.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsXBLResourceLoader_h 1.10 +#define nsXBLResourceLoader_h 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsICSSLoaderObserver.h" 1.15 +#include "nsCOMArray.h" 1.16 +#include "nsCycleCollectionParticipant.h" 1.17 + 1.18 +class nsIContent; 1.19 +class nsIAtom; 1.20 +class nsXBLPrototypeResources; 1.21 +class nsXBLPrototypeBinding; 1.22 +struct nsXBLResource; 1.23 +class nsIObjectOutputStream; 1.24 + 1.25 +// *********************************************************************/ 1.26 +// The XBLResourceLoader class 1.27 + 1.28 +class nsXBLResourceLoader : public nsICSSLoaderObserver 1.29 +{ 1.30 +public: 1.31 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.32 + NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader) 1.33 + 1.34 + // nsICSSLoaderObserver 1.35 + NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, 1.36 + nsresult aStatus) MOZ_OVERRIDE; 1.37 + 1.38 + void LoadResources(bool* aResult); 1.39 + void AddResource(nsIAtom* aResourceType, const nsAString& aSrc); 1.40 + void AddResourceListener(nsIContent* aElement); 1.41 + 1.42 + nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding, 1.43 + nsXBLPrototypeResources* aResources); 1.44 + virtual ~nsXBLResourceLoader(); 1.45 + 1.46 + void NotifyBoundElements(); 1.47 + 1.48 + nsresult Write(nsIObjectOutputStream* aStream); 1.49 + 1.50 +// MEMBER VARIABLES 1.51 + nsXBLPrototypeBinding* mBinding; // A pointer back to our binding. 1.52 + nsXBLPrototypeResources* mResources; // A pointer back to our resources 1.53 + // information. May be null if the 1.54 + // resources have already been 1.55 + // destroyed. 1.56 + 1.57 + nsXBLResource* mResourceList; // The list of resources we need to load. 1.58 + nsXBLResource* mLastResource; 1.59 + 1.60 + bool mLoadingResources; 1.61 + // We need mInLoadResourcesFunc because we do a mixture of sync and 1.62 + // async loads. 1.63 + bool mInLoadResourcesFunc; 1.64 + int16_t mPendingSheets; // The number of stylesheets that have yet to load. 1.65 + 1.66 + // Bound elements that are waiting on the stylesheets and scripts. 1.67 + nsCOMArray<nsIContent> mBoundElements; 1.68 +}; 1.69 + 1.70 +#endif