зеркало из https://github.com/mozilla/pjs.git
Fix for bug 659580 (Flush CanvasImageCache on shutdown). r=roc.
--HG-- extra : rebase_source : 9752189ce8c9bd13795979cfa8d50311b5bf5b56
This commit is contained in:
Родитель
59c1bb6c46
Коммит
93df84ab84
|
@ -133,6 +133,13 @@ public:
|
||||||
|
|
||||||
static ImageCache* gImageCache = nsnull;
|
static ImageCache* gImageCache = nsnull;
|
||||||
|
|
||||||
|
class CanvasImageCacheShutdownObserver : public nsIObserver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
NS_DECL_NSIOBSERVER
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
CanvasImageCache::NotifyDrawImage(nsIDOMElement* aImage,
|
CanvasImageCache::NotifyDrawImage(nsIDOMElement* aImage,
|
||||||
nsHTMLCanvasElement* aCanvas,
|
nsHTMLCanvasElement* aCanvas,
|
||||||
|
@ -142,6 +149,7 @@ CanvasImageCache::NotifyDrawImage(nsIDOMElement* aImage,
|
||||||
{
|
{
|
||||||
if (!gImageCache) {
|
if (!gImageCache) {
|
||||||
gImageCache = new ImageCache();
|
gImageCache = new ImageCache();
|
||||||
|
nsContentUtils::RegisterShutdownObserver(new CanvasImageCacheShutdownObserver());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageCacheEntry* entry = gImageCache->mCache.PutEntry(ImageCacheKey(aImage, aCanvas));
|
ImageCacheEntry* entry = gImageCache->mCache.PutEntry(ImageCacheKey(aImage, aCanvas));
|
||||||
|
@ -186,11 +194,21 @@ CanvasImageCache::Lookup(nsIDOMElement* aImage,
|
||||||
return entry->mData->mSurface;
|
return entry->mData->mSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
NS_IMPL_ISUPPORTS1(CanvasImageCacheShutdownObserver, nsIObserver)
|
||||||
CanvasImageCache::Shutdown()
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
CanvasImageCacheShutdownObserver::Observe(nsISupports *aSubject,
|
||||||
|
const char *aTopic,
|
||||||
|
const PRUnichar *aData)
|
||||||
{
|
{
|
||||||
delete gImageCache;
|
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
|
||||||
gImageCache = nsnull;
|
delete gImageCache;
|
||||||
|
gImageCache = nsnull;
|
||||||
|
|
||||||
|
nsContentUtils::UnregisterShutdownObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,6 @@ public:
|
||||||
static gfxASurface* Lookup(nsIDOMElement* aImage,
|
static gfxASurface* Lookup(nsIDOMElement* aImage,
|
||||||
nsHTMLCanvasElement* aCanvas,
|
nsHTMLCanvasElement* aCanvas,
|
||||||
gfxIntSize* aSize);
|
gfxIntSize* aSize);
|
||||||
|
|
||||||
static void Shutdown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,6 @@
|
||||||
#include "nsContentSink.h"
|
#include "nsContentSink.h"
|
||||||
#include "nsFrameMessageManager.h"
|
#include "nsFrameMessageManager.h"
|
||||||
#include "nsRefreshDriver.h"
|
#include "nsRefreshDriver.h"
|
||||||
#include "CanvasImageCache.h"
|
|
||||||
|
|
||||||
#include "nsHyphenationManager.h"
|
#include "nsHyphenationManager.h"
|
||||||
|
|
||||||
|
@ -281,7 +280,6 @@ nsLayoutStatics::Initialize()
|
||||||
void
|
void
|
||||||
nsLayoutStatics::Shutdown()
|
nsLayoutStatics::Shutdown()
|
||||||
{
|
{
|
||||||
CanvasImageCache::Shutdown();
|
|
||||||
nsFrameScriptExecutor::Shutdown();
|
nsFrameScriptExecutor::Shutdown();
|
||||||
nsFocusManager::Shutdown();
|
nsFocusManager::Shutdown();
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
|
|
Загрузка…
Ссылка в новой задаче