LCOV - app.info - xpcom/build/Services.cpp

LCOV - code coverage report
| Current view: | directory - xpcom/build - Services.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 3 | 3 | 100.0 %
| Date: | 2012-04-21 | Functions: | 1 | 1 | 100.0 %

           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 code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Mozilla Foundation.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 2010
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *   Taras Glek <tglek@mozilla.com>
          24                 :  *
          25                 :  * Alternatively, the contents of this file may be used under the terms of
          26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
          27                 :  * 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 "mozilla/Services.h"
          40                 : #include "nsComponentManager.h"
          41                 : #include "nsIIOService.h"
          42                 : #include "nsIDirectoryService.h"
          43                 : #ifdef ACCESSIBILITY
          44                 : #include "nsIAccessibilityService.h"
          45                 : #endif
          46                 : #include "nsIChromeRegistry.h"
          47                 : #include "nsIObserverService.h"
          48                 : #include "nsNetCID.h"
          49                 : #include "nsObserverService.h"
          50                 : #include "nsXPCOMPrivate.h"
          51                 : #include "nsIStringBundle.h"
          52                 : #include "nsIToolkitChromeRegistry.h"
          53                 : #include "nsIXULOverlayProvider.h"
          54                 : #include "IHistory.h"
          55                 : #include "nsIXPConnect.h"
          56                 :
          57                 : using namespace mozilla;
          58                 : using namespace mozilla::services;
          59                 :
          60                 : /*
          61                 :  * Define a global variable and a getter for every service in ServiceList.
          62                 :  * eg. gIOService and GetIOService()
          63                 :  */
          64                 : #define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID)                            \
          65                 :   static TYPE* g##NAME = nsnull;                                        \
          66                 :                                                                         \
          67                 :   already_AddRefed<TYPE>                                                \
          68                 :   mozilla::services::Get##NAME()                                        \
          69                 :   {                                                                     \
          70                 :     if (!g##NAME) {                                                     \
          71                 :       nsCOMPtr<TYPE> os = do_GetService(CONTRACT_ID);                   \
          72                 :       g##NAME = os.forget().get();                                      \
          73                 :     }                                                                   \
          74                 :     NS_IF_ADDREF(g##NAME);                                              \
          75                 :     return g##NAME;                                                     \
          76                 :   }                                                                     \
          77                 :   NS_EXPORT_(already_AddRefed<TYPE>)                                    \
          78                 :   mozilla::services::_external_Get##NAME()                              \
          79                 :   {                                                                     \
          80                 :     return Get##NAME();                                                 \
          81                 :   }
          82                 :
          83                 : #include "ServiceList.h"
          84                 : #undef MOZ_SERVICE
          85                 :
          86                 : /**
          87                 :  * Clears service cache, sets gXPCOMShuttingDown
          88                 :  */
          89                 : void
          90            1365 : mozilla::services::Shutdown()
          91                 : {
          92            1365 :   gXPCOMShuttingDown = true;
          93                 : #define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID) NS_IF_RELEASE(g##NAME);
          94                 : #include "ServiceList.h"
          95                 : #undef MOZ_SERVICE
          96            1365 : }

Generated by: LCOV version 1.7