Having to move gUAStyleSheet back into nsLayoutModule to reduce leak. Static nsCOMPtrs

just don't cut it, since they don't get released until after leaky runs.  This isn't
really a leak, but oh well.
This commit is contained in:
hyatt%netscape.com 2000-03-21 12:14:29 +00:00
Родитель 6f6ed819cb
Коммит 8a61da905b
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -179,15 +179,10 @@ public:
nsCOMPtr<nsIDocumentViewer>*);
static nsICSSStyleSheet* GetUAStyleSheet() {
return gUAStyleSheet;
return nsLayoutModule::gUAStyleSheet;
}
public:
static nsCOMPtr<nsICSSStyleSheet> gUAStyleSheet;
};
nsCOMPtr<nsICSSStyleSheet> nsLayoutDLF::gUAStyleSheet;
nsresult
NS_NewLayoutDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult)
{
@ -255,7 +250,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand,
nsIContentViewer** aDocViewer)
{
nsresult rv = NS_OK;
if (!nsLayoutDLF::gUAStyleSheet) {
if (!GetUAStyleSheet()) {
// Load the UA style sheet
nsCOMPtr<nsIURI> uaURL;
rv = NS_NewURI(getter_AddRefs(uaURL), UA_CSS_URL);
@ -264,7 +259,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand,
rv = NS_NewCSSLoader(getter_AddRefs(cssLoader));
if (cssLoader) {
PRBool complete;
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(nsLayoutDLF::gUAStyleSheet), complete,
rv = cssLoader->LoadAgentSheet(uaURL, nsLayoutModule::gUAStyleSheet, complete,
nsnull);
}
}

Просмотреть файл

@ -159,6 +159,7 @@ LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
static NS_DEFINE_IID(kIModuleIID, NS_IMODULE_IID);
nsIScriptNameSetRegistry* nsLayoutModule::gRegistry;
nsICSSStyleSheet* nsLayoutModule::gUAStyleSheet = nsnull;
nsLayoutModule::nsLayoutModule()
: mInitialized(PR_FALSE)
@ -247,6 +248,7 @@ nsLayoutModule::Shutdown()
nsTextTransformer::Shutdown();
NS_IF_RELEASE(gRegistry);
NS_IF_RELEASE(gUAStyleSheet);
}
NS_IMETHODIMP

Просмотреть файл

@ -53,6 +53,9 @@ protected:
PRBool mInitialized;
// static nsIFactory* gFactory;
static nsIScriptNameSetRegistry* gRegistry;
public:
static nsICSSStyleSheet* gUAStyleSheet;
};
//----------------------------------------------------------------------