Bug 461199 (Part 3) - Create a cached getter for mozilla::IHistory on nsContentUtils.

r=sicking
This commit is contained in:
Shawn Wilsher 2009-11-09 10:00:53 -08:00
parent c8b6d66e49
commit 2abf598ed6
2 changed files with 18 additions and 0 deletions

View File

@ -123,6 +123,10 @@ typedef int (*PR_CALLBACK PrefChangedFunc)(const char *, void *);
#define have_PrefChangedFunc_typedef
#endif
namespace mozilla {
class IHistory;
}
extern const char kLoadAsData[];
enum EventNameType {
@ -466,6 +470,11 @@ public:
return sImgLoader;
}
static mozilla::IHistory* GetHistory()
{
return sHistory;
}
#ifdef MOZ_XTF
static nsIXTFService* GetXTFService();
#endif
@ -1558,6 +1567,8 @@ private:
static imgILoader* sImgLoader;
static imgICache* sImgCache;
static mozilla::IHistory* sHistory;
static nsIConsoleService* sConsoleService;
static nsDataHashtable<nsISupportsHashKey, EventNameMapping>* sEventTable;

View File

@ -98,6 +98,8 @@
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "imgILoader.h"
#include "mozilla/IHistory.h"
#include "nsDocShellCID.h"
#include "nsIImageLoadingContent.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
@ -201,6 +203,7 @@ nsIXTFService *nsContentUtils::sXTFService = nsnull;
nsIPrefBranch2 *nsContentUtils::sPrefBranch = nsnull;
imgILoader *nsContentUtils::sImgLoader;
imgICache *nsContentUtils::sImgCache;
mozilla::IHistory *nsContentUtils::sHistory;
nsIConsoleService *nsContentUtils::sConsoleService;
nsDataHashtable<nsISupportsHashKey, EventNameMapping>* nsContentUtils::sEventTable = nsnull;
nsIStringBundleService *nsContentUtils::sStringBundleService;
@ -374,6 +377,9 @@ nsContentUtils::Init()
sImgCache = nsnull;
}
rv = CallGetService(NS_IHISTORY_CONTRACTID, &sHistory);
NS_ENSURE_SUCCESS(rv, rv);
sPtrsToPtrsToRelease = new nsTArray<nsISupports**>();
if (!sPtrsToPtrsToRelease) {
return NS_ERROR_OUT_OF_MEMORY;
@ -954,6 +960,7 @@ nsContentUtils::Shutdown()
#endif
NS_IF_RELEASE(sImgLoader);
NS_IF_RELEASE(sImgCache);
NS_IF_RELEASE(sHistory);
NS_IF_RELEASE(sPrefBranch);
#ifdef IBMBIDI
NS_IF_RELEASE(sBidiKeyboard);