LCOV - app.info - content/xbl/src/nsXBLResourceLoader.h

LCOV - code coverage report
| Current view: | directory - content/xbl/src - nsXBLResourceLoader.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 12 | 1 | 8.3 %
| Date: | 2012-06-02 | Functions: | 7 | 1 | 14.3 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is Mozilla Communicator client code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Netscape Communications Corporation.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *   Original Author: David W. Hyatt (hyatt@netscape.com)
          24                 :  *
          25                 :  * Alternatively, the contents of this file may be used under the terms of
          26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          29                 :  * of those above. If you wish to allow use of your version of this file only
          30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          31                 :  * use your version of this file under the terms of the MPL, indicate your
          32                 :  * decision by deleting the provisions above and replace them with the notice
          33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          34                 :  * the provisions above, a recipient may use your version of this file under
          35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          36                 :  *
          37                 :  * ***** END LICENSE BLOCK ***** */
          38                 :
          39                 : #include "nsCOMPtr.h"
          40                 : #include "nsICSSLoaderObserver.h"
          41                 : #include "nsCOMArray.h"
          42                 : #include "nsContentUtils.h"
          43                 : #include "nsCycleCollectionParticipant.h"
          44                 :
          45                 : class nsIContent;
          46                 : class nsIAtom;
          47                 : class nsIDocument;
          48                 : class nsIScriptContext;
          49                 : class nsSupportsHashtable;
          50                 : class nsXBLPrototypeResources;
          51                 : class nsXBLPrototypeBinding;
          52                 :
          53                 : // *********************************************************************/
          54                 : // The XBLResourceLoader class
          55                 :
          56                 : struct nsXBLResource {
          57                 :   nsXBLResource* mNext;
          58                 :   nsIAtom* mType;
          59                 :   nsString mSrc;
          60                 :
          61               0 :   nsXBLResource(nsIAtom* aType, const nsAString& aSrc) {
          62               0 :     MOZ_COUNT_CTOR(nsXBLResource);
          63               0 :     mNext = nsnull;
          64               0 :     mType = aType;
          65               0 :     mSrc = aSrc;
          66               0 :   }
          67                 :
          68               0 :   ~nsXBLResource() {
          69               0 :     MOZ_COUNT_DTOR(nsXBLResource);
          70               0 :     NS_CONTENT_DELETE_LIST_MEMBER(nsXBLResource, this, mNext);
          71               0 :   }
          72                 : };
          73                 :
          74                 : class nsXBLResourceLoader : public nsICSSLoaderObserver
          75                 : {
          76                 : public:
          77               0 :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
          78            1464 :   NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
          79                 :
          80                 :   // nsICSSLoaderObserver
          81                 :   NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate,
          82                 :                               nsresult aStatus);
          83                 :
          84                 :   void LoadResources(bool* aResult);
          85                 :   void AddResource(nsIAtom* aResourceType, const nsAString& aSrc);
          86                 :   void AddResourceListener(nsIContent* aElement);
          87                 :
          88                 :   nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding,
          89                 :                       nsXBLPrototypeResources* aResources);
          90                 :   virtual ~nsXBLResourceLoader();
          91                 :
          92                 :   void NotifyBoundElements();
          93                 :
          94                 :   nsresult Write(nsIObjectOutputStream* aStream);
          95                 :
          96                 : // MEMBER VARIABLES
          97                 :   nsXBLPrototypeBinding* mBinding; // A pointer back to our binding.
          98                 :   nsXBLPrototypeResources* mResources; // A pointer back to our resources
          99                 :                                        // information.  May be null if the
         100                 :                                        // resources have already been
         101                 :                                        // destroyed.
         102                 :
         103                 :   nsXBLResource* mResourceList; // The list of resources we need to load.
         104                 :   nsXBLResource* mLastResource;
         105                 :
         106                 :   bool mLoadingResources;
         107                 :   // We need mInLoadResourcesFunc because we do a mixture of sync and
         108                 :   // async loads.
         109                 :   bool mInLoadResourcesFunc;
         110                 :   PRInt16 mPendingSheets; // The number of stylesheets that have yet to load.
         111                 :
         112                 :   // Bound elements that are waiting on the stylesheets and scripts.
         113                 :   nsCOMArray<nsIContent> mBoundElements;
         114                 : };
         115                 :

Generated by: LCOV version 1.7