LCOV - code coverage report
Current view: directory - parser/htmlparser/src - nsParserModule.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 24 19 79.2 %
Date: 2012-06-02 Functions: 8 5 62.5 %

       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                 :  *   Pierre Phaneuf <pp@ludusdesign.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 "nsIAtom.h"
      40                 : #include "nsString.h"
      41                 : #include "nspr.h"
      42                 : #include "nsCOMPtr.h"
      43                 : #include "mozilla/ModuleUtils.h"
      44                 : #include "nsParserCIID.h"
      45                 : #include "nsParser.h"
      46                 : #include "CNavDTD.h"
      47                 : #include "nsHTMLEntities.h"
      48                 : #include "nsHTMLTokenizer.h"
      49                 : //#include "nsTextTokenizer.h"
      50                 : #include "nsElementTable.h"
      51                 : #include "nsParserService.h"
      52                 : #include "nsSAXAttributes.h"
      53                 : #include "nsSAXLocator.h"
      54                 : #include "nsSAXXMLReader.h"
      55                 : 
      56                 : #if defined(NS_DEBUG)
      57                 : #include "nsExpatDriver.h"
      58                 : #endif
      59                 : 
      60                 : //----------------------------------------------------------------------
      61                 : 
      62                 : #if defined(NS_DEBUG)
      63               0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
      64                 : #endif
      65                 : 
      66            6690 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
      67               0 : NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
      68              72 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
      69                 : 
      70               0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes)
      71             410 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader)
      72                 : 
      73                 : #if defined(NS_DEBUG)
      74                 : NS_DEFINE_NAMED_CID(NS_EXPAT_DRIVER_CID);
      75                 : #endif
      76                 : NS_DEFINE_NAMED_CID(NS_PARSER_CID);
      77                 : NS_DEFINE_NAMED_CID(NS_CNAVDTD_CID);
      78                 : NS_DEFINE_NAMED_CID(NS_PARSERSERVICE_CID);
      79                 : NS_DEFINE_NAMED_CID(NS_SAXATTRIBUTES_CID);
      80                 : NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID);
      81                 : 
      82                 : static const mozilla::Module::CIDEntry kParserCIDs[] = {
      83                 : #if defined(NS_DEBUG)
      84                 :   { &kNS_EXPAT_DRIVER_CID, false, NULL, nsExpatDriverConstructor },
      85                 : #endif
      86                 :   { &kNS_PARSER_CID, false, NULL, nsParserConstructor },
      87                 :   { &kNS_CNAVDTD_CID, false, NULL, CNavDTDConstructor },
      88                 :   { &kNS_PARSERSERVICE_CID, false, NULL, nsParserServiceConstructor },
      89                 :   { &kNS_SAXATTRIBUTES_CID, false, NULL, nsSAXAttributesConstructor },
      90                 :   { &kNS_SAXXMLREADER_CID, false, NULL, nsSAXXMLReaderConstructor },
      91                 :   { NULL }
      92                 : };
      93                 : 
      94                 : static const mozilla::Module::ContractIDEntry kParserContracts[] = {
      95                 :   { NS_PARSERSERVICE_CONTRACTID, &kNS_PARSERSERVICE_CID },
      96                 :   { NS_SAXATTRIBUTES_CONTRACTID, &kNS_SAXATTRIBUTES_CID },
      97                 :   { NS_SAXXMLREADER_CONTRACTID, &kNS_SAXXMLREADER_CID },
      98                 :   { NULL }
      99                 : };
     100                 : 
     101                 : static nsresult
     102             263 : Initialize()
     103                 : {
     104             263 :   nsresult rv = nsHTMLTags::AddRefTable();
     105             263 :   NS_ENSURE_SUCCESS(rv, rv);
     106                 : 
     107             263 :   rv = nsHTMLEntities::AddRefTable();
     108             263 :   if (NS_FAILED(rv)) {
     109               0 :     nsHTMLTags::ReleaseTable();
     110               0 :     return rv;
     111                 :   }
     112                 : #ifdef NS_DEBUG
     113             263 :   CheckElementTable();
     114                 : #endif
     115             263 :   CNewlineToken::AllocNewline();
     116                 : 
     117                 : #ifdef DEBUG
     118             263 :   nsHTMLTags::TestTagTable();
     119                 : #endif
     120                 : 
     121             263 :   return nsParser::Init();
     122                 : }
     123                 : 
     124                 : static void
     125             263 : Shutdown()
     126                 : {
     127             263 :   nsHTMLTags::ReleaseTable();
     128             263 :   nsHTMLEntities::ReleaseTable();
     129             263 :   nsDTDContext::ReleaseGlobalObjects();
     130             263 :   nsParser::Shutdown();
     131             263 :   CNewlineToken::FreeNewline();
     132             263 : }
     133                 : 
     134                 : static mozilla::Module kParserModule = {
     135                 :   mozilla::Module::kVersion,
     136                 :   kParserCIDs,
     137                 :   kParserContracts,
     138                 :   NULL,
     139                 :   NULL,
     140                 :   Initialize,
     141                 :   Shutdown
     142                 : };
     143                 : 
     144                 : NSMODULE_DEFN(nsParserModule) = &kParserModule;

Generated by: LCOV version 1.7