LCOV - code coverage report
Current view: top level - xpcom/build - Services.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/Likely.h"
       8             : #include "mozilla/Services.h"
       9             : #include "nsComponentManager.h"
      10             : #include "nsIObserverService.h"
      11             : #include "nsNetCID.h"
      12             : #include "nsObserverService.h"
      13             : #include "nsXPCOMPrivate.h"
      14             : #include "nsIIOService.h"
      15             : #include "nsIDirectoryService.h"
      16             : #include "nsIChromeRegistry.h"
      17             : #include "nsIStringBundle.h"
      18             : #include "nsIToolkitChromeRegistry.h"
      19             : #include "nsIXULOverlayProvider.h"
      20             : #include "IHistory.h"
      21             : #include "nsIXPConnect.h"
      22             : #include "inIDOMUtils.h"
      23             : #include "nsIPermissionManager.h"
      24             : #include "nsIServiceWorkerManager.h"
      25             : #include "nsICacheStorageService.h"
      26             : #include "nsIStreamTransportService.h"
      27             : #include "nsISocketTransportService.h"
      28             : #include "nsIURIClassifier.h"
      29             : #include "nsIHttpActivityObserver.h"
      30             : #include "nsIAsyncShutdown.h"
      31             : #include "nsIUUIDGenerator.h"
      32             : #include "nsIGfxInfo.h"
      33             : 
      34             : using namespace mozilla;
      35             : using namespace mozilla::services;
      36             : 
      37             : /*
      38             :  * Define a global variable and a getter for every service in ServiceList.
      39             :  * eg. gIOService and GetIOService()
      40             :  */
      41             : #define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID)                            \
      42             :   static TYPE* g##NAME = nullptr;                                       \
      43             :                                                                         \
      44             :   already_AddRefed<TYPE>                                                \
      45             :   mozilla::services::Get##NAME()                                        \
      46             :   {                                                                     \
      47             :     if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {                             \
      48             :       return nullptr;                                                   \
      49             :     }                                                                   \
      50             :     if (!g##NAME) {                                                     \
      51             :       nsCOMPtr<TYPE> os = do_GetService(CONTRACT_ID);                   \
      52             :       os.swap(g##NAME);                                                 \
      53             :     }                                                                   \
      54             :     nsCOMPtr<TYPE> ret = g##NAME;                                       \
      55             :     return ret.forget();                                                \
      56             :   }
      57             : 
      58             : #include "ServiceList.h"
      59             : #undef MOZ_SERVICE
      60             : 
      61             : /**
      62             :  * Clears service cache, sets gXPCOMShuttingDown
      63             :  */
      64             : void
      65           0 : mozilla::services::Shutdown()
      66             : {
      67           0 :   gXPCOMShuttingDown = true;
      68             : #define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID) NS_IF_RELEASE(g##NAME);
      69             : #include "ServiceList.h"
      70             : #undef MOZ_SERVICE
      71           0 : }

Generated by: LCOV version 1.13