update the preloader - not part of build

add support for services and non-services
This commit is contained in:
alecf%netscape.com 2001-05-17 18:44:55 +00:00
Родитель 8809f01423
Коммит 740a099cd1
1 изменённых файлов: 30 добавлений и 10 удалений

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

@ -27,13 +27,29 @@
#include "nsIObserver.h" #include "nsIObserver.h"
#include "nsIAppStartupNotifier.h" #include "nsIAppStartupNotifier.h"
struct preloadEntry {
static const char* preloadedServices[] = { PRBool isService;
"@mozilla.org/network/io-service;1", const char* contractId;
"@mozilla.org/rdf/rdf-service;1",
}; };
#define PRELOADED_SERVICES_COUNT (sizeof(preloadedServices) / sizeof(preloadedServices[0])) static preloadEntry preloadedObjects[] = {
// necko
{PR_TRUE, "@mozilla.org/network/io-service;1" },
// rdf
{PR_TRUE, "@mozilla.org/rdf/rdf-service;1" },
// preferences
{PR_TRUE, "@mozilla.org/preferences-service;1" },
// string bundles
{PR_TRUE, "@mozilla.org/intl/stringbundle;1" },
// docshell
{PR_FALSE, "@mozilla.org/docshell/html;1" },
// imglib
// appcomps
// parser
};
#define PRELOADED_SERVICES_COUNT (sizeof(preloadedObjects) / sizeof(preloadedObjects[0]))
NS_IMPL_ISUPPORTS1(nsPreloader, nsICmdLineHandler) NS_IMPL_ISUPPORTS1(nsPreloader, nsICmdLineHandler)
@ -61,9 +77,9 @@ nsPreloader::~nsPreloader()
} }
CMDLINEHANDLER1_IMPL(nsPreloader, // classname CMDLINEHANDLER1_IMPL(nsPreloader, // classname
"-preloader", // arguments "-server", // arguments
"general.startup.preloader", // pref name (none) "general.startup.server", // pref name (not used)
"***Load and stay resident!***", // command line help text "Load and stay resident!", // command line help text
PR_FALSE, // handles window arguments? PR_FALSE, // handles window arguments?
"", // no window arguments "", // no window arguments
PR_FALSE) // don't open a window PR_FALSE) // don't open a window
@ -92,8 +108,12 @@ nsPreloader::RegisterProc(nsIComponentManager *aCompMgr, nsIFile *aPath,
PRInt32 i; PRInt32 i;
for (i=0; i<PRELOADED_SERVICES_COUNT; i++) { for (i=0; i<PRELOADED_SERVICES_COUNT; i++) {
nsCAutoString categoryEntry("service,"); nsCAutoString categoryEntry;
categoryEntry.Append(preloadedServices[i]);
if (preloadedObjects[i].isService)
categoryEntry.Append("service,");
categoryEntry.Append(preloadedObjects[i].contractId);
catman->AddCategoryEntry("preloaded-services", catman->AddCategoryEntry("preloaded-services",
categoryEntry.get(), // key - must be unique categoryEntry.get(), // key - must be unique