nsLayoutStylesheetCache::Shutdown();
PR_STATIC_CALLBACK(void) Shutdown(nsIModule* aSelf);#ifdef MOZ_MATHML#include "nsMathMLAtoms.h"#include "nsMathMLOperators.h"#endif#ifdef MOZ_SVG#include "nsSVGAtoms.h"#include "nsSVGTypeCIDs.h"#include "nsISVGRenderer.h"#include "nsSVGRect.h"#ifdef MOZ_SVG_RENDERER_LIBARTvoid NS_InitSVGRendererLibartGlobals();void NS_FreeSVGRendererLibartGlobals();#endif#ifdef MOZ_SVG_RENDERER_GDIPLUSvoid NS_InitSVGRendererGDIPlusGlobals();void NS_FreeSVGRendererGDIPlusGlobals();#endif#ifdef MOZ_SVG_RENDERER_CAIROvoid NS_InitSVGRendererCairoGlobals();void NS_FreeSVGRendererCairoGlobals();#endif#endif// jst says, ``we need this to avoid holding on to XPConnect past its// destruction. By being an XPCOM shutdown observer we can make sure// we release the content global reference to XPConnect before// XPConnect is shutdown, which cuts down on leaks n' whatnot...''class ContentShutdownObserver : public nsIObserver{public:  ContentShutdownObserver()  {  }  NS_DECL_ISUPPORTS  NS_DECL_NSIOBSERVER};NS_IMPL_ISUPPORTS1(ContentShutdownObserver, nsIObserver)NS_IMETHODIMPContentShutdownObserver::Observe(nsISupports *aSubject,                                 const char *aTopic,                                 const PRUnichar *someData){  if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))    nsContentUtils::Shutdown();  return NS_OK;}static PRBool gInitialized = PR_FALSE;// Perform our one-time intialization for this module// staticnsresult PR_CALLBACKInitialize(nsIModule* aSelf){  NS_PRECONDITION(!gInitialized, "module already initialized");  if (gInitialized) {    return NS_OK;  }  gInitialized = PR_TRUE;      nsresult rv = nsContentUtils::Init();  if (NS_FAILED(rv)) {    NS_ERROR("Could not initialize nsContentUtils");    Shutdown(aSelf);    return rv;  }  // Register all of our atoms once  nsCSSAnonBoxes::AddRefAtoms();  nsCSSPseudoClasses::AddRefAtoms();  nsCSSPseudoElements::AddRefAtoms();  nsCSSKeywords::AddRefTable();  nsCSSProps::AddRefTable();  nsColorNames::AddRefTable();  nsHTMLAtoms::AddRefAtoms();  nsXBLAtoms::AddRefAtoms();  nsLayoutAtoms::AddRefAtoms();  nsXULAtoms::AddRefAtoms();#ifdef MOZ_XUL  rv = nsXULContentUtils::Init();  if (NS_FAILED(rv)) {    NS_ERROR("Could not initialize nsXULContentUtils");    Shutdown(aSelf);    return rv;  }#endif#ifdef MOZ_MATHML  nsMathMLOperators::AddRefTable();  nsMathMLAtoms::AddRefAtoms();#endif#ifdef MOZ_SVG  nsSVGAtoms::AddRefAtoms();#ifdef MOZ_SVG_RENDERER_LIBART  NS_InitSVGRendererLibartGlobals();#endif#ifdef MOZ_SVG_RENDERER_GDIPLUS  NS_InitSVGRendererGDIPlusGlobals();#endif#ifdef MOZ_SVG_RENDERER_CAIRO  NS_InitSVGRendererCairoGlobals();#endif#endif#ifdef DEBUG  nsFrame::DisplayReflowStartup();#endif  rv = nsTextTransformer::Initialize();  if (NS_FAILED(rv)) {    NS_ERROR("Could not initialize nsTextTransformer");    Shutdown(aSelf);    return rv;  }  nsImageLoadingContent::Initialize();  // Add our shutdown observer.  nsCOMPtr<nsIObserverService> observerService =    do_GetService("@mozilla.org/observer-service;1");  if (observerService) {    ContentShutdownObserver* observer =      new ContentShutdownObserver();    if (!observer) {      Shutdown(aSelf);      return NS_ERROR_OUT_OF_MEMORY;    }    observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);  } else {    NS_WARNING("Could not get an observer service.  We will leak on shutdown.");  }  return NS_OK;}// Shutdown this module, releasing all of the module resources// staticvoid PR_CALLBACKShutdown(nsIModule* aSelf){  NS_PRECONDITION(gInitialized, "module not initialized");  if (!gInitialized)    return;  gInitialized = PR_FALSE;  nsRange::Shutdown();  nsGenericElement::Shutdown();  nsEventListenerManager::Shutdown();  nsContentList::Shutdown();  nsComputedDOMStyle::Shutdown();  CSSLoaderImpl::Shutdown();#ifdef DEBUG  nsFrame::DisplayReflowShutdown();#endif  // Release all of our atoms  nsColorNames::ReleaseTable();  nsCSSProps::ReleaseTable();  nsCSSKeywords::ReleaseTable();  nsRepeatService::Shutdown();  nsStackLayout::Shutdown();  nsBox::Shutdown();#ifdef MOZ_XUL  nsXULContentUtils::Finish();  nsXULElement::ReleaseGlobals();  nsXULPrototypeElement::ReleaseGlobals();  nsXULPrototypeScript::ReleaseGlobals();  nsSprocketLayout::Shutdown();#endif#ifdef MOZ_MATHML  nsMathMLOperators::ReleaseTable();#endif#ifdef MOZ_SVG#ifdef MOZ_SVG_RENDERER_LIBART  NS_FreeSVGRendererLibartGlobals();#endif#ifdef MOZ_SVG_RENDERER_GDIPLUS  NS_FreeSVGRendererGDIPlusGlobals();#endif#ifdef MOZ_SVG_RENDERER_CAIRO  NS_FreeSVGRendererCairoGlobals();#endif#endif  nsCSSFrameConstructor::ReleaseGlobals();  nsTextTransformer::Shutdown();  nsSpaceManager::Shutdown();  nsTextControlFrame::ReleaseGlobals();  nsImageFrame::ReleaseGlobals();  NS_IF_RELEASE(nsContentDLF::gUAStyleSheet);  NS_IF_RELEASE(nsRuleNode::gLangService);  nsGenericHTMLElement::Shutdown();  nsContentUtils::Shutdown();  NS_NameSpaceManagerShutdown();  nsImageLoadingContent::Shutdown();  nsStyleSet::FreeGlobals();  GlobalWindowImpl::ShutDown();  nsDOMClassInfo::ShutDown();}