From 9356d42ebed42403fb5beb29b43e4c8d094e5b3c Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Fri, 12 Mar 1999 11:25:17 +0000 Subject: [PATCH] Using nsHashtable and nsProgIDKey for dll hashing git-svn-id: svn://10.0.0.236/trunk@23930 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/components/nsComponentManager.cpp | 17 ++++++++++------- mozilla/xpcom/components/nsComponentManager.h | 5 ++--- mozilla/xpcom/src/nsComponentManager.cpp | 17 ++++++++++------- mozilla/xpcom/src/nsComponentManager.h | 5 ++--- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 6cb162699e6..736e35cbce7 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -47,7 +47,7 @@ #include "prlink.h" #include "prsystem.h" #include "prprf.h" -#include "xcDllStore.h" +#include "xcDll.h" #include "prlog.h" #include "prerror.h" @@ -83,7 +83,7 @@ nsFactoryEntry::~nsFactoryEntry(void) } nsresult -nsFactoryEntry::Init(nsDllStore* dllCollection, +nsFactoryEntry::Init(nsHashtable* dllCollection, const nsCID &aClass, const char *aLibrary, PRTime lastModTime, PRUint32 fileSize) { @@ -92,9 +92,11 @@ nsFactoryEntry::Init(nsDllStore* dllCollection, } cid = aClass; + nsProgIDKey key(aLibrary); + // If dll not already in dllCollection, add it. // PR_EnterMonitor(mMon); - dll = dllCollection->Get(aLibrary); + dll = (nsDll *) dllCollection->Get(&key); // PR_ExitMonitor(mMon); if (dll == NULL) { @@ -118,7 +120,7 @@ nsFactoryEntry::Init(nsDllStore* dllCollection, aLibrary)); // PR_EnterMonitor(mMon); - dllCollection->Put(aLibrary, dll); + dllCollection->Put(&key, (void *)dll); // PR_ExitMonitor(mMon); } } @@ -161,7 +163,7 @@ nsresult nsComponentManagerImpl::Init(void) return NS_ERROR_OUT_OF_MEMORY; } if (mDllStore == NULL) { - mDllStore = new nsDllStore(); + mDllStore = new nsHashtable(); if (mDllStore == NULL) return NS_ERROR_OUT_OF_MEMORY; } @@ -1752,7 +1754,8 @@ nsComponentManagerImpl::SyncComponentsInFile(const char *fullname) } // Check if dll is one that we have already seen - nsDll *dll = mDllStore->Get(fullname); + nsProgIDKey key(fullname); + nsDll *dll = (nsDll *) mDllStore->Get(&key); nsresult rv = NS_OK; if (dll == NULL) { @@ -1851,7 +1854,7 @@ nsComponentManagerImpl::SyncComponentsInFile(const char *fullname) dll = new nsDll(fullname); if (dll == NULL) return NS_ERROR_OUT_OF_MEMORY; - mDllStore->Put(fullname, dll); + mDllStore->Put(&key, (void *) dll); } // dll == NULL // Either we are seeing the dll for the first time or the dll has diff --git a/mozilla/xpcom/components/nsComponentManager.h b/mozilla/xpcom/components/nsComponentManager.h index 70d4a13bd8c..41b7847f7e7 100644 --- a/mozilla/xpcom/components/nsComponentManager.h +++ b/mozilla/xpcom/components/nsComponentManager.h @@ -26,7 +26,6 @@ #include "prmon.h" class nsFactoryEntry; -class nsDllStore; class nsDll; //////////////////////////////////////////////////////////////////////////////// @@ -170,7 +169,7 @@ protected: nsHashtable* mFactories; nsHashtable* mProgIDs; PRMonitor* mMon; - nsDllStore* mDllStore; + nsHashtable* mDllStore; }; #define NS_MAX_FILENAME_LEN 1024 @@ -231,7 +230,7 @@ public: nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory); ~nsFactoryEntry(); - nsresult Init(nsDllStore* store, const nsCID &aClass, const char *aLibrary, + nsresult Init(nsHashtable* dllHashtable, const nsCID &aClass, const char *aLibrary, PRTime lastModTime, PRUint32 fileSize); nsCID cid; diff --git a/mozilla/xpcom/src/nsComponentManager.cpp b/mozilla/xpcom/src/nsComponentManager.cpp index 6cb162699e6..736e35cbce7 100644 --- a/mozilla/xpcom/src/nsComponentManager.cpp +++ b/mozilla/xpcom/src/nsComponentManager.cpp @@ -47,7 +47,7 @@ #include "prlink.h" #include "prsystem.h" #include "prprf.h" -#include "xcDllStore.h" +#include "xcDll.h" #include "prlog.h" #include "prerror.h" @@ -83,7 +83,7 @@ nsFactoryEntry::~nsFactoryEntry(void) } nsresult -nsFactoryEntry::Init(nsDllStore* dllCollection, +nsFactoryEntry::Init(nsHashtable* dllCollection, const nsCID &aClass, const char *aLibrary, PRTime lastModTime, PRUint32 fileSize) { @@ -92,9 +92,11 @@ nsFactoryEntry::Init(nsDllStore* dllCollection, } cid = aClass; + nsProgIDKey key(aLibrary); + // If dll not already in dllCollection, add it. // PR_EnterMonitor(mMon); - dll = dllCollection->Get(aLibrary); + dll = (nsDll *) dllCollection->Get(&key); // PR_ExitMonitor(mMon); if (dll == NULL) { @@ -118,7 +120,7 @@ nsFactoryEntry::Init(nsDllStore* dllCollection, aLibrary)); // PR_EnterMonitor(mMon); - dllCollection->Put(aLibrary, dll); + dllCollection->Put(&key, (void *)dll); // PR_ExitMonitor(mMon); } } @@ -161,7 +163,7 @@ nsresult nsComponentManagerImpl::Init(void) return NS_ERROR_OUT_OF_MEMORY; } if (mDllStore == NULL) { - mDllStore = new nsDllStore(); + mDllStore = new nsHashtable(); if (mDllStore == NULL) return NS_ERROR_OUT_OF_MEMORY; } @@ -1752,7 +1754,8 @@ nsComponentManagerImpl::SyncComponentsInFile(const char *fullname) } // Check if dll is one that we have already seen - nsDll *dll = mDllStore->Get(fullname); + nsProgIDKey key(fullname); + nsDll *dll = (nsDll *) mDllStore->Get(&key); nsresult rv = NS_OK; if (dll == NULL) { @@ -1851,7 +1854,7 @@ nsComponentManagerImpl::SyncComponentsInFile(const char *fullname) dll = new nsDll(fullname); if (dll == NULL) return NS_ERROR_OUT_OF_MEMORY; - mDllStore->Put(fullname, dll); + mDllStore->Put(&key, (void *) dll); } // dll == NULL // Either we are seeing the dll for the first time or the dll has diff --git a/mozilla/xpcom/src/nsComponentManager.h b/mozilla/xpcom/src/nsComponentManager.h index 70d4a13bd8c..41b7847f7e7 100644 --- a/mozilla/xpcom/src/nsComponentManager.h +++ b/mozilla/xpcom/src/nsComponentManager.h @@ -26,7 +26,6 @@ #include "prmon.h" class nsFactoryEntry; -class nsDllStore; class nsDll; //////////////////////////////////////////////////////////////////////////////// @@ -170,7 +169,7 @@ protected: nsHashtable* mFactories; nsHashtable* mProgIDs; PRMonitor* mMon; - nsDllStore* mDllStore; + nsHashtable* mDllStore; }; #define NS_MAX_FILENAME_LEN 1024 @@ -231,7 +230,7 @@ public: nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory); ~nsFactoryEntry(); - nsresult Init(nsDllStore* store, const nsCID &aClass, const char *aLibrary, + nsresult Init(nsHashtable* dllHashtable, const nsCID &aClass, const char *aLibrary, PRTime lastModTime, PRUint32 fileSize); nsCID cid;