Source code
Copy as Markdown
Other Tools
/* THIS FILE IS GENERATED BY Services.py - DO NOT EDIT */
#include "mozilla/Likely.h"
#include "mozilla/Services.h"
#include "mozIThirdPartyUtil.h"
#include "nsComponentManager.h"
#include "nsIObserverService.h"
#include "nsNetCID.h"
#include "nsObserverService.h"
#include "nsXPCOMPrivate.h"
#include "nsIIOService.h"
#include "nsIDirectoryService.h"
#include "nsIChromeRegistry.h"
#include "nsIStringBundle.h"
#include "nsIToolkitChromeRegistry.h"
#include "IHistory.h"
#include "nsIXPConnect.h"
#include "nsIPermissionManager.h"
#include "nsIPrefService.h"
#include "nsIServiceWorkerManager.h"
#include "nsICacheStorageService.h"
#include "nsIStreamTransportService.h"
#include "nsISocketTransportService.h"
#include "nsIURIClassifier.h"
#include "nsIHttpActivityObserver.h"
#include "nsIAsyncShutdown.h"
#include "nsIUUIDGenerator.h"
#include "nsIGfxInfo.h"
#include "nsIURIFixup.h"
#include "nsIBits.h"
#include "nsIXULRuntime.h"
static nsIChromeRegistry* gChromeRegistry = nullptr;
namespace mozilla {
namespace services {
already_AddRefed<nsIChromeRegistry> GetChromeRegistry()
{
if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
return nullptr;
}
if (!gChromeRegistry) {
nsCOMPtr<nsIChromeRegistry> os = do_GetService("@mozilla.org/chrome/chrome-registry;1");
os.swap(gChromeRegistry);
}
return do_AddRef(gChromeRegistry);
}
}
}
static nsIIOService* gIOService = nullptr;
namespace mozilla {
namespace services {
already_AddRefed<nsIIOService> GetIOService()
{
if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
return nullptr;
}
if (!gIOService) {
nsCOMPtr<nsIIOService> os = do_GetService("@mozilla.org/network/io-service;1");
os.swap(gIOService);
}
return do_AddRef(gIOService);
}
}
}
static nsIObserverService* gObserverService = nullptr;
namespace mozilla {
namespace services {
already_AddRefed<nsIObserverService> GetObserverService()
{
if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
return nullptr;
}
if (!gObserverService) {
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
os.swap(gObserverService);
}
return do_AddRef(gObserverService);
}
}
}
static nsIPermissionManager* gPermissionManager = nullptr;
namespace mozilla {
namespace services {
already_AddRefed<nsIPermissionManager> GetPermissionManager()
{
if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
return nullptr;
}
if (!gPermissionManager) {
nsCOMPtr<nsIPermissionManager> os = do_GetService("@mozilla.org/permissionmanager;1");
os.swap(gPermissionManager);
}
return do_AddRef(gPermissionManager);
}
}
}
static nsIAsyncShutdownService* gAsyncShutdownService = nullptr;
namespace mozilla {
namespace services {
already_AddRefed<nsIAsyncShutdownService> GetAsyncShutdownService()
{
if (MOZ_UNLIKELY(gXPCOMShuttingDown)) {
return nullptr;
}
if (!gAsyncShutdownService) {
nsCOMPtr<nsIAsyncShutdownService> os = do_GetService("@mozilla.org/async-shutdown-service;1");
os.swap(gAsyncShutdownService);
}
return do_AddRef(gAsyncShutdownService);
}
}
}
/**
* Clears service cache, sets gXPCOMShuttingDown
*/
void
mozilla::services::Shutdown()
{
gXPCOMShuttingDown = true;
NS_IF_RELEASE(gChromeRegistry);
NS_IF_RELEASE(gIOService);
NS_IF_RELEASE(gObserverService);
NS_IF_RELEASE(gPermissionManager);
NS_IF_RELEASE(gAsyncShutdownService);
}