Bug 913138 - Shut down gfx at the end of layout shutdown. r=bsmedberg

This commit is contained in:
Bobby Holley 2014-04-08 15:51:33 -07:00
Родитель 6e51e9eed4
Коммит ca041c08fd
3 изменённых файлов: 6 добавлений и 31 удалений

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

@ -18,20 +18,6 @@
#include "nsScriptableRegion.h" // for nsScriptableRegion
#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator
// This class doesn't do anything; its only purpose is to give
// gfxPlatform::Init a way to force this component to be registered,
// so that gfxPlatform::Shutdown will be called at an appropriate
// time. (Component teardown is the only shutdown hook that runs
// late enough; see bug 651498.)
namespace {
class GfxInitialization MOZ_FINAL : public nsISupports {
NS_DECL_ISUPPORTS
};
NS_IMPL_ISUPPORTS0(GfxInitialization)
}
NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator)
static nsresult
@ -49,32 +35,21 @@ nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult
return scriptableRgn->QueryInterface(aIID, aResult);
}
NS_GENERIC_FACTORY_CONSTRUCTOR(GfxInitialization)
NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID);
NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID);
NS_DEFINE_NAMED_CID(NS_GFX_INITIALIZATION_CID);
static const mozilla::Module::CIDEntry kThebesCIDs[] = {
{ &kNS_FONT_ENUMERATOR_CID, false, nullptr, nsThebesFontEnumeratorConstructor },
{ &kNS_SCRIPTABLE_REGION_CID, false, nullptr, nsScriptableRegionConstructor },
{ &kNS_GFX_INITIALIZATION_CID, false, nullptr, GfxInitializationConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kThebesContracts[] = {
{ "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID },
{ "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID },
{ "@mozilla.org/gfx/init;1", &kNS_GFX_INITIALIZATION_CID },
{ nullptr }
};
static void
nsThebesGfxModuleDtor()
{
gfxPlatform::Shutdown();
}
static const mozilla::Module kThebesModule = {
mozilla::Module::kVersion,
kThebesCIDs,
@ -82,7 +57,7 @@ static const mozilla::Module kThebesModule = {
nullptr,
nullptr,
nullptr,
nsThebesGfxModuleDtor
nullptr
};
NSMODULE_DEFN(nsGfxModule) = &kThebesModule;

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

@ -421,11 +421,6 @@ gfxPlatform::Init()
mozilla::layers::InitGralloc();
#endif
// Force registration of the gfx component, thus arranging for
// ::Shutdown to be called.
nsCOMPtr<nsISupports> forceReg
= do_CreateInstance("@mozilla.org/gfx/init;1");
Preferences::RegisterCallbackAndCall(RecordingPrefChanged, "gfx.2d.recording", nullptr);
CreateCMSOutputProfile();

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

@ -70,6 +70,7 @@
#include "nsDOMBlobBuilder.h"
#include "nsDOMFileReader.h"
#include "gfxPlatform.h"
#include "nsFormData.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsHostObjectURI.h"
@ -1250,6 +1251,10 @@ LayoutModuleDtor()
nsContentUtils::XPCOMShutdown();
nsScriptSecurityManager::Shutdown();
xpcModuleDtor();
// Layout depends heavily on gfx, so we want to make sure that gfx is shut
// down after all the layout cleanup runs.
gfxPlatform::Shutdown();
}
static const mozilla::Module kLayoutModule = {