зеркало из https://github.com/mozilla/pjs.git
fix for bug 199170 - more static atom work in xpcom, chrome registry, rdf, and profile dir service provider.. sr=bryner, r=ccarlen
This commit is contained in:
Родитель
48e3bcebb1
Коммит
2354d05a20
|
@ -108,12 +108,14 @@
|
|||
#include "nsIDOMWindowCollection.h"
|
||||
#include "imgICache.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsStaticAtom.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIFileURL.h"
|
||||
|
||||
static char kChromePrefix[] = "chrome://";
|
||||
static char kUseXBLFormsPref[] = "nglayout.debug.enable_xbl_forms";
|
||||
nsIAtom* nsChromeRegistry::sCPrefix; // atom for "c"
|
||||
|
||||
#define kChromeFileName NS_LITERAL_CSTRING("chrome.rdf")
|
||||
#define kInstalledChromeFileName NS_LITERAL_CSTRING("installed-chrome.txt")
|
||||
|
@ -315,6 +317,32 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsChromeRegistry, nsIChromeRegistry, nsIXULChromeR
|
|||
nsresult
|
||||
nsChromeRegistry::Init()
|
||||
{
|
||||
// these atoms appear in almost every chrome registry manifest.rdf
|
||||
// in some form or another. making static atoms prevents the atoms
|
||||
// from constantly being created/destroyed during parsing
|
||||
|
||||
static const nsStaticAtom atoms[] = {
|
||||
{ "c", &sCPrefix },
|
||||
{ "chrome", nsnull },
|
||||
{ "NC", nsnull },
|
||||
{ "baseURL", nsnull},
|
||||
{ "allowScripts", nsnull },
|
||||
{ "skinVersion", nsnull },
|
||||
{ "package", nsnull },
|
||||
{ "packages", nsnull },
|
||||
{ "locType", nsnull },
|
||||
{ "displayName", nsnull },
|
||||
{ "author", nsnull },
|
||||
{ "localeVersion", nsnull },
|
||||
{ "localeType", nsnull },
|
||||
{ "selectedLocale", nsnull },
|
||||
{ "selectedSkin", nsnull },
|
||||
{ "hasOverlays", nsnull },
|
||||
{ "previewURL", nsnull },
|
||||
};
|
||||
|
||||
NS_RegisterStaticAtoms(atoms, NS_ARRAY_LENGTH(atoms));
|
||||
|
||||
gChromeRegistry = this;
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
@ -252,6 +252,9 @@ protected:
|
|||
nsCOMPtr<nsIZipReader> mOverrideJAR;
|
||||
nsCString mOverrideJARURL;
|
||||
|
||||
// useful atoms - these are static atoms, so don't use nsCOMPtr
|
||||
static nsIAtom* sCPrefix; // "c"
|
||||
|
||||
PRBool mUseXBLForms;
|
||||
|
||||
PRPackedBool mInstallInitialized;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "nsProfileDirServiceProvider.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsStaticAtom.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
@ -92,21 +93,6 @@ nsProfileDirServiceProvider::nsProfileDirServiceProvider(PRBool aNotifyObservers
|
|||
|
||||
nsProfileDirServiceProvider::~nsProfileDirServiceProvider()
|
||||
{
|
||||
NS_IF_RELEASE(sApp_PrefsDirectory50);
|
||||
NS_IF_RELEASE(sApp_PreferencesFile50);
|
||||
NS_IF_RELEASE(sApp_UserProfileDirectory50);
|
||||
NS_IF_RELEASE(sApp_UserChromeDirectory);
|
||||
NS_IF_RELEASE(sApp_LocalStore50);
|
||||
NS_IF_RELEASE(sApp_History50);
|
||||
NS_IF_RELEASE(sApp_UsersPanels50);
|
||||
NS_IF_RELEASE(sApp_UsersMimeTypes50);
|
||||
NS_IF_RELEASE(sApp_BookmarksFile50);
|
||||
NS_IF_RELEASE(sApp_DownloadsFile50);
|
||||
NS_IF_RELEASE(sApp_SearchFile50);
|
||||
NS_IF_RELEASE(sApp_MailDirectory50);
|
||||
NS_IF_RELEASE(sApp_ImapMailDirectory50);
|
||||
NS_IF_RELEASE(sApp_NewsDirectory50);
|
||||
NS_IF_RELEASE(sApp_MessengerFolderCache50);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -304,40 +290,29 @@ nsProfileDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFi
|
|||
|
||||
nsresult
|
||||
nsProfileDirServiceProvider::Initialize()
|
||||
{
|
||||
{
|
||||
static const nsStaticAtom provider_atoms[] = {
|
||||
{ NS_APP_PREFS_50_DIR, &sApp_PrefsDirectory50 },
|
||||
{ NS_APP_PREFS_50_FILE, &sApp_PreferencesFile50 },
|
||||
{ NS_APP_USER_PROFILE_50_DIR, &sApp_UserProfileDirectory50 },
|
||||
{ NS_APP_USER_CHROME_DIR, &sApp_UserChromeDirectory },
|
||||
{ NS_APP_LOCALSTORE_50_FILE, &sApp_LocalStore50 },
|
||||
{ NS_APP_HISTORY_50_FILE, &sApp_History50 },
|
||||
{ NS_APP_USER_PANELS_50_FILE, &sApp_UsersPanels50 },
|
||||
{ NS_APP_USER_MIMETYPES_50_FILE, &sApp_UsersMimeTypes50 },
|
||||
{ NS_APP_BOOKMARKS_50_FILE, &sApp_BookmarksFile50 },
|
||||
{ NS_APP_DOWNLOADS_50_FILE, &sApp_DownloadsFile50 },
|
||||
{ NS_APP_SEARCH_50_FILE, &sApp_SearchFile50 },
|
||||
{ NS_APP_MAIL_50_DIR, &sApp_MailDirectory50 },
|
||||
{ NS_APP_IMAP_MAIL_50_DIR, &sApp_ImapMailDirectory50 },
|
||||
{ NS_APP_NEWS_50_DIR, &sApp_NewsDirectory50 },
|
||||
{ NS_APP_MESSENGER_FOLDER_CACHE_50_DIR, &sApp_MessengerFolderCache50 },
|
||||
{ NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, nsnull },
|
||||
};
|
||||
|
||||
// Make our directory atoms
|
||||
|
||||
// Preferences:
|
||||
sApp_PrefsDirectory50 = NS_NewAtom(NS_APP_PREFS_50_DIR);
|
||||
sApp_PreferencesFile50 = NS_NewAtom(NS_APP_PREFS_50_FILE);
|
||||
|
||||
// Profile:
|
||||
sApp_UserProfileDirectory50 = NS_NewAtom(NS_APP_USER_PROFILE_50_DIR);
|
||||
|
||||
// Application Directories:
|
||||
sApp_UserChromeDirectory = NS_NewAtom(NS_APP_USER_CHROME_DIR);
|
||||
|
||||
// Aplication Files:
|
||||
sApp_LocalStore50 = NS_NewAtom(NS_APP_LOCALSTORE_50_FILE);
|
||||
sApp_History50 = NS_NewAtom(NS_APP_HISTORY_50_FILE);
|
||||
sApp_UsersPanels50 = NS_NewAtom(NS_APP_USER_PANELS_50_FILE);
|
||||
sApp_UsersMimeTypes50 = NS_NewAtom(NS_APP_USER_MIMETYPES_50_FILE);
|
||||
|
||||
// Bookmarks:
|
||||
sApp_BookmarksFile50 = NS_NewAtom(NS_APP_BOOKMARKS_50_FILE);
|
||||
|
||||
// Downloads
|
||||
sApp_DownloadsFile50 = NS_NewAtom(NS_APP_DOWNLOADS_50_FILE);
|
||||
|
||||
// Search
|
||||
sApp_SearchFile50 = NS_NewAtom(NS_APP_SEARCH_50_FILE);
|
||||
|
||||
// MailNews
|
||||
sApp_MailDirectory50 = NS_NewAtom(NS_APP_MAIL_50_DIR);
|
||||
sApp_ImapMailDirectory50 = NS_NewAtom(NS_APP_IMAP_MAIL_50_DIR);
|
||||
sApp_NewsDirectory50 = NS_NewAtom(NS_APP_NEWS_50_DIR);
|
||||
sApp_MessengerFolderCache50 = NS_NewAtom(NS_APP_MESSENGER_FOLDER_CACHE_50_DIR);
|
||||
|
||||
NS_RegisterStaticAtoms(provider_atoms, NS_ARRAY_LENGTH(provider_atoms));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#include "nsIExpatSink.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -331,7 +332,20 @@ nsIAtom* RDFContentSinkImpl::kXMLNSAtom;
|
|||
nsIAtom* RDFContentSinkImpl::kParseTypeAtom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const nsStaticAtom rdf_atoms[] = {
|
||||
{ "about", &RDFContentSinkImpl::kAboutAtom },
|
||||
{ "ID", &RDFContentSinkImpl::kIdAtom },
|
||||
{ "aboutEach", &RDFContentSinkImpl::kAboutEachAtom },
|
||||
{ "resource", &RDFContentSinkImpl::kResourceAtom },
|
||||
{ "RDF", &RDFContentSinkImpl::kRDFAtom },
|
||||
{ "Description", &RDFContentSinkImpl::kDescriptionAtom },
|
||||
{ "Bag", &RDFContentSinkImpl::kBagAtom },
|
||||
{ "Seq", &RDFContentSinkImpl::kSeqAtom },
|
||||
{ "Alt", &RDFContentSinkImpl::kAltAtom },
|
||||
{ "li", &RDFContentSinkImpl::kLiAtom },
|
||||
{ "xmlns", &RDFContentSinkImpl::kXMLNSAtom },
|
||||
{ "parseType", &RDFContentSinkImpl::kParseTypeAtom },
|
||||
};
|
||||
|
||||
RDFContentSinkImpl::RDFContentSinkImpl()
|
||||
: mText(nsnull),
|
||||
|
@ -371,18 +385,7 @@ RDFContentSinkImpl::RDFContentSinkImpl()
|
|||
NS_GET_IID(nsIRDFContainerUtils),
|
||||
(nsISupports**) &gRDFContainerUtils);
|
||||
|
||||
kAboutAtom = NS_NewAtom("about");
|
||||
kIdAtom = NS_NewAtom("ID");
|
||||
kAboutEachAtom = NS_NewAtom("aboutEach");
|
||||
kResourceAtom = NS_NewAtom("resource");
|
||||
kRDFAtom = NS_NewAtom("RDF");
|
||||
kDescriptionAtom = NS_NewAtom("Description");
|
||||
kBagAtom = NS_NewAtom("Bag");
|
||||
kSeqAtom = NS_NewAtom("Seq");
|
||||
kAltAtom = NS_NewAtom("Alt");
|
||||
kLiAtom = NS_NewAtom("li");
|
||||
kXMLNSAtom = NS_NewAtom("xmlns");
|
||||
kParseTypeAtom = NS_NewAtom("parseType");
|
||||
NS_RegisterStaticAtoms(rdf_atoms, NS_ARRAY_LENGTH(rdf_atoms));
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -460,18 +463,6 @@ RDFContentSinkImpl::~RDFContentSinkImpl()
|
|||
NS_IF_RELEASE(kRDF_Seq);
|
||||
NS_IF_RELEASE(kRDF_nextVal);
|
||||
|
||||
NS_IF_RELEASE(kAboutAtom);
|
||||
NS_IF_RELEASE(kIdAtom);
|
||||
NS_IF_RELEASE(kAboutEachAtom);
|
||||
NS_IF_RELEASE(kResourceAtom);
|
||||
NS_IF_RELEASE(kRDFAtom);
|
||||
NS_IF_RELEASE(kDescriptionAtom);
|
||||
NS_IF_RELEASE(kBagAtom);
|
||||
NS_IF_RELEASE(kSeqAtom);
|
||||
NS_IF_RELEASE(kAltAtom);
|
||||
NS_IF_RELEASE(kLiAtom);
|
||||
NS_IF_RELEASE(kXMLNSAtom);
|
||||
NS_IF_RELEASE(kParseTypeAtom);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,12 +108,14 @@
|
|||
#include "nsIDOMWindowCollection.h"
|
||||
#include "imgICache.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsStaticAtom.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIFileURL.h"
|
||||
|
||||
static char kChromePrefix[] = "chrome://";
|
||||
static char kUseXBLFormsPref[] = "nglayout.debug.enable_xbl_forms";
|
||||
nsIAtom* nsChromeRegistry::sCPrefix; // atom for "c"
|
||||
|
||||
#define kChromeFileName NS_LITERAL_CSTRING("chrome.rdf")
|
||||
#define kInstalledChromeFileName NS_LITERAL_CSTRING("installed-chrome.txt")
|
||||
|
@ -315,6 +317,32 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsChromeRegistry, nsIChromeRegistry, nsIXULChromeR
|
|||
nsresult
|
||||
nsChromeRegistry::Init()
|
||||
{
|
||||
// these atoms appear in almost every chrome registry manifest.rdf
|
||||
// in some form or another. making static atoms prevents the atoms
|
||||
// from constantly being created/destroyed during parsing
|
||||
|
||||
static const nsStaticAtom atoms[] = {
|
||||
{ "c", &sCPrefix },
|
||||
{ "chrome", nsnull },
|
||||
{ "NC", nsnull },
|
||||
{ "baseURL", nsnull},
|
||||
{ "allowScripts", nsnull },
|
||||
{ "skinVersion", nsnull },
|
||||
{ "package", nsnull },
|
||||
{ "packages", nsnull },
|
||||
{ "locType", nsnull },
|
||||
{ "displayName", nsnull },
|
||||
{ "author", nsnull },
|
||||
{ "localeVersion", nsnull },
|
||||
{ "localeType", nsnull },
|
||||
{ "selectedLocale", nsnull },
|
||||
{ "selectedSkin", nsnull },
|
||||
{ "hasOverlays", nsnull },
|
||||
{ "previewURL", nsnull },
|
||||
};
|
||||
|
||||
NS_RegisterStaticAtoms(atoms, NS_ARRAY_LENGTH(atoms));
|
||||
|
||||
gChromeRegistry = this;
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
@ -252,6 +252,9 @@ protected:
|
|||
nsCOMPtr<nsIZipReader> mOverrideJAR;
|
||||
nsCString mOverrideJARURL;
|
||||
|
||||
// useful atoms - these are static atoms, so don't use nsCOMPtr
|
||||
static nsIAtom* sCPrefix; // "c"
|
||||
|
||||
PRBool mUseXBLForms;
|
||||
|
||||
PRPackedBool mInstallInitialized;
|
||||
|
|
|
@ -454,6 +454,7 @@ static const nsStaticAtom directory_atoms[] = {
|
|||
{ NS_OS_TEMP_DIR, &nsDirectoryService::sOS_TemporaryDirectory },
|
||||
{ NS_OS_CURRENT_PROCESS_DIR, &nsDirectoryService::sOS_CurrentProcessDirectory },
|
||||
{ NS_OS_CURRENT_WORKING_DIR, &nsDirectoryService::sOS_CurrentWorkingDirectory },
|
||||
{ NS_XPCOM_INIT_CURRENT_PROCESS_DIR, nsnull },
|
||||
#if defined (XP_MACOSX)
|
||||
{ NS_OS_SYSTEM_DIR, &nsDirectoryService::sDirectory },
|
||||
{ NS_MAC_DESKTOP_DIR, &nsDirectoryService::sDesktopDirectory },
|
||||
|
|
Загрузка…
Ссылка в новой задаче