1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "mozilla/ModuleUtils.h"
7 #include "mozilla/Attributes.h"
11 #include "nsThebesFontEnumerator.h"
12 #include "nsScriptableRegion.h"
14 #include "gfxPlatform.h"
16 // This class doesn't do anything; its only purpose is to give
17 // gfxPlatform::Init a way to force this component to be registered,
18 // so that gfxPlatform::Shutdown will be called at an appropriate
19 // time. (Component teardown is the only shutdown hook that runs
20 // late enough; see bug 651498.)
23 class GfxInitialization MOZ_FINAL
: public nsISupports
{
27 NS_IMPL_ISUPPORTS0(GfxInitialization
)
30 NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator
)
33 nsScriptableRegionConstructor(nsISupports
*aOuter
, REFNSIID aIID
, void **aResult
)
36 return NS_ERROR_NULL_POINTER
;
40 return NS_ERROR_NO_AGGREGATION
;
43 nsCOMPtr
<nsIScriptableRegion
> scriptableRgn
= new nsScriptableRegion();
44 return scriptableRgn
->QueryInterface(aIID
, aResult
);
47 NS_GENERIC_FACTORY_CONSTRUCTOR(GfxInitialization
)
49 NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID
);
50 NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID
);
51 NS_DEFINE_NAMED_CID(NS_GFX_INITIALIZATION_CID
);
53 static const mozilla::Module::CIDEntry kThebesCIDs
[] = {
54 { &kNS_FONT_ENUMERATOR_CID
, false, NULL
, nsThebesFontEnumeratorConstructor
},
55 { &kNS_SCRIPTABLE_REGION_CID
, false, NULL
, nsScriptableRegionConstructor
},
56 { &kNS_GFX_INITIALIZATION_CID
, false, NULL
, GfxInitializationConstructor
},
60 static const mozilla::Module::ContractIDEntry kThebesContracts
[] = {
61 { "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID
},
62 { "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID
},
63 { "@mozilla.org/gfx/init;1", &kNS_GFX_INITIALIZATION_CID
},
68 nsThebesGfxModuleDtor()
70 gfxPlatform::Shutdown();
73 static const mozilla::Module kThebesModule
= {
74 mozilla::Module::kVersion
,
83 NSMODULE_DEFN(nsGfxModule
) = &kThebesModule
;